Merge pull request #49 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 /// Checks if the given object is currently in the success state
43 #[no_mangle]
44 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
45         o.result_ok
46 }
47 #[no_mangle]
48 /// Frees any resources used by the CResult_SecretKeyErrorZ.
49 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
50 impl Drop for CResult_SecretKeyErrorZ {
51         fn drop(&mut self) {
52                 if self.result_ok {
53                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
54                                 let _ = unsafe { Box::from_raw(self.contents.result) };
55                         }
56                 } else {
57                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
58                                 let _ = unsafe { Box::from_raw(self.contents.err) };
59                         }
60                 }
61         }
62 }
63 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
64         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
65                 let contents = if o.result_ok {
66                         let result = unsafe { o.contents.result };
67                         unsafe { o.contents.result = std::ptr::null_mut() };
68                         CResult_SecretKeyErrorZPtr { result }
69                 } else {
70                         let err = unsafe { o.contents.err };
71                         unsafe { o.contents.err = std::ptr::null_mut(); }
72                         CResult_SecretKeyErrorZPtr { err }
73                 };
74                 Self {
75                         contents,
76                         result_ok: o.result_ok,
77                 }
78         }
79 }
80 #[repr(C)]
81 /// The contents of CResult_PublicKeyErrorZ
82 pub union CResult_PublicKeyErrorZPtr {
83         /// A pointer to the contents in the success state.
84         /// Reading from this pointer when `result_ok` is not set is undefined.
85         pub result: *mut crate::c_types::PublicKey,
86         /// A pointer to the contents in the error state.
87         /// Reading from this pointer when `result_ok` is set is undefined.
88         pub err: *mut crate::c_types::Secp256k1Error,
89 }
90 #[repr(C)]
91 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
92 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
93 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
94 pub struct CResult_PublicKeyErrorZ {
95         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
96         /// `err` or `result` depending on the state of `result_ok`.
97         pub contents: CResult_PublicKeyErrorZPtr,
98         /// Whether this CResult_PublicKeyErrorZ represents a success state.
99         pub result_ok: bool,
100 }
101 #[no_mangle]
102 /// Creates a new CResult_PublicKeyErrorZ in the success state.
103 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
104         CResult_PublicKeyErrorZ {
105                 contents: CResult_PublicKeyErrorZPtr {
106                         result: Box::into_raw(Box::new(o)),
107                 },
108                 result_ok: true,
109         }
110 }
111 #[no_mangle]
112 /// Creates a new CResult_PublicKeyErrorZ in the error state.
113 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
114         CResult_PublicKeyErrorZ {
115                 contents: CResult_PublicKeyErrorZPtr {
116                         err: Box::into_raw(Box::new(e)),
117                 },
118                 result_ok: false,
119         }
120 }
121 /// Checks if the given object is currently in the success state
122 #[no_mangle]
123 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
124         o.result_ok
125 }
126 #[no_mangle]
127 /// Frees any resources used by the CResult_PublicKeyErrorZ.
128 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
129 impl Drop for CResult_PublicKeyErrorZ {
130         fn drop(&mut self) {
131                 if self.result_ok {
132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
134                         }
135                 } else {
136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
138                         }
139                 }
140         }
141 }
142 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
143         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
144                 let contents = if o.result_ok {
145                         let result = unsafe { o.contents.result };
146                         unsafe { o.contents.result = std::ptr::null_mut() };
147                         CResult_PublicKeyErrorZPtr { result }
148                 } else {
149                         let err = unsafe { o.contents.err };
150                         unsafe { o.contents.err = std::ptr::null_mut(); }
151                         CResult_PublicKeyErrorZPtr { err }
152                 };
153                 Self {
154                         contents,
155                         result_ok: o.result_ok,
156                 }
157         }
158 }
159 impl Clone for CResult_PublicKeyErrorZ {
160         fn clone(&self) -> Self {
161                 if self.result_ok {
162                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
163                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
164                         } }
165                 } else {
166                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
167                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
168                         } }
169                 }
170         }
171 }
172 #[no_mangle]
173 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
174 /// but with all dynamically-allocated buffers duplicated in new buffers.
175 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
176 #[repr(C)]
177 /// The contents of CResult_TxCreationKeysDecodeErrorZ
178 pub union CResult_TxCreationKeysDecodeErrorZPtr {
179         /// A pointer to the contents in the success state.
180         /// Reading from this pointer when `result_ok` is not set is undefined.
181         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
182         /// A pointer to the contents in the error state.
183         /// Reading from this pointer when `result_ok` is set is undefined.
184         pub err: *mut crate::lightning::ln::msgs::DecodeError,
185 }
186 #[repr(C)]
187 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
188 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
190 pub struct CResult_TxCreationKeysDecodeErrorZ {
191         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
192         /// `err` or `result` depending on the state of `result_ok`.
193         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
194         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
195         pub result_ok: bool,
196 }
197 #[no_mangle]
198 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
199 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
200         CResult_TxCreationKeysDecodeErrorZ {
201                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
202                         result: Box::into_raw(Box::new(o)),
203                 },
204                 result_ok: true,
205         }
206 }
207 #[no_mangle]
208 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
209 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
210         CResult_TxCreationKeysDecodeErrorZ {
211                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
212                         err: Box::into_raw(Box::new(e)),
213                 },
214                 result_ok: false,
215         }
216 }
217 /// Checks if the given object is currently in the success state
218 #[no_mangle]
219 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
220         o.result_ok
221 }
222 #[no_mangle]
223 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
224 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
225 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
226         fn drop(&mut self) {
227                 if self.result_ok {
228                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
229                                 let _ = unsafe { Box::from_raw(self.contents.result) };
230                         }
231                 } else {
232                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
233                                 let _ = unsafe { Box::from_raw(self.contents.err) };
234                         }
235                 }
236         }
237 }
238 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
239         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
240                 let contents = if o.result_ok {
241                         let result = unsafe { o.contents.result };
242                         unsafe { o.contents.result = std::ptr::null_mut() };
243                         CResult_TxCreationKeysDecodeErrorZPtr { result }
244                 } else {
245                         let err = unsafe { o.contents.err };
246                         unsafe { o.contents.err = std::ptr::null_mut(); }
247                         CResult_TxCreationKeysDecodeErrorZPtr { err }
248                 };
249                 Self {
250                         contents,
251                         result_ok: o.result_ok,
252                 }
253         }
254 }
255 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
256         fn clone(&self) -> Self {
257                 if self.result_ok {
258                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
259                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
260                         } }
261                 } else {
262                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
263                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
264                         } }
265                 }
266         }
267 }
268 #[no_mangle]
269 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
270 /// but with all dynamically-allocated buffers duplicated in new buffers.
271 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
272 #[repr(C)]
273 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
274 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
275         /// A pointer to the contents in the success state.
276         /// Reading from this pointer when `result_ok` is not set is undefined.
277         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
278         /// A pointer to the contents in the error state.
279         /// Reading from this pointer when `result_ok` is set is undefined.
280         pub err: *mut crate::lightning::ln::msgs::DecodeError,
281 }
282 #[repr(C)]
283 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
284 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
286 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
287         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
288         /// `err` or `result` depending on the state of `result_ok`.
289         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
290         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
291         pub result_ok: bool,
292 }
293 #[no_mangle]
294 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
295 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
296         CResult_ChannelPublicKeysDecodeErrorZ {
297                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
298                         result: Box::into_raw(Box::new(o)),
299                 },
300                 result_ok: true,
301         }
302 }
303 #[no_mangle]
304 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
305 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
306         CResult_ChannelPublicKeysDecodeErrorZ {
307                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
308                         err: Box::into_raw(Box::new(e)),
309                 },
310                 result_ok: false,
311         }
312 }
313 /// Checks if the given object is currently in the success state
314 #[no_mangle]
315 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
316         o.result_ok
317 }
318 #[no_mangle]
319 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
320 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
321 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
322         fn drop(&mut self) {
323                 if self.result_ok {
324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
326                         }
327                 } else {
328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
330                         }
331                 }
332         }
333 }
334 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
335         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
336                 let contents = if o.result_ok {
337                         let result = unsafe { o.contents.result };
338                         unsafe { o.contents.result = std::ptr::null_mut() };
339                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
340                 } else {
341                         let err = unsafe { o.contents.err };
342                         unsafe { o.contents.err = std::ptr::null_mut(); }
343                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
344                 };
345                 Self {
346                         contents,
347                         result_ok: o.result_ok,
348                 }
349         }
350 }
351 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
352         fn clone(&self) -> Self {
353                 if self.result_ok {
354                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
355                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
356                         } }
357                 } else {
358                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
360                         } }
361                 }
362         }
363 }
364 #[no_mangle]
365 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
366 /// but with all dynamically-allocated buffers duplicated in new buffers.
367 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
368 #[repr(C)]
369 /// The contents of CResult_TxCreationKeysErrorZ
370 pub union CResult_TxCreationKeysErrorZPtr {
371         /// A pointer to the contents in the success state.
372         /// Reading from this pointer when `result_ok` is not set is undefined.
373         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
374         /// A pointer to the contents in the error state.
375         /// Reading from this pointer when `result_ok` is set is undefined.
376         pub err: *mut crate::c_types::Secp256k1Error,
377 }
378 #[repr(C)]
379 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
380 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
382 pub struct CResult_TxCreationKeysErrorZ {
383         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
384         /// `err` or `result` depending on the state of `result_ok`.
385         pub contents: CResult_TxCreationKeysErrorZPtr,
386         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
387         pub result_ok: bool,
388 }
389 #[no_mangle]
390 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
391 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
392         CResult_TxCreationKeysErrorZ {
393                 contents: CResult_TxCreationKeysErrorZPtr {
394                         result: Box::into_raw(Box::new(o)),
395                 },
396                 result_ok: true,
397         }
398 }
399 #[no_mangle]
400 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
401 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
402         CResult_TxCreationKeysErrorZ {
403                 contents: CResult_TxCreationKeysErrorZPtr {
404                         err: Box::into_raw(Box::new(e)),
405                 },
406                 result_ok: false,
407         }
408 }
409 /// Checks if the given object is currently in the success state
410 #[no_mangle]
411 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
412         o.result_ok
413 }
414 #[no_mangle]
415 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
416 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
417 impl Drop for CResult_TxCreationKeysErrorZ {
418         fn drop(&mut self) {
419                 if self.result_ok {
420                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
421                                 let _ = unsafe { Box::from_raw(self.contents.result) };
422                         }
423                 } else {
424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
426                         }
427                 }
428         }
429 }
430 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
431         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
432                 let contents = if o.result_ok {
433                         let result = unsafe { o.contents.result };
434                         unsafe { o.contents.result = std::ptr::null_mut() };
435                         CResult_TxCreationKeysErrorZPtr { result }
436                 } else {
437                         let err = unsafe { o.contents.err };
438                         unsafe { o.contents.err = std::ptr::null_mut(); }
439                         CResult_TxCreationKeysErrorZPtr { err }
440                 };
441                 Self {
442                         contents,
443                         result_ok: o.result_ok,
444                 }
445         }
446 }
447 impl Clone for CResult_TxCreationKeysErrorZ {
448         fn clone(&self) -> Self {
449                 if self.result_ok {
450                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
451                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
452                         } }
453                 } else {
454                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
455                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
456                         } }
457                 }
458         }
459 }
460 #[no_mangle]
461 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
462 /// but with all dynamically-allocated buffers duplicated in new buffers.
463 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
464 #[repr(C)]
465 #[derive(Clone)]
466 /// An enum which can either contain a u32 or not
467 pub enum COption_u32Z {
468         /// When we're in this state, this COption_u32Z contains a u32
469         Some(u32),
470         /// When we're in this state, this COption_u32Z contains nothing
471         None
472 }
473 impl COption_u32Z {
474         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
475                 if let Self::Some(_) = self { true } else { false }
476         }
477         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
478                 !self.is_some()
479         }
480         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
481                 if let Self::Some(v) = self { v } else { unreachable!() }
482         }
483 }
484 #[no_mangle]
485 /// Constructs a new COption_u32Z containing a u32
486 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
487         COption_u32Z::Some(o)
488 }
489 #[no_mangle]
490 /// Constructs a new COption_u32Z containing nothing
491 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
492         COption_u32Z::None
493 }
494 #[no_mangle]
495 /// Frees any resources associated with the u32, if we are in the Some state
496 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
497 #[no_mangle]
498 /// Creates a new COption_u32Z which has the same data as `orig`
499 /// but with all dynamically-allocated buffers duplicated in new buffers.
500 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
501 #[repr(C)]
502 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
503 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
504         /// A pointer to the contents in the success state.
505         /// Reading from this pointer when `result_ok` is not set is undefined.
506         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
507         /// A pointer to the contents in the error state.
508         /// Reading from this pointer when `result_ok` is set is undefined.
509         pub err: *mut crate::lightning::ln::msgs::DecodeError,
510 }
511 #[repr(C)]
512 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
513 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
515 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
516         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
517         /// `err` or `result` depending on the state of `result_ok`.
518         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
519         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
520         pub result_ok: bool,
521 }
522 #[no_mangle]
523 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
524 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
525         CResult_HTLCOutputInCommitmentDecodeErrorZ {
526                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
527                         result: Box::into_raw(Box::new(o)),
528                 },
529                 result_ok: true,
530         }
531 }
532 #[no_mangle]
533 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
534 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
535         CResult_HTLCOutputInCommitmentDecodeErrorZ {
536                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
537                         err: Box::into_raw(Box::new(e)),
538                 },
539                 result_ok: false,
540         }
541 }
542 /// Checks if the given object is currently in the success state
543 #[no_mangle]
544 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
545         o.result_ok
546 }
547 #[no_mangle]
548 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
549 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
550 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
551         fn drop(&mut self) {
552                 if self.result_ok {
553                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
554                                 let _ = unsafe { Box::from_raw(self.contents.result) };
555                         }
556                 } else {
557                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
558                                 let _ = unsafe { Box::from_raw(self.contents.err) };
559                         }
560                 }
561         }
562 }
563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
564         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
565                 let contents = if o.result_ok {
566                         let result = unsafe { o.contents.result };
567                         unsafe { o.contents.result = std::ptr::null_mut() };
568                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
569                 } else {
570                         let err = unsafe { o.contents.err };
571                         unsafe { o.contents.err = std::ptr::null_mut(); }
572                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
573                 };
574                 Self {
575                         contents,
576                         result_ok: o.result_ok,
577                 }
578         }
579 }
580 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
581         fn clone(&self) -> Self {
582                 if self.result_ok {
583                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
584                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
585                         } }
586                 } else {
587                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
588                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
589                         } }
590                 }
591         }
592 }
593 #[no_mangle]
594 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
595 /// but with all dynamically-allocated buffers duplicated in new buffers.
596 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
597 #[repr(C)]
598 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
599 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
600         /// A pointer to the contents in the success state.
601         /// Reading from this pointer when `result_ok` is not set is undefined.
602         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
603         /// A pointer to the contents in the error state.
604         /// Reading from this pointer when `result_ok` is set is undefined.
605         pub err: *mut crate::lightning::ln::msgs::DecodeError,
606 }
607 #[repr(C)]
608 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
609 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
611 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
612         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
613         /// `err` or `result` depending on the state of `result_ok`.
614         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
615         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
616         pub result_ok: bool,
617 }
618 #[no_mangle]
619 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
620 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
621         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
622                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
623                         result: Box::into_raw(Box::new(o)),
624                 },
625                 result_ok: true,
626         }
627 }
628 #[no_mangle]
629 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
630 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
631         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
632                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
633                         err: Box::into_raw(Box::new(e)),
634                 },
635                 result_ok: false,
636         }
637 }
638 /// Checks if the given object is currently in the success state
639 #[no_mangle]
640 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
641         o.result_ok
642 }
643 #[no_mangle]
644 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
645 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
646 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
647         fn drop(&mut self) {
648                 if self.result_ok {
649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
651                         }
652                 } else {
653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
655                         }
656                 }
657         }
658 }
659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
661                 let contents = if o.result_ok {
662                         let result = unsafe { o.contents.result };
663                         unsafe { o.contents.result = std::ptr::null_mut() };
664                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
665                 } else {
666                         let err = unsafe { o.contents.err };
667                         unsafe { o.contents.err = std::ptr::null_mut(); }
668                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
669                 };
670                 Self {
671                         contents,
672                         result_ok: o.result_ok,
673                 }
674         }
675 }
676 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
677         fn clone(&self) -> Self {
678                 if self.result_ok {
679                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
680                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
681                         } }
682                 } else {
683                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
684                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
685                         } }
686                 }
687         }
688 }
689 #[no_mangle]
690 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
691 /// but with all dynamically-allocated buffers duplicated in new buffers.
692 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
693 #[repr(C)]
694 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
695 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
696         /// A pointer to the contents in the success state.
697         /// Reading from this pointer when `result_ok` is not set is undefined.
698         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
699         /// A pointer to the contents in the error state.
700         /// Reading from this pointer when `result_ok` is set is undefined.
701         pub err: *mut crate::lightning::ln::msgs::DecodeError,
702 }
703 #[repr(C)]
704 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
705 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
707 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
708         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
709         /// `err` or `result` depending on the state of `result_ok`.
710         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
711         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
712         pub result_ok: bool,
713 }
714 #[no_mangle]
715 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
716 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
717         CResult_ChannelTransactionParametersDecodeErrorZ {
718                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
719                         result: Box::into_raw(Box::new(o)),
720                 },
721                 result_ok: true,
722         }
723 }
724 #[no_mangle]
725 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
726 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
727         CResult_ChannelTransactionParametersDecodeErrorZ {
728                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
729                         err: Box::into_raw(Box::new(e)),
730                 },
731                 result_ok: false,
732         }
733 }
734 /// Checks if the given object is currently in the success state
735 #[no_mangle]
736 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
737         o.result_ok
738 }
739 #[no_mangle]
740 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
741 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
742 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
743         fn drop(&mut self) {
744                 if self.result_ok {
745                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
746                                 let _ = unsafe { Box::from_raw(self.contents.result) };
747                         }
748                 } else {
749                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
750                                 let _ = unsafe { Box::from_raw(self.contents.err) };
751                         }
752                 }
753         }
754 }
755 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
756         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
757                 let contents = if o.result_ok {
758                         let result = unsafe { o.contents.result };
759                         unsafe { o.contents.result = std::ptr::null_mut() };
760                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
761                 } else {
762                         let err = unsafe { o.contents.err };
763                         unsafe { o.contents.err = std::ptr::null_mut(); }
764                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
765                 };
766                 Self {
767                         contents,
768                         result_ok: o.result_ok,
769                 }
770         }
771 }
772 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
773         fn clone(&self) -> Self {
774                 if self.result_ok {
775                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
776                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
777                         } }
778                 } else {
779                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
780                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
781                         } }
782                 }
783         }
784 }
785 #[no_mangle]
786 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
787 /// but with all dynamically-allocated buffers duplicated in new buffers.
788 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
789 #[repr(C)]
790 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
791 /// This corresponds to std::vector in C++
792 pub struct CVec_SignatureZ {
793         /// The elements in the array.
794         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
795         pub data: *mut crate::c_types::Signature,
796         /// The number of elements pointed to by `data`.
797         pub datalen: usize
798 }
799 impl CVec_SignatureZ {
800         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
801                 if self.datalen == 0 { return Vec::new(); }
802                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
803                 self.data = std::ptr::null_mut();
804                 self.datalen = 0;
805                 ret
806         }
807         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
808                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
809         }
810 }
811 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
812         fn from(v: Vec<crate::c_types::Signature>) -> Self {
813                 let datalen = v.len();
814                 let data = Box::into_raw(v.into_boxed_slice());
815                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
816         }
817 }
818 #[no_mangle]
819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
820 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
821 impl Drop for CVec_SignatureZ {
822         fn drop(&mut self) {
823                 if self.datalen == 0 { return; }
824                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
825         }
826 }
827 impl Clone for CVec_SignatureZ {
828         fn clone(&self) -> Self {
829                 let mut res = Vec::new();
830                 if self.datalen == 0 { return Self::from(res); }
831                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
832                 Self::from(res)
833         }
834 }
835 #[repr(C)]
836 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
837 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
838         /// A pointer to the contents in the success state.
839         /// Reading from this pointer when `result_ok` is not set is undefined.
840         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
841         /// A pointer to the contents in the error state.
842         /// Reading from this pointer when `result_ok` is set is undefined.
843         pub err: *mut crate::lightning::ln::msgs::DecodeError,
844 }
845 #[repr(C)]
846 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
847 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
848 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
849 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
850         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
851         /// `err` or `result` depending on the state of `result_ok`.
852         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
853         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
854         pub result_ok: bool,
855 }
856 #[no_mangle]
857 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
858 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
859         CResult_HolderCommitmentTransactionDecodeErrorZ {
860                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
861                         result: Box::into_raw(Box::new(o)),
862                 },
863                 result_ok: true,
864         }
865 }
866 #[no_mangle]
867 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
868 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
869         CResult_HolderCommitmentTransactionDecodeErrorZ {
870                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
871                         err: Box::into_raw(Box::new(e)),
872                 },
873                 result_ok: false,
874         }
875 }
876 /// Checks if the given object is currently in the success state
877 #[no_mangle]
878 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
879         o.result_ok
880 }
881 #[no_mangle]
882 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
883 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
884 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
885         fn drop(&mut self) {
886                 if self.result_ok {
887                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
888                                 let _ = unsafe { Box::from_raw(self.contents.result) };
889                         }
890                 } else {
891                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
892                                 let _ = unsafe { Box::from_raw(self.contents.err) };
893                         }
894                 }
895         }
896 }
897 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
898         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
899                 let contents = if o.result_ok {
900                         let result = unsafe { o.contents.result };
901                         unsafe { o.contents.result = std::ptr::null_mut() };
902                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
903                 } else {
904                         let err = unsafe { o.contents.err };
905                         unsafe { o.contents.err = std::ptr::null_mut(); }
906                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
907                 };
908                 Self {
909                         contents,
910                         result_ok: o.result_ok,
911                 }
912         }
913 }
914 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
915         fn clone(&self) -> Self {
916                 if self.result_ok {
917                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
918                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
919                         } }
920                 } else {
921                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
922                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
923                         } }
924                 }
925         }
926 }
927 #[no_mangle]
928 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
929 /// but with all dynamically-allocated buffers duplicated in new buffers.
930 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
931 #[repr(C)]
932 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
933 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
934         /// A pointer to the contents in the success state.
935         /// Reading from this pointer when `result_ok` is not set is undefined.
936         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
937         /// A pointer to the contents in the error state.
938         /// Reading from this pointer when `result_ok` is set is undefined.
939         pub err: *mut crate::lightning::ln::msgs::DecodeError,
940 }
941 #[repr(C)]
942 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
943 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
945 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
946         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
947         /// `err` or `result` depending on the state of `result_ok`.
948         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
949         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
950         pub result_ok: bool,
951 }
952 #[no_mangle]
953 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
954 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
955         CResult_BuiltCommitmentTransactionDecodeErrorZ {
956                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
957                         result: Box::into_raw(Box::new(o)),
958                 },
959                 result_ok: true,
960         }
961 }
962 #[no_mangle]
963 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
964 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
965         CResult_BuiltCommitmentTransactionDecodeErrorZ {
966                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
967                         err: Box::into_raw(Box::new(e)),
968                 },
969                 result_ok: false,
970         }
971 }
972 /// Checks if the given object is currently in the success state
973 #[no_mangle]
974 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
975         o.result_ok
976 }
977 #[no_mangle]
978 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
979 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
980 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
981         fn drop(&mut self) {
982                 if self.result_ok {
983                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
984                                 let _ = unsafe { Box::from_raw(self.contents.result) };
985                         }
986                 } else {
987                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
988                                 let _ = unsafe { Box::from_raw(self.contents.err) };
989                         }
990                 }
991         }
992 }
993 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
994         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
995                 let contents = if o.result_ok {
996                         let result = unsafe { o.contents.result };
997                         unsafe { o.contents.result = std::ptr::null_mut() };
998                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
999                 } else {
1000                         let err = unsafe { o.contents.err };
1001                         unsafe { o.contents.err = std::ptr::null_mut(); }
1002                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1003                 };
1004                 Self {
1005                         contents,
1006                         result_ok: o.result_ok,
1007                 }
1008         }
1009 }
1010 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1011         fn clone(&self) -> Self {
1012                 if self.result_ok {
1013                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1014                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1015                         } }
1016                 } else {
1017                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1018                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1019                         } }
1020                 }
1021         }
1022 }
1023 #[no_mangle]
1024 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1025 /// but with all dynamically-allocated buffers duplicated in new buffers.
1026 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1027 #[repr(C)]
1028 /// The contents of CResult_TrustedClosingTransactionNoneZ
1029 pub union CResult_TrustedClosingTransactionNoneZPtr {
1030         /// A pointer to the contents in the success state.
1031         /// Reading from this pointer when `result_ok` is not set is undefined.
1032         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1033         /// Note that this value is always NULL, as there are no contents in the Err variant
1034         pub err: *mut std::ffi::c_void,
1035 }
1036 #[repr(C)]
1037 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1038 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1039 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1040 pub struct CResult_TrustedClosingTransactionNoneZ {
1041         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1042         /// `err` or `result` depending on the state of `result_ok`.
1043         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1044         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1045         pub result_ok: bool,
1046 }
1047 #[no_mangle]
1048 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1049 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1050         CResult_TrustedClosingTransactionNoneZ {
1051                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1052                         result: Box::into_raw(Box::new(o)),
1053                 },
1054                 result_ok: true,
1055         }
1056 }
1057 #[no_mangle]
1058 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1059 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1060         CResult_TrustedClosingTransactionNoneZ {
1061                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1062                         err: std::ptr::null_mut(),
1063                 },
1064                 result_ok: false,
1065         }
1066 }
1067 /// Checks if the given object is currently in the success state
1068 #[no_mangle]
1069 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1070         o.result_ok
1071 }
1072 #[no_mangle]
1073 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1074 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1075 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1076         fn drop(&mut self) {
1077                 if self.result_ok {
1078                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1079                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1080                         }
1081                 } else {
1082                 }
1083         }
1084 }
1085 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1087                 let contents = if o.result_ok {
1088                         let result = unsafe { o.contents.result };
1089                         unsafe { o.contents.result = std::ptr::null_mut() };
1090                         CResult_TrustedClosingTransactionNoneZPtr { result }
1091                 } else {
1092                         let _ = unsafe { Box::from_raw(o.contents.err) };
1093                         o.contents.err = std::ptr::null_mut();
1094                         CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1095                 };
1096                 Self {
1097                         contents,
1098                         result_ok: o.result_ok,
1099                 }
1100         }
1101 }
1102 #[repr(C)]
1103 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1104 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1105         /// A pointer to the contents in the success state.
1106         /// Reading from this pointer when `result_ok` is not set is undefined.
1107         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1108         /// A pointer to the contents in the error state.
1109         /// Reading from this pointer when `result_ok` is set is undefined.
1110         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1111 }
1112 #[repr(C)]
1113 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1114 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1116 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1117         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1118         /// `err` or `result` depending on the state of `result_ok`.
1119         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1120         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1121         pub result_ok: bool,
1122 }
1123 #[no_mangle]
1124 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1125 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1126         CResult_CommitmentTransactionDecodeErrorZ {
1127                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1128                         result: Box::into_raw(Box::new(o)),
1129                 },
1130                 result_ok: true,
1131         }
1132 }
1133 #[no_mangle]
1134 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1135 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1136         CResult_CommitmentTransactionDecodeErrorZ {
1137                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1138                         err: Box::into_raw(Box::new(e)),
1139                 },
1140                 result_ok: false,
1141         }
1142 }
1143 /// Checks if the given object is currently in the success state
1144 #[no_mangle]
1145 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1146         o.result_ok
1147 }
1148 #[no_mangle]
1149 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1150 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1151 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1152         fn drop(&mut self) {
1153                 if self.result_ok {
1154                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1155                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1156                         }
1157                 } else {
1158                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1159                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1160                         }
1161                 }
1162         }
1163 }
1164 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1165         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1166                 let contents = if o.result_ok {
1167                         let result = unsafe { o.contents.result };
1168                         unsafe { o.contents.result = std::ptr::null_mut() };
1169                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1170                 } else {
1171                         let err = unsafe { o.contents.err };
1172                         unsafe { o.contents.err = std::ptr::null_mut(); }
1173                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1174                 };
1175                 Self {
1176                         contents,
1177                         result_ok: o.result_ok,
1178                 }
1179         }
1180 }
1181 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1182         fn clone(&self) -> Self {
1183                 if self.result_ok {
1184                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1185                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1186                         } }
1187                 } else {
1188                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1189                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1190                         } }
1191                 }
1192         }
1193 }
1194 #[no_mangle]
1195 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1196 /// but with all dynamically-allocated buffers duplicated in new buffers.
1197 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1198 #[repr(C)]
1199 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1200 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1201         /// A pointer to the contents in the success state.
1202         /// Reading from this pointer when `result_ok` is not set is undefined.
1203         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1204         /// Note that this value is always NULL, as there are no contents in the Err variant
1205         pub err: *mut std::ffi::c_void,
1206 }
1207 #[repr(C)]
1208 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1209 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1211 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1212         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1213         /// `err` or `result` depending on the state of `result_ok`.
1214         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1215         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1216         pub result_ok: bool,
1217 }
1218 #[no_mangle]
1219 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1220 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1221         CResult_TrustedCommitmentTransactionNoneZ {
1222                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1223                         result: Box::into_raw(Box::new(o)),
1224                 },
1225                 result_ok: true,
1226         }
1227 }
1228 #[no_mangle]
1229 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1230 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1231         CResult_TrustedCommitmentTransactionNoneZ {
1232                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1233                         err: std::ptr::null_mut(),
1234                 },
1235                 result_ok: false,
1236         }
1237 }
1238 /// Checks if the given object is currently in the success state
1239 #[no_mangle]
1240 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1241         o.result_ok
1242 }
1243 #[no_mangle]
1244 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1245 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1246 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1247         fn drop(&mut self) {
1248                 if self.result_ok {
1249                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1250                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1251                         }
1252                 } else {
1253                 }
1254         }
1255 }
1256 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1257         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1258                 let contents = if o.result_ok {
1259                         let result = unsafe { o.contents.result };
1260                         unsafe { o.contents.result = std::ptr::null_mut() };
1261                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1262                 } else {
1263                         let _ = unsafe { Box::from_raw(o.contents.err) };
1264                         o.contents.err = std::ptr::null_mut();
1265                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1266                 };
1267                 Self {
1268                         contents,
1269                         result_ok: o.result_ok,
1270                 }
1271         }
1272 }
1273 #[repr(C)]
1274 /// The contents of CResult_CVec_SignatureZNoneZ
1275 pub union CResult_CVec_SignatureZNoneZPtr {
1276         /// A pointer to the contents in the success state.
1277         /// Reading from this pointer when `result_ok` is not set is undefined.
1278         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1279         /// Note that this value is always NULL, as there are no contents in the Err variant
1280         pub err: *mut std::ffi::c_void,
1281 }
1282 #[repr(C)]
1283 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1284 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1286 pub struct CResult_CVec_SignatureZNoneZ {
1287         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1288         /// `err` or `result` depending on the state of `result_ok`.
1289         pub contents: CResult_CVec_SignatureZNoneZPtr,
1290         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1291         pub result_ok: bool,
1292 }
1293 #[no_mangle]
1294 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1295 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1296         CResult_CVec_SignatureZNoneZ {
1297                 contents: CResult_CVec_SignatureZNoneZPtr {
1298                         result: Box::into_raw(Box::new(o)),
1299                 },
1300                 result_ok: true,
1301         }
1302 }
1303 #[no_mangle]
1304 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1305 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1306         CResult_CVec_SignatureZNoneZ {
1307                 contents: CResult_CVec_SignatureZNoneZPtr {
1308                         err: std::ptr::null_mut(),
1309                 },
1310                 result_ok: false,
1311         }
1312 }
1313 /// Checks if the given object is currently in the success state
1314 #[no_mangle]
1315 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1316         o.result_ok
1317 }
1318 #[no_mangle]
1319 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1320 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1321 impl Drop for CResult_CVec_SignatureZNoneZ {
1322         fn drop(&mut self) {
1323                 if self.result_ok {
1324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1326                         }
1327                 } else {
1328                 }
1329         }
1330 }
1331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1332         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1333                 let contents = if o.result_ok {
1334                         let result = unsafe { o.contents.result };
1335                         unsafe { o.contents.result = std::ptr::null_mut() };
1336                         CResult_CVec_SignatureZNoneZPtr { result }
1337                 } else {
1338                         let _ = unsafe { Box::from_raw(o.contents.err) };
1339                         o.contents.err = std::ptr::null_mut();
1340                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1341                 };
1342                 Self {
1343                         contents,
1344                         result_ok: o.result_ok,
1345                 }
1346         }
1347 }
1348 impl Clone for CResult_CVec_SignatureZNoneZ {
1349         fn clone(&self) -> Self {
1350                 if self.result_ok {
1351                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1352                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1353                         } }
1354                 } else {
1355                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1356                                 err: std::ptr::null_mut()
1357                         } }
1358                 }
1359         }
1360 }
1361 #[no_mangle]
1362 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1363 /// but with all dynamically-allocated buffers duplicated in new buffers.
1364 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1365 #[repr(C)]
1366 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1367 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1368         /// A pointer to the contents in the success state.
1369         /// Reading from this pointer when `result_ok` is not set is undefined.
1370         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1371         /// A pointer to the contents in the error state.
1372         /// Reading from this pointer when `result_ok` is set is undefined.
1373         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1374 }
1375 #[repr(C)]
1376 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1377 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1379 pub struct CResult_ShutdownScriptDecodeErrorZ {
1380         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1381         /// `err` or `result` depending on the state of `result_ok`.
1382         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1383         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1384         pub result_ok: bool,
1385 }
1386 #[no_mangle]
1387 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1388 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1389         CResult_ShutdownScriptDecodeErrorZ {
1390                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1391                         result: Box::into_raw(Box::new(o)),
1392                 },
1393                 result_ok: true,
1394         }
1395 }
1396 #[no_mangle]
1397 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1398 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1399         CResult_ShutdownScriptDecodeErrorZ {
1400                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1401                         err: Box::into_raw(Box::new(e)),
1402                 },
1403                 result_ok: false,
1404         }
1405 }
1406 /// Checks if the given object is currently in the success state
1407 #[no_mangle]
1408 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1409         o.result_ok
1410 }
1411 #[no_mangle]
1412 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1413 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1414 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1415         fn drop(&mut self) {
1416                 if self.result_ok {
1417                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1418                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1419                         }
1420                 } else {
1421                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1422                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1423                         }
1424                 }
1425         }
1426 }
1427 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1428         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1429                 let contents = if o.result_ok {
1430                         let result = unsafe { o.contents.result };
1431                         unsafe { o.contents.result = std::ptr::null_mut() };
1432                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1433                 } else {
1434                         let err = unsafe { o.contents.err };
1435                         unsafe { o.contents.err = std::ptr::null_mut(); }
1436                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1437                 };
1438                 Self {
1439                         contents,
1440                         result_ok: o.result_ok,
1441                 }
1442         }
1443 }
1444 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1445         fn clone(&self) -> Self {
1446                 if self.result_ok {
1447                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1448                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1449                         } }
1450                 } else {
1451                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1452                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1453                         } }
1454                 }
1455         }
1456 }
1457 #[no_mangle]
1458 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1459 /// but with all dynamically-allocated buffers duplicated in new buffers.
1460 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1461 #[repr(C)]
1462 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1463 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1464         /// A pointer to the contents in the success state.
1465         /// Reading from this pointer when `result_ok` is not set is undefined.
1466         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1467         /// A pointer to the contents in the error state.
1468         /// Reading from this pointer when `result_ok` is set is undefined.
1469         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1470 }
1471 #[repr(C)]
1472 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1473 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1475 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1476         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1477         /// `err` or `result` depending on the state of `result_ok`.
1478         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1479         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1480         pub result_ok: bool,
1481 }
1482 #[no_mangle]
1483 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1484 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1485         CResult_ShutdownScriptInvalidShutdownScriptZ {
1486                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1487                         result: Box::into_raw(Box::new(o)),
1488                 },
1489                 result_ok: true,
1490         }
1491 }
1492 #[no_mangle]
1493 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1494 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1495         CResult_ShutdownScriptInvalidShutdownScriptZ {
1496                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1497                         err: Box::into_raw(Box::new(e)),
1498                 },
1499                 result_ok: false,
1500         }
1501 }
1502 /// Checks if the given object is currently in the success state
1503 #[no_mangle]
1504 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1505         o.result_ok
1506 }
1507 #[no_mangle]
1508 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1509 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1510 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1511         fn drop(&mut self) {
1512                 if self.result_ok {
1513                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1514                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1515                         }
1516                 } else {
1517                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1518                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1519                         }
1520                 }
1521         }
1522 }
1523 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1524         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1525                 let contents = if o.result_ok {
1526                         let result = unsafe { o.contents.result };
1527                         unsafe { o.contents.result = std::ptr::null_mut() };
1528                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1529                 } else {
1530                         let err = unsafe { o.contents.err };
1531                         unsafe { o.contents.err = std::ptr::null_mut(); }
1532                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1533                 };
1534                 Self {
1535                         contents,
1536                         result_ok: o.result_ok,
1537                 }
1538         }
1539 }
1540 #[repr(C)]
1541 /// The contents of CResult_NoneErrorZ
1542 pub union CResult_NoneErrorZPtr {
1543         /// Note that this value is always NULL, as there are no contents in the OK variant
1544         pub result: *mut std::ffi::c_void,
1545         /// A pointer to the contents in the error state.
1546         /// Reading from this pointer when `result_ok` is set is undefined.
1547         pub err: *mut crate::c_types::IOError,
1548 }
1549 #[repr(C)]
1550 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1551 /// containing a () on success and a crate::c_types::IOError on failure.
1552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1553 pub struct CResult_NoneErrorZ {
1554         /// The contents of this CResult_NoneErrorZ, accessible via either
1555         /// `err` or `result` depending on the state of `result_ok`.
1556         pub contents: CResult_NoneErrorZPtr,
1557         /// Whether this CResult_NoneErrorZ represents a success state.
1558         pub result_ok: bool,
1559 }
1560 #[no_mangle]
1561 /// Creates a new CResult_NoneErrorZ in the success state.
1562 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1563         CResult_NoneErrorZ {
1564                 contents: CResult_NoneErrorZPtr {
1565                         result: std::ptr::null_mut(),
1566                 },
1567                 result_ok: true,
1568         }
1569 }
1570 #[no_mangle]
1571 /// Creates a new CResult_NoneErrorZ in the error state.
1572 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1573         CResult_NoneErrorZ {
1574                 contents: CResult_NoneErrorZPtr {
1575                         err: Box::into_raw(Box::new(e)),
1576                 },
1577                 result_ok: false,
1578         }
1579 }
1580 /// Checks if the given object is currently in the success state
1581 #[no_mangle]
1582 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1583         o.result_ok
1584 }
1585 #[no_mangle]
1586 /// Frees any resources used by the CResult_NoneErrorZ.
1587 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1588 impl Drop for CResult_NoneErrorZ {
1589         fn drop(&mut self) {
1590                 if self.result_ok {
1591                 } else {
1592                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1593                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1594                         }
1595                 }
1596         }
1597 }
1598 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1599         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1600                 let contents = if o.result_ok {
1601                         let _ = unsafe { Box::from_raw(o.contents.result) };
1602                         o.contents.result = std::ptr::null_mut();
1603                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1604                 } else {
1605                         let err = unsafe { o.contents.err };
1606                         unsafe { o.contents.err = std::ptr::null_mut(); }
1607                         CResult_NoneErrorZPtr { err }
1608                 };
1609                 Self {
1610                         contents,
1611                         result_ok: o.result_ok,
1612                 }
1613         }
1614 }
1615 impl Clone for CResult_NoneErrorZ {
1616         fn clone(&self) -> Self {
1617                 if self.result_ok {
1618                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1619                                 result: std::ptr::null_mut()
1620                         } }
1621                 } else {
1622                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1623                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1624                         } }
1625                 }
1626         }
1627 }
1628 #[no_mangle]
1629 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1630 /// but with all dynamically-allocated buffers duplicated in new buffers.
1631 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1632 #[repr(C)]
1633 /// The contents of CResult_RouteHopDecodeErrorZ
1634 pub union CResult_RouteHopDecodeErrorZPtr {
1635         /// A pointer to the contents in the success state.
1636         /// Reading from this pointer when `result_ok` is not set is undefined.
1637         pub result: *mut crate::lightning::routing::router::RouteHop,
1638         /// A pointer to the contents in the error state.
1639         /// Reading from this pointer when `result_ok` is set is undefined.
1640         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1641 }
1642 #[repr(C)]
1643 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1644 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1645 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1646 pub struct CResult_RouteHopDecodeErrorZ {
1647         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1648         /// `err` or `result` depending on the state of `result_ok`.
1649         pub contents: CResult_RouteHopDecodeErrorZPtr,
1650         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1651         pub result_ok: bool,
1652 }
1653 #[no_mangle]
1654 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1655 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1656         CResult_RouteHopDecodeErrorZ {
1657                 contents: CResult_RouteHopDecodeErrorZPtr {
1658                         result: Box::into_raw(Box::new(o)),
1659                 },
1660                 result_ok: true,
1661         }
1662 }
1663 #[no_mangle]
1664 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1665 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1666         CResult_RouteHopDecodeErrorZ {
1667                 contents: CResult_RouteHopDecodeErrorZPtr {
1668                         err: Box::into_raw(Box::new(e)),
1669                 },
1670                 result_ok: false,
1671         }
1672 }
1673 /// Checks if the given object is currently in the success state
1674 #[no_mangle]
1675 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1676         o.result_ok
1677 }
1678 #[no_mangle]
1679 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1680 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1681 impl Drop for CResult_RouteHopDecodeErrorZ {
1682         fn drop(&mut self) {
1683                 if self.result_ok {
1684                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1685                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1686                         }
1687                 } else {
1688                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1689                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1690                         }
1691                 }
1692         }
1693 }
1694 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1695         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1696                 let contents = if o.result_ok {
1697                         let result = unsafe { o.contents.result };
1698                         unsafe { o.contents.result = std::ptr::null_mut() };
1699                         CResult_RouteHopDecodeErrorZPtr { result }
1700                 } else {
1701                         let err = unsafe { o.contents.err };
1702                         unsafe { o.contents.err = std::ptr::null_mut(); }
1703                         CResult_RouteHopDecodeErrorZPtr { err }
1704                 };
1705                 Self {
1706                         contents,
1707                         result_ok: o.result_ok,
1708                 }
1709         }
1710 }
1711 impl Clone for CResult_RouteHopDecodeErrorZ {
1712         fn clone(&self) -> Self {
1713                 if self.result_ok {
1714                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1715                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1716                         } }
1717                 } else {
1718                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1719                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1720                         } }
1721                 }
1722         }
1723 }
1724 #[no_mangle]
1725 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1726 /// but with all dynamically-allocated buffers duplicated in new buffers.
1727 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1728 #[repr(C)]
1729 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1730 /// This corresponds to std::vector in C++
1731 pub struct CVec_RouteHopZ {
1732         /// The elements in the array.
1733         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1734         pub data: *mut crate::lightning::routing::router::RouteHop,
1735         /// The number of elements pointed to by `data`.
1736         pub datalen: usize
1737 }
1738 impl CVec_RouteHopZ {
1739         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1740                 if self.datalen == 0 { return Vec::new(); }
1741                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1742                 self.data = std::ptr::null_mut();
1743                 self.datalen = 0;
1744                 ret
1745         }
1746         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1747                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1748         }
1749 }
1750 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1751         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1752                 let datalen = v.len();
1753                 let data = Box::into_raw(v.into_boxed_slice());
1754                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1755         }
1756 }
1757 #[no_mangle]
1758 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1759 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1760 impl Drop for CVec_RouteHopZ {
1761         fn drop(&mut self) {
1762                 if self.datalen == 0 { return; }
1763                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1764         }
1765 }
1766 impl Clone for CVec_RouteHopZ {
1767         fn clone(&self) -> Self {
1768                 let mut res = Vec::new();
1769                 if self.datalen == 0 { return Self::from(res); }
1770                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1771                 Self::from(res)
1772         }
1773 }
1774 #[repr(C)]
1775 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1776 /// This corresponds to std::vector in C++
1777 pub struct CVec_CVec_RouteHopZZ {
1778         /// The elements in the array.
1779         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1780         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1781         /// The number of elements pointed to by `data`.
1782         pub datalen: usize
1783 }
1784 impl CVec_CVec_RouteHopZZ {
1785         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1786                 if self.datalen == 0 { return Vec::new(); }
1787                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1788                 self.data = std::ptr::null_mut();
1789                 self.datalen = 0;
1790                 ret
1791         }
1792         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1793                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1794         }
1795 }
1796 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1797         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1798                 let datalen = v.len();
1799                 let data = Box::into_raw(v.into_boxed_slice());
1800                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1801         }
1802 }
1803 #[no_mangle]
1804 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1805 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1806 impl Drop for CVec_CVec_RouteHopZZ {
1807         fn drop(&mut self) {
1808                 if self.datalen == 0 { return; }
1809                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1810         }
1811 }
1812 impl Clone for CVec_CVec_RouteHopZZ {
1813         fn clone(&self) -> Self {
1814                 let mut res = Vec::new();
1815                 if self.datalen == 0 { return Self::from(res); }
1816                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1817                 Self::from(res)
1818         }
1819 }
1820 #[repr(C)]
1821 /// The contents of CResult_RouteDecodeErrorZ
1822 pub union CResult_RouteDecodeErrorZPtr {
1823         /// A pointer to the contents in the success state.
1824         /// Reading from this pointer when `result_ok` is not set is undefined.
1825         pub result: *mut crate::lightning::routing::router::Route,
1826         /// A pointer to the contents in the error state.
1827         /// Reading from this pointer when `result_ok` is set is undefined.
1828         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1829 }
1830 #[repr(C)]
1831 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1832 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1834 pub struct CResult_RouteDecodeErrorZ {
1835         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1836         /// `err` or `result` depending on the state of `result_ok`.
1837         pub contents: CResult_RouteDecodeErrorZPtr,
1838         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1839         pub result_ok: bool,
1840 }
1841 #[no_mangle]
1842 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1843 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1844         CResult_RouteDecodeErrorZ {
1845                 contents: CResult_RouteDecodeErrorZPtr {
1846                         result: Box::into_raw(Box::new(o)),
1847                 },
1848                 result_ok: true,
1849         }
1850 }
1851 #[no_mangle]
1852 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1853 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1854         CResult_RouteDecodeErrorZ {
1855                 contents: CResult_RouteDecodeErrorZPtr {
1856                         err: Box::into_raw(Box::new(e)),
1857                 },
1858                 result_ok: false,
1859         }
1860 }
1861 /// Checks if the given object is currently in the success state
1862 #[no_mangle]
1863 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
1864         o.result_ok
1865 }
1866 #[no_mangle]
1867 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1868 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1869 impl Drop for CResult_RouteDecodeErrorZ {
1870         fn drop(&mut self) {
1871                 if self.result_ok {
1872                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1873                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1874                         }
1875                 } else {
1876                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1877                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1878                         }
1879                 }
1880         }
1881 }
1882 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1883         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1884                 let contents = if o.result_ok {
1885                         let result = unsafe { o.contents.result };
1886                         unsafe { o.contents.result = std::ptr::null_mut() };
1887                         CResult_RouteDecodeErrorZPtr { result }
1888                 } else {
1889                         let err = unsafe { o.contents.err };
1890                         unsafe { o.contents.err = std::ptr::null_mut(); }
1891                         CResult_RouteDecodeErrorZPtr { err }
1892                 };
1893                 Self {
1894                         contents,
1895                         result_ok: o.result_ok,
1896                 }
1897         }
1898 }
1899 impl Clone for CResult_RouteDecodeErrorZ {
1900         fn clone(&self) -> Self {
1901                 if self.result_ok {
1902                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1903                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1904                         } }
1905                 } else {
1906                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1907                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1908                         } }
1909                 }
1910         }
1911 }
1912 #[no_mangle]
1913 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1914 /// but with all dynamically-allocated buffers duplicated in new buffers.
1915 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1916 #[repr(C)]
1917 /// The contents of CResult_RouteParametersDecodeErrorZ
1918 pub union CResult_RouteParametersDecodeErrorZPtr {
1919         /// A pointer to the contents in the success state.
1920         /// Reading from this pointer when `result_ok` is not set is undefined.
1921         pub result: *mut crate::lightning::routing::router::RouteParameters,
1922         /// A pointer to the contents in the error state.
1923         /// Reading from this pointer when `result_ok` is set is undefined.
1924         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1925 }
1926 #[repr(C)]
1927 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1928 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1930 pub struct CResult_RouteParametersDecodeErrorZ {
1931         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1932         /// `err` or `result` depending on the state of `result_ok`.
1933         pub contents: CResult_RouteParametersDecodeErrorZPtr,
1934         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1935         pub result_ok: bool,
1936 }
1937 #[no_mangle]
1938 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1939 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1940         CResult_RouteParametersDecodeErrorZ {
1941                 contents: CResult_RouteParametersDecodeErrorZPtr {
1942                         result: Box::into_raw(Box::new(o)),
1943                 },
1944                 result_ok: true,
1945         }
1946 }
1947 #[no_mangle]
1948 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
1949 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
1950         CResult_RouteParametersDecodeErrorZ {
1951                 contents: CResult_RouteParametersDecodeErrorZPtr {
1952                         err: Box::into_raw(Box::new(e)),
1953                 },
1954                 result_ok: false,
1955         }
1956 }
1957 /// Checks if the given object is currently in the success state
1958 #[no_mangle]
1959 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
1960         o.result_ok
1961 }
1962 #[no_mangle]
1963 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
1964 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
1965 impl Drop for CResult_RouteParametersDecodeErrorZ {
1966         fn drop(&mut self) {
1967                 if self.result_ok {
1968                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1969                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1970                         }
1971                 } else {
1972                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1973                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1974                         }
1975                 }
1976         }
1977 }
1978 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
1979         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1980                 let contents = if o.result_ok {
1981                         let result = unsafe { o.contents.result };
1982                         unsafe { o.contents.result = std::ptr::null_mut() };
1983                         CResult_RouteParametersDecodeErrorZPtr { result }
1984                 } else {
1985                         let err = unsafe { o.contents.err };
1986                         unsafe { o.contents.err = std::ptr::null_mut(); }
1987                         CResult_RouteParametersDecodeErrorZPtr { err }
1988                 };
1989                 Self {
1990                         contents,
1991                         result_ok: o.result_ok,
1992                 }
1993         }
1994 }
1995 impl Clone for CResult_RouteParametersDecodeErrorZ {
1996         fn clone(&self) -> Self {
1997                 if self.result_ok {
1998                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
1999                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2000                         } }
2001                 } else {
2002                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2003                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2004                         } }
2005                 }
2006         }
2007 }
2008 #[no_mangle]
2009 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2010 /// but with all dynamically-allocated buffers duplicated in new buffers.
2011 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2012 #[repr(C)]
2013 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2014 /// This corresponds to std::vector in C++
2015 pub struct CVec_RouteHintZ {
2016         /// The elements in the array.
2017         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2018         pub data: *mut crate::lightning::routing::router::RouteHint,
2019         /// The number of elements pointed to by `data`.
2020         pub datalen: usize
2021 }
2022 impl CVec_RouteHintZ {
2023         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2024                 if self.datalen == 0 { return Vec::new(); }
2025                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2026                 self.data = std::ptr::null_mut();
2027                 self.datalen = 0;
2028                 ret
2029         }
2030         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2031                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2032         }
2033 }
2034 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2035         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2036                 let datalen = v.len();
2037                 let data = Box::into_raw(v.into_boxed_slice());
2038                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2039         }
2040 }
2041 #[no_mangle]
2042 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2043 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2044 impl Drop for CVec_RouteHintZ {
2045         fn drop(&mut self) {
2046                 if self.datalen == 0 { return; }
2047                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2048         }
2049 }
2050 impl Clone for CVec_RouteHintZ {
2051         fn clone(&self) -> Self {
2052                 let mut res = Vec::new();
2053                 if self.datalen == 0 { return Self::from(res); }
2054                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2055                 Self::from(res)
2056         }
2057 }
2058 #[repr(C)]
2059 #[derive(Clone)]
2060 /// An enum which can either contain a u64 or not
2061 pub enum COption_u64Z {
2062         /// When we're in this state, this COption_u64Z contains a u64
2063         Some(u64),
2064         /// When we're in this state, this COption_u64Z contains nothing
2065         None
2066 }
2067 impl COption_u64Z {
2068         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2069                 if let Self::Some(_) = self { true } else { false }
2070         }
2071         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2072                 !self.is_some()
2073         }
2074         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2075                 if let Self::Some(v) = self { v } else { unreachable!() }
2076         }
2077 }
2078 #[no_mangle]
2079 /// Constructs a new COption_u64Z containing a u64
2080 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2081         COption_u64Z::Some(o)
2082 }
2083 #[no_mangle]
2084 /// Constructs a new COption_u64Z containing nothing
2085 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2086         COption_u64Z::None
2087 }
2088 #[no_mangle]
2089 /// Frees any resources associated with the u64, if we are in the Some state
2090 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2091 #[no_mangle]
2092 /// Creates a new COption_u64Z which has the same data as `orig`
2093 /// but with all dynamically-allocated buffers duplicated in new buffers.
2094 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2095 #[repr(C)]
2096 /// The contents of CResult_PayeeDecodeErrorZ
2097 pub union CResult_PayeeDecodeErrorZPtr {
2098         /// A pointer to the contents in the success state.
2099         /// Reading from this pointer when `result_ok` is not set is undefined.
2100         pub result: *mut crate::lightning::routing::router::Payee,
2101         /// A pointer to the contents in the error state.
2102         /// Reading from this pointer when `result_ok` is set is undefined.
2103         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2104 }
2105 #[repr(C)]
2106 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2107 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2109 pub struct CResult_PayeeDecodeErrorZ {
2110         /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2111         /// `err` or `result` depending on the state of `result_ok`.
2112         pub contents: CResult_PayeeDecodeErrorZPtr,
2113         /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2114         pub result_ok: bool,
2115 }
2116 #[no_mangle]
2117 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2118 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2119         CResult_PayeeDecodeErrorZ {
2120                 contents: CResult_PayeeDecodeErrorZPtr {
2121                         result: Box::into_raw(Box::new(o)),
2122                 },
2123                 result_ok: true,
2124         }
2125 }
2126 #[no_mangle]
2127 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2128 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2129         CResult_PayeeDecodeErrorZ {
2130                 contents: CResult_PayeeDecodeErrorZPtr {
2131                         err: Box::into_raw(Box::new(e)),
2132                 },
2133                 result_ok: false,
2134         }
2135 }
2136 /// Checks if the given object is currently in the success state
2137 #[no_mangle]
2138 pub extern "C" fn CResult_PayeeDecodeErrorZ_is_ok(o: &CResult_PayeeDecodeErrorZ) -> bool {
2139         o.result_ok
2140 }
2141 #[no_mangle]
2142 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2143 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2144 impl Drop for CResult_PayeeDecodeErrorZ {
2145         fn drop(&mut self) {
2146                 if self.result_ok {
2147                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2148                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2149                         }
2150                 } else {
2151                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2152                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2153                         }
2154                 }
2155         }
2156 }
2157 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2158         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2159                 let contents = if o.result_ok {
2160                         let result = unsafe { o.contents.result };
2161                         unsafe { o.contents.result = std::ptr::null_mut() };
2162                         CResult_PayeeDecodeErrorZPtr { result }
2163                 } else {
2164                         let err = unsafe { o.contents.err };
2165                         unsafe { o.contents.err = std::ptr::null_mut(); }
2166                         CResult_PayeeDecodeErrorZPtr { err }
2167                 };
2168                 Self {
2169                         contents,
2170                         result_ok: o.result_ok,
2171                 }
2172         }
2173 }
2174 impl Clone for CResult_PayeeDecodeErrorZ {
2175         fn clone(&self) -> Self {
2176                 if self.result_ok {
2177                         Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2178                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2179                         } }
2180                 } else {
2181                         Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2182                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2183                         } }
2184                 }
2185         }
2186 }
2187 #[no_mangle]
2188 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2189 /// but with all dynamically-allocated buffers duplicated in new buffers.
2190 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2191 #[repr(C)]
2192 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2193 /// This corresponds to std::vector in C++
2194 pub struct CVec_RouteHintHopZ {
2195         /// The elements in the array.
2196         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2197         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2198         /// The number of elements pointed to by `data`.
2199         pub datalen: usize
2200 }
2201 impl CVec_RouteHintHopZ {
2202         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2203                 if self.datalen == 0 { return Vec::new(); }
2204                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2205                 self.data = std::ptr::null_mut();
2206                 self.datalen = 0;
2207                 ret
2208         }
2209         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2210                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2211         }
2212 }
2213 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2214         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2215                 let datalen = v.len();
2216                 let data = Box::into_raw(v.into_boxed_slice());
2217                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2218         }
2219 }
2220 #[no_mangle]
2221 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2222 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2223 impl Drop for CVec_RouteHintHopZ {
2224         fn drop(&mut self) {
2225                 if self.datalen == 0 { return; }
2226                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2227         }
2228 }
2229 impl Clone for CVec_RouteHintHopZ {
2230         fn clone(&self) -> Self {
2231                 let mut res = Vec::new();
2232                 if self.datalen == 0 { return Self::from(res); }
2233                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2234                 Self::from(res)
2235         }
2236 }
2237 #[repr(C)]
2238 /// The contents of CResult_RouteHintDecodeErrorZ
2239 pub union CResult_RouteHintDecodeErrorZPtr {
2240         /// A pointer to the contents in the success state.
2241         /// Reading from this pointer when `result_ok` is not set is undefined.
2242         pub result: *mut crate::lightning::routing::router::RouteHint,
2243         /// A pointer to the contents in the error state.
2244         /// Reading from this pointer when `result_ok` is set is undefined.
2245         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2246 }
2247 #[repr(C)]
2248 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2249 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2250 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2251 pub struct CResult_RouteHintDecodeErrorZ {
2252         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2253         /// `err` or `result` depending on the state of `result_ok`.
2254         pub contents: CResult_RouteHintDecodeErrorZPtr,
2255         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2256         pub result_ok: bool,
2257 }
2258 #[no_mangle]
2259 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2260 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2261         CResult_RouteHintDecodeErrorZ {
2262                 contents: CResult_RouteHintDecodeErrorZPtr {
2263                         result: Box::into_raw(Box::new(o)),
2264                 },
2265                 result_ok: true,
2266         }
2267 }
2268 #[no_mangle]
2269 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2270 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2271         CResult_RouteHintDecodeErrorZ {
2272                 contents: CResult_RouteHintDecodeErrorZPtr {
2273                         err: Box::into_raw(Box::new(e)),
2274                 },
2275                 result_ok: false,
2276         }
2277 }
2278 /// Checks if the given object is currently in the success state
2279 #[no_mangle]
2280 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2281         o.result_ok
2282 }
2283 #[no_mangle]
2284 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2285 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2286 impl Drop for CResult_RouteHintDecodeErrorZ {
2287         fn drop(&mut self) {
2288                 if self.result_ok {
2289                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2290                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2291                         }
2292                 } else {
2293                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2294                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2295                         }
2296                 }
2297         }
2298 }
2299 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2300         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2301                 let contents = if o.result_ok {
2302                         let result = unsafe { o.contents.result };
2303                         unsafe { o.contents.result = std::ptr::null_mut() };
2304                         CResult_RouteHintDecodeErrorZPtr { result }
2305                 } else {
2306                         let err = unsafe { o.contents.err };
2307                         unsafe { o.contents.err = std::ptr::null_mut(); }
2308                         CResult_RouteHintDecodeErrorZPtr { err }
2309                 };
2310                 Self {
2311                         contents,
2312                         result_ok: o.result_ok,
2313                 }
2314         }
2315 }
2316 impl Clone for CResult_RouteHintDecodeErrorZ {
2317         fn clone(&self) -> Self {
2318                 if self.result_ok {
2319                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2320                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2321                         } }
2322                 } else {
2323                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2324                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2325                         } }
2326                 }
2327         }
2328 }
2329 #[no_mangle]
2330 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2331 /// but with all dynamically-allocated buffers duplicated in new buffers.
2332 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2333 #[repr(C)]
2334 /// The contents of CResult_RouteHintHopDecodeErrorZ
2335 pub union CResult_RouteHintHopDecodeErrorZPtr {
2336         /// A pointer to the contents in the success state.
2337         /// Reading from this pointer when `result_ok` is not set is undefined.
2338         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2339         /// A pointer to the contents in the error state.
2340         /// Reading from this pointer when `result_ok` is set is undefined.
2341         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2342 }
2343 #[repr(C)]
2344 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2345 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2347 pub struct CResult_RouteHintHopDecodeErrorZ {
2348         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2349         /// `err` or `result` depending on the state of `result_ok`.
2350         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2351         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2352         pub result_ok: bool,
2353 }
2354 #[no_mangle]
2355 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2356 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2357         CResult_RouteHintHopDecodeErrorZ {
2358                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2359                         result: Box::into_raw(Box::new(o)),
2360                 },
2361                 result_ok: true,
2362         }
2363 }
2364 #[no_mangle]
2365 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2366 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2367         CResult_RouteHintHopDecodeErrorZ {
2368                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2369                         err: Box::into_raw(Box::new(e)),
2370                 },
2371                 result_ok: false,
2372         }
2373 }
2374 /// Checks if the given object is currently in the success state
2375 #[no_mangle]
2376 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2377         o.result_ok
2378 }
2379 #[no_mangle]
2380 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2381 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2382 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2383         fn drop(&mut self) {
2384                 if self.result_ok {
2385                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2386                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2387                         }
2388                 } else {
2389                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2390                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2391                         }
2392                 }
2393         }
2394 }
2395 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2396         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2397                 let contents = if o.result_ok {
2398                         let result = unsafe { o.contents.result };
2399                         unsafe { o.contents.result = std::ptr::null_mut() };
2400                         CResult_RouteHintHopDecodeErrorZPtr { result }
2401                 } else {
2402                         let err = unsafe { o.contents.err };
2403                         unsafe { o.contents.err = std::ptr::null_mut(); }
2404                         CResult_RouteHintHopDecodeErrorZPtr { err }
2405                 };
2406                 Self {
2407                         contents,
2408                         result_ok: o.result_ok,
2409                 }
2410         }
2411 }
2412 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2413         fn clone(&self) -> Self {
2414                 if self.result_ok {
2415                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2416                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2417                         } }
2418                 } else {
2419                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2420                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2421                         } }
2422                 }
2423         }
2424 }
2425 #[no_mangle]
2426 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2427 /// but with all dynamically-allocated buffers duplicated in new buffers.
2428 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2429 #[repr(C)]
2430 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2431 /// This corresponds to std::vector in C++
2432 pub struct CVec_ChannelDetailsZ {
2433         /// The elements in the array.
2434         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2435         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2436         /// The number of elements pointed to by `data`.
2437         pub datalen: usize
2438 }
2439 impl CVec_ChannelDetailsZ {
2440         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2441                 if self.datalen == 0 { return Vec::new(); }
2442                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2443                 self.data = std::ptr::null_mut();
2444                 self.datalen = 0;
2445                 ret
2446         }
2447         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2448                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2449         }
2450 }
2451 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2452         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2453                 let datalen = v.len();
2454                 let data = Box::into_raw(v.into_boxed_slice());
2455                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2456         }
2457 }
2458 #[no_mangle]
2459 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2460 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2461 impl Drop for CVec_ChannelDetailsZ {
2462         fn drop(&mut self) {
2463                 if self.datalen == 0 { return; }
2464                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2465         }
2466 }
2467 impl Clone for CVec_ChannelDetailsZ {
2468         fn clone(&self) -> Self {
2469                 let mut res = Vec::new();
2470                 if self.datalen == 0 { return Self::from(res); }
2471                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2472                 Self::from(res)
2473         }
2474 }
2475 #[repr(C)]
2476 /// The contents of CResult_RouteLightningErrorZ
2477 pub union CResult_RouteLightningErrorZPtr {
2478         /// A pointer to the contents in the success state.
2479         /// Reading from this pointer when `result_ok` is not set is undefined.
2480         pub result: *mut crate::lightning::routing::router::Route,
2481         /// A pointer to the contents in the error state.
2482         /// Reading from this pointer when `result_ok` is set is undefined.
2483         pub err: *mut crate::lightning::ln::msgs::LightningError,
2484 }
2485 #[repr(C)]
2486 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2487 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2488 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2489 pub struct CResult_RouteLightningErrorZ {
2490         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2491         /// `err` or `result` depending on the state of `result_ok`.
2492         pub contents: CResult_RouteLightningErrorZPtr,
2493         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2494         pub result_ok: bool,
2495 }
2496 #[no_mangle]
2497 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2498 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2499         CResult_RouteLightningErrorZ {
2500                 contents: CResult_RouteLightningErrorZPtr {
2501                         result: Box::into_raw(Box::new(o)),
2502                 },
2503                 result_ok: true,
2504         }
2505 }
2506 #[no_mangle]
2507 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2508 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2509         CResult_RouteLightningErrorZ {
2510                 contents: CResult_RouteLightningErrorZPtr {
2511                         err: Box::into_raw(Box::new(e)),
2512                 },
2513                 result_ok: false,
2514         }
2515 }
2516 /// Checks if the given object is currently in the success state
2517 #[no_mangle]
2518 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2519         o.result_ok
2520 }
2521 #[no_mangle]
2522 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2523 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2524 impl Drop for CResult_RouteLightningErrorZ {
2525         fn drop(&mut self) {
2526                 if self.result_ok {
2527                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2528                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2529                         }
2530                 } else {
2531                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2532                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2533                         }
2534                 }
2535         }
2536 }
2537 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2538         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2539                 let contents = if o.result_ok {
2540                         let result = unsafe { o.contents.result };
2541                         unsafe { o.contents.result = std::ptr::null_mut() };
2542                         CResult_RouteLightningErrorZPtr { result }
2543                 } else {
2544                         let err = unsafe { o.contents.err };
2545                         unsafe { o.contents.err = std::ptr::null_mut(); }
2546                         CResult_RouteLightningErrorZPtr { err }
2547                 };
2548                 Self {
2549                         contents,
2550                         result_ok: o.result_ok,
2551                 }
2552         }
2553 }
2554 impl Clone for CResult_RouteLightningErrorZ {
2555         fn clone(&self) -> Self {
2556                 if self.result_ok {
2557                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2558                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2559                         } }
2560                 } else {
2561                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2562                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2563                         } }
2564                 }
2565         }
2566 }
2567 #[no_mangle]
2568 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2569 /// but with all dynamically-allocated buffers duplicated in new buffers.
2570 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2571 #[repr(C)]
2572 /// The contents of CResult_TxOutAccessErrorZ
2573 pub union CResult_TxOutAccessErrorZPtr {
2574         /// A pointer to the contents in the success state.
2575         /// Reading from this pointer when `result_ok` is not set is undefined.
2576         pub result: *mut crate::c_types::TxOut,
2577         /// A pointer to the contents in the error state.
2578         /// Reading from this pointer when `result_ok` is set is undefined.
2579         pub err: *mut crate::lightning::chain::AccessError,
2580 }
2581 #[repr(C)]
2582 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2583 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2585 pub struct CResult_TxOutAccessErrorZ {
2586         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2587         /// `err` or `result` depending on the state of `result_ok`.
2588         pub contents: CResult_TxOutAccessErrorZPtr,
2589         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2590         pub result_ok: bool,
2591 }
2592 #[no_mangle]
2593 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2594 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2595         CResult_TxOutAccessErrorZ {
2596                 contents: CResult_TxOutAccessErrorZPtr {
2597                         result: Box::into_raw(Box::new(o)),
2598                 },
2599                 result_ok: true,
2600         }
2601 }
2602 #[no_mangle]
2603 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2604 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2605         CResult_TxOutAccessErrorZ {
2606                 contents: CResult_TxOutAccessErrorZPtr {
2607                         err: Box::into_raw(Box::new(e)),
2608                 },
2609                 result_ok: false,
2610         }
2611 }
2612 /// Checks if the given object is currently in the success state
2613 #[no_mangle]
2614 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2615         o.result_ok
2616 }
2617 #[no_mangle]
2618 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2619 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2620 impl Drop for CResult_TxOutAccessErrorZ {
2621         fn drop(&mut self) {
2622                 if self.result_ok {
2623                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2624                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2625                         }
2626                 } else {
2627                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2628                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2629                         }
2630                 }
2631         }
2632 }
2633 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2634         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2635                 let contents = if o.result_ok {
2636                         let result = unsafe { o.contents.result };
2637                         unsafe { o.contents.result = std::ptr::null_mut() };
2638                         CResult_TxOutAccessErrorZPtr { result }
2639                 } else {
2640                         let err = unsafe { o.contents.err };
2641                         unsafe { o.contents.err = std::ptr::null_mut(); }
2642                         CResult_TxOutAccessErrorZPtr { err }
2643                 };
2644                 Self {
2645                         contents,
2646                         result_ok: o.result_ok,
2647                 }
2648         }
2649 }
2650 impl Clone for CResult_TxOutAccessErrorZ {
2651         fn clone(&self) -> Self {
2652                 if self.result_ok {
2653                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2654                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2655                         } }
2656                 } else {
2657                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2658                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2659                         } }
2660                 }
2661         }
2662 }
2663 #[no_mangle]
2664 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2665 /// but with all dynamically-allocated buffers duplicated in new buffers.
2666 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2667 #[repr(C)]
2668 /// A tuple of 2 elements. See the individual fields for the types contained.
2669 pub struct C2Tuple_usizeTransactionZ {
2670         /// The element at position 0
2671         pub a: usize,
2672         /// The element at position 1
2673         pub b: crate::c_types::Transaction,
2674 }
2675 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2676         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2677                 Self {
2678                         a: tup.0,
2679                         b: tup.1,
2680                 }
2681         }
2682 }
2683 impl C2Tuple_usizeTransactionZ {
2684         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2685                 (self.a, self.b)
2686         }
2687 }
2688 impl Clone for C2Tuple_usizeTransactionZ {
2689         fn clone(&self) -> Self {
2690                 Self {
2691                         a: Clone::clone(&self.a),
2692                         b: Clone::clone(&self.b),
2693                 }
2694         }
2695 }
2696 #[no_mangle]
2697 /// Creates a new tuple which has the same data as `orig`
2698 /// but with all dynamically-allocated buffers duplicated in new buffers.
2699 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2700 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2701 #[no_mangle]
2702 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2703         C2Tuple_usizeTransactionZ { a, b, }
2704 }
2705
2706 #[no_mangle]
2707 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2708 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2709 #[repr(C)]
2710 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2711 /// This corresponds to std::vector in C++
2712 pub struct CVec_C2Tuple_usizeTransactionZZ {
2713         /// The elements in the array.
2714         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2715         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2716         /// The number of elements pointed to by `data`.
2717         pub datalen: usize
2718 }
2719 impl CVec_C2Tuple_usizeTransactionZZ {
2720         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2721                 if self.datalen == 0 { return Vec::new(); }
2722                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2723                 self.data = std::ptr::null_mut();
2724                 self.datalen = 0;
2725                 ret
2726         }
2727         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2728                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2729         }
2730 }
2731 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2732         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2733                 let datalen = v.len();
2734                 let data = Box::into_raw(v.into_boxed_slice());
2735                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2736         }
2737 }
2738 #[no_mangle]
2739 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2740 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2741 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2742         fn drop(&mut self) {
2743                 if self.datalen == 0 { return; }
2744                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2745         }
2746 }
2747 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2748         fn clone(&self) -> Self {
2749                 let mut res = Vec::new();
2750                 if self.datalen == 0 { return Self::from(res); }
2751                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2752                 Self::from(res)
2753         }
2754 }
2755 #[repr(C)]
2756 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2757 /// This corresponds to std::vector in C++
2758 pub struct CVec_TxidZ {
2759         /// The elements in the array.
2760         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2761         pub data: *mut crate::c_types::ThirtyTwoBytes,
2762         /// The number of elements pointed to by `data`.
2763         pub datalen: usize
2764 }
2765 impl CVec_TxidZ {
2766         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2767                 if self.datalen == 0 { return Vec::new(); }
2768                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2769                 self.data = std::ptr::null_mut();
2770                 self.datalen = 0;
2771                 ret
2772         }
2773         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2774                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2775         }
2776 }
2777 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2778         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2779                 let datalen = v.len();
2780                 let data = Box::into_raw(v.into_boxed_slice());
2781                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2782         }
2783 }
2784 #[no_mangle]
2785 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2786 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2787 impl Drop for CVec_TxidZ {
2788         fn drop(&mut self) {
2789                 if self.datalen == 0 { return; }
2790                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2791         }
2792 }
2793 impl Clone for CVec_TxidZ {
2794         fn clone(&self) -> Self {
2795                 let mut res = Vec::new();
2796                 if self.datalen == 0 { return Self::from(res); }
2797                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2798                 Self::from(res)
2799         }
2800 }
2801 #[repr(C)]
2802 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2803 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2804         /// Note that this value is always NULL, as there are no contents in the OK variant
2805         pub result: *mut std::ffi::c_void,
2806         /// A pointer to the contents in the error state.
2807         /// Reading from this pointer when `result_ok` is set is undefined.
2808         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2809 }
2810 #[repr(C)]
2811 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2812 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2814 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2815         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2816         /// `err` or `result` depending on the state of `result_ok`.
2817         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2818         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2819         pub result_ok: bool,
2820 }
2821 #[no_mangle]
2822 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2823 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2824         CResult_NoneChannelMonitorUpdateErrZ {
2825                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2826                         result: std::ptr::null_mut(),
2827                 },
2828                 result_ok: true,
2829         }
2830 }
2831 #[no_mangle]
2832 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2833 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2834         CResult_NoneChannelMonitorUpdateErrZ {
2835                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2836                         err: Box::into_raw(Box::new(e)),
2837                 },
2838                 result_ok: false,
2839         }
2840 }
2841 /// Checks if the given object is currently in the success state
2842 #[no_mangle]
2843 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
2844         o.result_ok
2845 }
2846 #[no_mangle]
2847 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2848 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2849 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2850         fn drop(&mut self) {
2851                 if self.result_ok {
2852                 } else {
2853                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2854                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2855                         }
2856                 }
2857         }
2858 }
2859 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2860         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2861                 let contents = if o.result_ok {
2862                         let _ = unsafe { Box::from_raw(o.contents.result) };
2863                         o.contents.result = std::ptr::null_mut();
2864                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2865                 } else {
2866                         let err = unsafe { o.contents.err };
2867                         unsafe { o.contents.err = std::ptr::null_mut(); }
2868                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2869                 };
2870                 Self {
2871                         contents,
2872                         result_ok: o.result_ok,
2873                 }
2874         }
2875 }
2876 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2877         fn clone(&self) -> Self {
2878                 if self.result_ok {
2879                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2880                                 result: std::ptr::null_mut()
2881                         } }
2882                 } else {
2883                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2884                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2885                         } }
2886                 }
2887         }
2888 }
2889 #[no_mangle]
2890 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2891 /// but with all dynamically-allocated buffers duplicated in new buffers.
2892 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2893 #[repr(C)]
2894 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2895 /// This corresponds to std::vector in C++
2896 pub struct CVec_MonitorEventZ {
2897         /// The elements in the array.
2898         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2899         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2900         /// The number of elements pointed to by `data`.
2901         pub datalen: usize
2902 }
2903 impl CVec_MonitorEventZ {
2904         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2905                 if self.datalen == 0 { return Vec::new(); }
2906                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2907                 self.data = std::ptr::null_mut();
2908                 self.datalen = 0;
2909                 ret
2910         }
2911         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2912                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2913         }
2914 }
2915 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2916         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2917                 let datalen = v.len();
2918                 let data = Box::into_raw(v.into_boxed_slice());
2919                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2920         }
2921 }
2922 #[no_mangle]
2923 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2924 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2925 impl Drop for CVec_MonitorEventZ {
2926         fn drop(&mut self) {
2927                 if self.datalen == 0 { return; }
2928                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2929         }
2930 }
2931 impl Clone for CVec_MonitorEventZ {
2932         fn clone(&self) -> Self {
2933                 let mut res = Vec::new();
2934                 if self.datalen == 0 { return Self::from(res); }
2935                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2936                 Self::from(res)
2937         }
2938 }
2939 #[repr(C)]
2940 #[derive(Clone)]
2941 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2942 pub enum COption_C2Tuple_usizeTransactionZZ {
2943         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2944         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2945         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2946         None
2947 }
2948 impl COption_C2Tuple_usizeTransactionZZ {
2949         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2950                 if let Self::Some(_) = self { true } else { false }
2951         }
2952         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2953                 !self.is_some()
2954         }
2955         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
2956                 if let Self::Some(v) = self { v } else { unreachable!() }
2957         }
2958 }
2959 #[no_mangle]
2960 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
2961 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
2962         COption_C2Tuple_usizeTransactionZZ::Some(o)
2963 }
2964 #[no_mangle]
2965 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
2966 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
2967         COption_C2Tuple_usizeTransactionZZ::None
2968 }
2969 #[no_mangle]
2970 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
2971 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
2972 #[no_mangle]
2973 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
2974 /// but with all dynamically-allocated buffers duplicated in new buffers.
2975 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
2976 #[repr(C)]
2977 #[derive(Clone)]
2978 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2979 pub enum COption_ClosureReasonZ {
2980         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2981         Some(crate::lightning::util::events::ClosureReason),
2982         /// When we're in this state, this COption_ClosureReasonZ contains nothing
2983         None
2984 }
2985 impl COption_ClosureReasonZ {
2986         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2987                 if let Self::Some(_) = self { true } else { false }
2988         }
2989         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2990                 !self.is_some()
2991         }
2992         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
2993                 if let Self::Some(v) = self { v } else { unreachable!() }
2994         }
2995 }
2996 #[no_mangle]
2997 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
2998 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
2999         COption_ClosureReasonZ::Some(o)
3000 }
3001 #[no_mangle]
3002 /// Constructs a new COption_ClosureReasonZ containing nothing
3003 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3004         COption_ClosureReasonZ::None
3005 }
3006 #[no_mangle]
3007 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3008 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3009 #[no_mangle]
3010 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3011 /// but with all dynamically-allocated buffers duplicated in new buffers.
3012 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3013 #[repr(C)]
3014 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3015 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3016         /// A pointer to the contents in the success state.
3017         /// Reading from this pointer when `result_ok` is not set is undefined.
3018         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3019         /// A pointer to the contents in the error state.
3020         /// Reading from this pointer when `result_ok` is set is undefined.
3021         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3022 }
3023 #[repr(C)]
3024 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3025 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3027 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3028         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3029         /// `err` or `result` depending on the state of `result_ok`.
3030         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3031         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3032         pub result_ok: bool,
3033 }
3034 #[no_mangle]
3035 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3036 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3037         CResult_COption_ClosureReasonZDecodeErrorZ {
3038                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3039                         result: Box::into_raw(Box::new(o)),
3040                 },
3041                 result_ok: true,
3042         }
3043 }
3044 #[no_mangle]
3045 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3046 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3047         CResult_COption_ClosureReasonZDecodeErrorZ {
3048                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3049                         err: Box::into_raw(Box::new(e)),
3050                 },
3051                 result_ok: false,
3052         }
3053 }
3054 /// Checks if the given object is currently in the success state
3055 #[no_mangle]
3056 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3057         o.result_ok
3058 }
3059 #[no_mangle]
3060 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3061 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3062 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3063         fn drop(&mut self) {
3064                 if self.result_ok {
3065                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3066                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3067                         }
3068                 } else {
3069                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3070                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3071                         }
3072                 }
3073         }
3074 }
3075 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3076         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3077                 let contents = if o.result_ok {
3078                         let result = unsafe { o.contents.result };
3079                         unsafe { o.contents.result = std::ptr::null_mut() };
3080                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3081                 } else {
3082                         let err = unsafe { o.contents.err };
3083                         unsafe { o.contents.err = std::ptr::null_mut(); }
3084                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3085                 };
3086                 Self {
3087                         contents,
3088                         result_ok: o.result_ok,
3089                 }
3090         }
3091 }
3092 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3093         fn clone(&self) -> Self {
3094                 if self.result_ok {
3095                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3096                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3097                         } }
3098                 } else {
3099                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3100                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3101                         } }
3102                 }
3103         }
3104 }
3105 #[no_mangle]
3106 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3107 /// but with all dynamically-allocated buffers duplicated in new buffers.
3108 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3109 #[repr(C)]
3110 #[derive(Clone)]
3111 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3112 pub enum COption_NetworkUpdateZ {
3113         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3114         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3115         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3116         None
3117 }
3118 impl COption_NetworkUpdateZ {
3119         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3120                 if let Self::Some(_) = self { true } else { false }
3121         }
3122         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3123                 !self.is_some()
3124         }
3125         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3126                 if let Self::Some(v) = self { v } else { unreachable!() }
3127         }
3128 }
3129 #[no_mangle]
3130 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3131 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3132         COption_NetworkUpdateZ::Some(o)
3133 }
3134 #[no_mangle]
3135 /// Constructs a new COption_NetworkUpdateZ containing nothing
3136 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3137         COption_NetworkUpdateZ::None
3138 }
3139 #[no_mangle]
3140 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3141 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3142 #[no_mangle]
3143 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3144 /// but with all dynamically-allocated buffers duplicated in new buffers.
3145 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3146 #[repr(C)]
3147 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3148 /// This corresponds to std::vector in C++
3149 pub struct CVec_SpendableOutputDescriptorZ {
3150         /// The elements in the array.
3151         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3152         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3153         /// The number of elements pointed to by `data`.
3154         pub datalen: usize
3155 }
3156 impl CVec_SpendableOutputDescriptorZ {
3157         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3158                 if self.datalen == 0 { return Vec::new(); }
3159                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3160                 self.data = std::ptr::null_mut();
3161                 self.datalen = 0;
3162                 ret
3163         }
3164         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3165                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3166         }
3167 }
3168 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3169         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3170                 let datalen = v.len();
3171                 let data = Box::into_raw(v.into_boxed_slice());
3172                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3173         }
3174 }
3175 #[no_mangle]
3176 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3177 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3178 impl Drop for CVec_SpendableOutputDescriptorZ {
3179         fn drop(&mut self) {
3180                 if self.datalen == 0 { return; }
3181                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3182         }
3183 }
3184 impl Clone for CVec_SpendableOutputDescriptorZ {
3185         fn clone(&self) -> Self {
3186                 let mut res = Vec::new();
3187                 if self.datalen == 0 { return Self::from(res); }
3188                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3189                 Self::from(res)
3190         }
3191 }
3192 #[repr(C)]
3193 #[derive(Clone)]
3194 /// An enum which can either contain a crate::lightning::util::events::Event or not
3195 pub enum COption_EventZ {
3196         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3197         Some(crate::lightning::util::events::Event),
3198         /// When we're in this state, this COption_EventZ contains nothing
3199         None
3200 }
3201 impl COption_EventZ {
3202         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3203                 if let Self::Some(_) = self { true } else { false }
3204         }
3205         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3206                 !self.is_some()
3207         }
3208         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3209                 if let Self::Some(v) = self { v } else { unreachable!() }
3210         }
3211 }
3212 #[no_mangle]
3213 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3214 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3215         COption_EventZ::Some(o)
3216 }
3217 #[no_mangle]
3218 /// Constructs a new COption_EventZ containing nothing
3219 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3220         COption_EventZ::None
3221 }
3222 #[no_mangle]
3223 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3224 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3225 #[no_mangle]
3226 /// Creates a new COption_EventZ which has the same data as `orig`
3227 /// but with all dynamically-allocated buffers duplicated in new buffers.
3228 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3229 #[repr(C)]
3230 /// The contents of CResult_COption_EventZDecodeErrorZ
3231 pub union CResult_COption_EventZDecodeErrorZPtr {
3232         /// A pointer to the contents in the success state.
3233         /// Reading from this pointer when `result_ok` is not set is undefined.
3234         pub result: *mut crate::c_types::derived::COption_EventZ,
3235         /// A pointer to the contents in the error state.
3236         /// Reading from this pointer when `result_ok` is set is undefined.
3237         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3238 }
3239 #[repr(C)]
3240 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3241 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3243 pub struct CResult_COption_EventZDecodeErrorZ {
3244         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3245         /// `err` or `result` depending on the state of `result_ok`.
3246         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3247         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3248         pub result_ok: bool,
3249 }
3250 #[no_mangle]
3251 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3252 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3253         CResult_COption_EventZDecodeErrorZ {
3254                 contents: CResult_COption_EventZDecodeErrorZPtr {
3255                         result: Box::into_raw(Box::new(o)),
3256                 },
3257                 result_ok: true,
3258         }
3259 }
3260 #[no_mangle]
3261 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3262 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3263         CResult_COption_EventZDecodeErrorZ {
3264                 contents: CResult_COption_EventZDecodeErrorZPtr {
3265                         err: Box::into_raw(Box::new(e)),
3266                 },
3267                 result_ok: false,
3268         }
3269 }
3270 /// Checks if the given object is currently in the success state
3271 #[no_mangle]
3272 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3273         o.result_ok
3274 }
3275 #[no_mangle]
3276 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3277 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3278 impl Drop for CResult_COption_EventZDecodeErrorZ {
3279         fn drop(&mut self) {
3280                 if self.result_ok {
3281                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3282                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3283                         }
3284                 } else {
3285                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3286                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3287                         }
3288                 }
3289         }
3290 }
3291 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3292         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3293                 let contents = if o.result_ok {
3294                         let result = unsafe { o.contents.result };
3295                         unsafe { o.contents.result = std::ptr::null_mut() };
3296                         CResult_COption_EventZDecodeErrorZPtr { result }
3297                 } else {
3298                         let err = unsafe { o.contents.err };
3299                         unsafe { o.contents.err = std::ptr::null_mut(); }
3300                         CResult_COption_EventZDecodeErrorZPtr { err }
3301                 };
3302                 Self {
3303                         contents,
3304                         result_ok: o.result_ok,
3305                 }
3306         }
3307 }
3308 impl Clone for CResult_COption_EventZDecodeErrorZ {
3309         fn clone(&self) -> Self {
3310                 if self.result_ok {
3311                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3312                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3313                         } }
3314                 } else {
3315                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3316                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3317                         } }
3318                 }
3319         }
3320 }
3321 #[no_mangle]
3322 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3323 /// but with all dynamically-allocated buffers duplicated in new buffers.
3324 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3325 #[repr(C)]
3326 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3327 /// This corresponds to std::vector in C++
3328 pub struct CVec_MessageSendEventZ {
3329         /// The elements in the array.
3330         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3331         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3332         /// The number of elements pointed to by `data`.
3333         pub datalen: usize
3334 }
3335 impl CVec_MessageSendEventZ {
3336         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3337                 if self.datalen == 0 { return Vec::new(); }
3338                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3339                 self.data = std::ptr::null_mut();
3340                 self.datalen = 0;
3341                 ret
3342         }
3343         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3344                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3345         }
3346 }
3347 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3348         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3349                 let datalen = v.len();
3350                 let data = Box::into_raw(v.into_boxed_slice());
3351                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3352         }
3353 }
3354 #[no_mangle]
3355 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3356 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3357 impl Drop for CVec_MessageSendEventZ {
3358         fn drop(&mut self) {
3359                 if self.datalen == 0 { return; }
3360                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3361         }
3362 }
3363 impl Clone for CVec_MessageSendEventZ {
3364         fn clone(&self) -> Self {
3365                 let mut res = Vec::new();
3366                 if self.datalen == 0 { return Self::from(res); }
3367                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3368                 Self::from(res)
3369         }
3370 }
3371 #[repr(C)]
3372 /// The contents of CResult_InitFeaturesDecodeErrorZ
3373 pub union CResult_InitFeaturesDecodeErrorZPtr {
3374         /// A pointer to the contents in the success state.
3375         /// Reading from this pointer when `result_ok` is not set is undefined.
3376         pub result: *mut crate::lightning::ln::features::InitFeatures,
3377         /// A pointer to the contents in the error state.
3378         /// Reading from this pointer when `result_ok` is set is undefined.
3379         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3380 }
3381 #[repr(C)]
3382 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3383 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3385 pub struct CResult_InitFeaturesDecodeErrorZ {
3386         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3387         /// `err` or `result` depending on the state of `result_ok`.
3388         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3389         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3390         pub result_ok: bool,
3391 }
3392 #[no_mangle]
3393 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3394 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3395         CResult_InitFeaturesDecodeErrorZ {
3396                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3397                         result: Box::into_raw(Box::new(o)),
3398                 },
3399                 result_ok: true,
3400         }
3401 }
3402 #[no_mangle]
3403 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3404 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3405         CResult_InitFeaturesDecodeErrorZ {
3406                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3407                         err: Box::into_raw(Box::new(e)),
3408                 },
3409                 result_ok: false,
3410         }
3411 }
3412 /// Checks if the given object is currently in the success state
3413 #[no_mangle]
3414 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3415         o.result_ok
3416 }
3417 #[no_mangle]
3418 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3419 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3420 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3421         fn drop(&mut self) {
3422                 if self.result_ok {
3423                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3424                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3425                         }
3426                 } else {
3427                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3428                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3429                         }
3430                 }
3431         }
3432 }
3433 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3434         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3435                 let contents = if o.result_ok {
3436                         let result = unsafe { o.contents.result };
3437                         unsafe { o.contents.result = std::ptr::null_mut() };
3438                         CResult_InitFeaturesDecodeErrorZPtr { result }
3439                 } else {
3440                         let err = unsafe { o.contents.err };
3441                         unsafe { o.contents.err = std::ptr::null_mut(); }
3442                         CResult_InitFeaturesDecodeErrorZPtr { err }
3443                 };
3444                 Self {
3445                         contents,
3446                         result_ok: o.result_ok,
3447                 }
3448         }
3449 }
3450 #[repr(C)]
3451 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3452 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3453         /// A pointer to the contents in the success state.
3454         /// Reading from this pointer when `result_ok` is not set is undefined.
3455         pub result: *mut crate::lightning::ln::features::NodeFeatures,
3456         /// A pointer to the contents in the error state.
3457         /// Reading from this pointer when `result_ok` is set is undefined.
3458         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3459 }
3460 #[repr(C)]
3461 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3462 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3463 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3464 pub struct CResult_NodeFeaturesDecodeErrorZ {
3465         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3466         /// `err` or `result` depending on the state of `result_ok`.
3467         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3468         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3469         pub result_ok: bool,
3470 }
3471 #[no_mangle]
3472 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3473 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3474         CResult_NodeFeaturesDecodeErrorZ {
3475                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3476                         result: Box::into_raw(Box::new(o)),
3477                 },
3478                 result_ok: true,
3479         }
3480 }
3481 #[no_mangle]
3482 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3483 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3484         CResult_NodeFeaturesDecodeErrorZ {
3485                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3486                         err: Box::into_raw(Box::new(e)),
3487                 },
3488                 result_ok: false,
3489         }
3490 }
3491 /// Checks if the given object is currently in the success state
3492 #[no_mangle]
3493 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
3494         o.result_ok
3495 }
3496 #[no_mangle]
3497 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3498 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3499 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3500         fn drop(&mut self) {
3501                 if self.result_ok {
3502                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3503                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3504                         }
3505                 } else {
3506                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3507                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3508                         }
3509                 }
3510         }
3511 }
3512 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3513         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3514                 let contents = if o.result_ok {
3515                         let result = unsafe { o.contents.result };
3516                         unsafe { o.contents.result = std::ptr::null_mut() };
3517                         CResult_NodeFeaturesDecodeErrorZPtr { result }
3518                 } else {
3519                         let err = unsafe { o.contents.err };
3520                         unsafe { o.contents.err = std::ptr::null_mut(); }
3521                         CResult_NodeFeaturesDecodeErrorZPtr { err }
3522                 };
3523                 Self {
3524                         contents,
3525                         result_ok: o.result_ok,
3526                 }
3527         }
3528 }
3529 #[repr(C)]
3530 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3531 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3532         /// A pointer to the contents in the success state.
3533         /// Reading from this pointer when `result_ok` is not set is undefined.
3534         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3535         /// A pointer to the contents in the error state.
3536         /// Reading from this pointer when `result_ok` is set is undefined.
3537         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3538 }
3539 #[repr(C)]
3540 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3541 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3543 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3544         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3545         /// `err` or `result` depending on the state of `result_ok`.
3546         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3547         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3548         pub result_ok: bool,
3549 }
3550 #[no_mangle]
3551 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3552 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3553         CResult_ChannelFeaturesDecodeErrorZ {
3554                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3555                         result: Box::into_raw(Box::new(o)),
3556                 },
3557                 result_ok: true,
3558         }
3559 }
3560 #[no_mangle]
3561 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3562 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3563         CResult_ChannelFeaturesDecodeErrorZ {
3564                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3565                         err: Box::into_raw(Box::new(e)),
3566                 },
3567                 result_ok: false,
3568         }
3569 }
3570 /// Checks if the given object is currently in the success state
3571 #[no_mangle]
3572 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
3573         o.result_ok
3574 }
3575 #[no_mangle]
3576 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3577 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3578 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3579         fn drop(&mut self) {
3580                 if self.result_ok {
3581                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3582                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3583                         }
3584                 } else {
3585                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3586                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3587                         }
3588                 }
3589         }
3590 }
3591 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3592         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3593                 let contents = if o.result_ok {
3594                         let result = unsafe { o.contents.result };
3595                         unsafe { o.contents.result = std::ptr::null_mut() };
3596                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
3597                 } else {
3598                         let err = unsafe { o.contents.err };
3599                         unsafe { o.contents.err = std::ptr::null_mut(); }
3600                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
3601                 };
3602                 Self {
3603                         contents,
3604                         result_ok: o.result_ok,
3605                 }
3606         }
3607 }
3608 #[repr(C)]
3609 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3610 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3611         /// A pointer to the contents in the success state.
3612         /// Reading from this pointer when `result_ok` is not set is undefined.
3613         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3614         /// A pointer to the contents in the error state.
3615         /// Reading from this pointer when `result_ok` is set is undefined.
3616         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3617 }
3618 #[repr(C)]
3619 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3620 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3622 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3623         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3624         /// `err` or `result` depending on the state of `result_ok`.
3625         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3626         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3627         pub result_ok: bool,
3628 }
3629 #[no_mangle]
3630 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3631 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3632         CResult_InvoiceFeaturesDecodeErrorZ {
3633                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3634                         result: Box::into_raw(Box::new(o)),
3635                 },
3636                 result_ok: true,
3637         }
3638 }
3639 #[no_mangle]
3640 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3641 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3642         CResult_InvoiceFeaturesDecodeErrorZ {
3643                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3644                         err: Box::into_raw(Box::new(e)),
3645                 },
3646                 result_ok: false,
3647         }
3648 }
3649 /// Checks if the given object is currently in the success state
3650 #[no_mangle]
3651 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
3652         o.result_ok
3653 }
3654 #[no_mangle]
3655 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3656 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3657 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3658         fn drop(&mut self) {
3659                 if self.result_ok {
3660                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3661                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3662                         }
3663                 } else {
3664                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3665                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3666                         }
3667                 }
3668         }
3669 }
3670 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3671         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3672                 let contents = if o.result_ok {
3673                         let result = unsafe { o.contents.result };
3674                         unsafe { o.contents.result = std::ptr::null_mut() };
3675                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3676                 } else {
3677                         let err = unsafe { o.contents.err };
3678                         unsafe { o.contents.err = std::ptr::null_mut(); }
3679                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3680                 };
3681                 Self {
3682                         contents,
3683                         result_ok: o.result_ok,
3684                 }
3685         }
3686 }
3687 #[repr(C)]
3688 /// The contents of CResult_ScoringParametersDecodeErrorZ
3689 pub union CResult_ScoringParametersDecodeErrorZPtr {
3690         /// A pointer to the contents in the success state.
3691         /// Reading from this pointer when `result_ok` is not set is undefined.
3692         pub result: *mut crate::lightning::routing::scorer::ScoringParameters,
3693         /// A pointer to the contents in the error state.
3694         /// Reading from this pointer when `result_ok` is set is undefined.
3695         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3696 }
3697 #[repr(C)]
3698 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3699 /// containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3701 pub struct CResult_ScoringParametersDecodeErrorZ {
3702         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3703         /// `err` or `result` depending on the state of `result_ok`.
3704         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3705         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3706         pub result_ok: bool,
3707 }
3708 #[no_mangle]
3709 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3710 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scorer::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3711         CResult_ScoringParametersDecodeErrorZ {
3712                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3713                         result: Box::into_raw(Box::new(o)),
3714                 },
3715                 result_ok: true,
3716         }
3717 }
3718 #[no_mangle]
3719 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3720 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3721         CResult_ScoringParametersDecodeErrorZ {
3722                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3723                         err: Box::into_raw(Box::new(e)),
3724                 },
3725                 result_ok: false,
3726         }
3727 }
3728 /// Checks if the given object is currently in the success state
3729 #[no_mangle]
3730 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3731         o.result_ok
3732 }
3733 #[no_mangle]
3734 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3735 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3736 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3737         fn drop(&mut self) {
3738                 if self.result_ok {
3739                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3740                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3741                         }
3742                 } else {
3743                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3744                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3745                         }
3746                 }
3747         }
3748 }
3749 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3750         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3751                 let contents = if o.result_ok {
3752                         let result = unsafe { o.contents.result };
3753                         unsafe { o.contents.result = std::ptr::null_mut() };
3754                         CResult_ScoringParametersDecodeErrorZPtr { result }
3755                 } else {
3756                         let err = unsafe { o.contents.err };
3757                         unsafe { o.contents.err = std::ptr::null_mut(); }
3758                         CResult_ScoringParametersDecodeErrorZPtr { err }
3759                 };
3760                 Self {
3761                         contents,
3762                         result_ok: o.result_ok,
3763                 }
3764         }
3765 }
3766 #[repr(C)]
3767 /// The contents of CResult_ScorerDecodeErrorZ
3768 pub union CResult_ScorerDecodeErrorZPtr {
3769         /// A pointer to the contents in the success state.
3770         /// Reading from this pointer when `result_ok` is not set is undefined.
3771         pub result: *mut crate::lightning::routing::scorer::Scorer,
3772         /// A pointer to the contents in the error state.
3773         /// Reading from this pointer when `result_ok` is set is undefined.
3774         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3775 }
3776 #[repr(C)]
3777 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3778 /// containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3780 pub struct CResult_ScorerDecodeErrorZ {
3781         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3782         /// `err` or `result` depending on the state of `result_ok`.
3783         pub contents: CResult_ScorerDecodeErrorZPtr,
3784         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3785         pub result_ok: bool,
3786 }
3787 #[no_mangle]
3788 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3789 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scorer::Scorer) -> CResult_ScorerDecodeErrorZ {
3790         CResult_ScorerDecodeErrorZ {
3791                 contents: CResult_ScorerDecodeErrorZPtr {
3792                         result: Box::into_raw(Box::new(o)),
3793                 },
3794                 result_ok: true,
3795         }
3796 }
3797 #[no_mangle]
3798 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3799 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3800         CResult_ScorerDecodeErrorZ {
3801                 contents: CResult_ScorerDecodeErrorZPtr {
3802                         err: Box::into_raw(Box::new(e)),
3803                 },
3804                 result_ok: false,
3805         }
3806 }
3807 /// Checks if the given object is currently in the success state
3808 #[no_mangle]
3809 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3810         o.result_ok
3811 }
3812 #[no_mangle]
3813 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3814 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3815 impl Drop for CResult_ScorerDecodeErrorZ {
3816         fn drop(&mut self) {
3817                 if self.result_ok {
3818                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3819                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3820                         }
3821                 } else {
3822                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3823                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3824                         }
3825                 }
3826         }
3827 }
3828 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3829         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3830                 let contents = if o.result_ok {
3831                         let result = unsafe { o.contents.result };
3832                         unsafe { o.contents.result = std::ptr::null_mut() };
3833                         CResult_ScorerDecodeErrorZPtr { result }
3834                 } else {
3835                         let err = unsafe { o.contents.err };
3836                         unsafe { o.contents.err = std::ptr::null_mut(); }
3837                         CResult_ScorerDecodeErrorZPtr { err }
3838                 };
3839                 Self {
3840                         contents,
3841                         result_ok: o.result_ok,
3842                 }
3843         }
3844 }
3845 #[repr(C)]
3846 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3847 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3848         /// A pointer to the contents in the success state.
3849         /// Reading from this pointer when `result_ok` is not set is undefined.
3850         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3851         /// A pointer to the contents in the error state.
3852         /// Reading from this pointer when `result_ok` is set is undefined.
3853         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3854 }
3855 #[repr(C)]
3856 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3857 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3859 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3860         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3861         /// `err` or `result` depending on the state of `result_ok`.
3862         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3863         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3864         pub result_ok: bool,
3865 }
3866 #[no_mangle]
3867 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3868 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3869         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3870                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3871                         result: Box::into_raw(Box::new(o)),
3872                 },
3873                 result_ok: true,
3874         }
3875 }
3876 #[no_mangle]
3877 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
3878 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3879         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3880                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3881                         err: Box::into_raw(Box::new(e)),
3882                 },
3883                 result_ok: false,
3884         }
3885 }
3886 /// Checks if the given object is currently in the success state
3887 #[no_mangle]
3888 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
3889         o.result_ok
3890 }
3891 #[no_mangle]
3892 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
3893 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
3894 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3895         fn drop(&mut self) {
3896                 if self.result_ok {
3897                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3898                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3899                         }
3900                 } else {
3901                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3902                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3903                         }
3904                 }
3905         }
3906 }
3907 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3908         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
3909                 let contents = if o.result_ok {
3910                         let result = unsafe { o.contents.result };
3911                         unsafe { o.contents.result = std::ptr::null_mut() };
3912                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
3913                 } else {
3914                         let err = unsafe { o.contents.err };
3915                         unsafe { o.contents.err = std::ptr::null_mut(); }
3916                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
3917                 };
3918                 Self {
3919                         contents,
3920                         result_ok: o.result_ok,
3921                 }
3922         }
3923 }
3924 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3925         fn clone(&self) -> Self {
3926                 if self.result_ok {
3927                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3928                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3929                         } }
3930                 } else {
3931                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3932                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3933                         } }
3934                 }
3935         }
3936 }
3937 #[no_mangle]
3938 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
3939 /// but with all dynamically-allocated buffers duplicated in new buffers.
3940 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
3941 #[repr(C)]
3942 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3943 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3944         /// A pointer to the contents in the success state.
3945         /// Reading from this pointer when `result_ok` is not set is undefined.
3946         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
3947         /// A pointer to the contents in the error state.
3948         /// Reading from this pointer when `result_ok` is set is undefined.
3949         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3950 }
3951 #[repr(C)]
3952 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3953 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3955 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3956         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3957         /// `err` or `result` depending on the state of `result_ok`.
3958         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
3959         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3960         pub result_ok: bool,
3961 }
3962 #[no_mangle]
3963 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
3964 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3965         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3966                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3967                         result: Box::into_raw(Box::new(o)),
3968                 },
3969                 result_ok: true,
3970         }
3971 }
3972 #[no_mangle]
3973 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
3974 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3975         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3976                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3977                         err: Box::into_raw(Box::new(e)),
3978                 },
3979                 result_ok: false,
3980         }
3981 }
3982 /// Checks if the given object is currently in the success state
3983 #[no_mangle]
3984 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
3985         o.result_ok
3986 }
3987 #[no_mangle]
3988 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
3989 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
3990 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3991         fn drop(&mut self) {
3992                 if self.result_ok {
3993                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3994                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3995                         }
3996                 } else {
3997                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3998                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3999                         }
4000                 }
4001         }
4002 }
4003 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4004         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4005                 let contents = if o.result_ok {
4006                         let result = unsafe { o.contents.result };
4007                         unsafe { o.contents.result = std::ptr::null_mut() };
4008                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4009                 } else {
4010                         let err = unsafe { o.contents.err };
4011                         unsafe { o.contents.err = std::ptr::null_mut(); }
4012                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4013                 };
4014                 Self {
4015                         contents,
4016                         result_ok: o.result_ok,
4017                 }
4018         }
4019 }
4020 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4021         fn clone(&self) -> Self {
4022                 if self.result_ok {
4023                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4024                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4025                         } }
4026                 } else {
4027                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4028                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4029                         } }
4030                 }
4031         }
4032 }
4033 #[no_mangle]
4034 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4035 /// but with all dynamically-allocated buffers duplicated in new buffers.
4036 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4037 #[repr(C)]
4038 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4039 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4040         /// A pointer to the contents in the success state.
4041         /// Reading from this pointer when `result_ok` is not set is undefined.
4042         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4043         /// A pointer to the contents in the error state.
4044         /// Reading from this pointer when `result_ok` is set is undefined.
4045         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4046 }
4047 #[repr(C)]
4048 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4049 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4051 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4052         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4053         /// `err` or `result` depending on the state of `result_ok`.
4054         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4055         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4056         pub result_ok: bool,
4057 }
4058 #[no_mangle]
4059 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4060 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4061         CResult_SpendableOutputDescriptorDecodeErrorZ {
4062                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4063                         result: Box::into_raw(Box::new(o)),
4064                 },
4065                 result_ok: true,
4066         }
4067 }
4068 #[no_mangle]
4069 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4070 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4071         CResult_SpendableOutputDescriptorDecodeErrorZ {
4072                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4073                         err: Box::into_raw(Box::new(e)),
4074                 },
4075                 result_ok: false,
4076         }
4077 }
4078 /// Checks if the given object is currently in the success state
4079 #[no_mangle]
4080 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4081         o.result_ok
4082 }
4083 #[no_mangle]
4084 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4085 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4086 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4087         fn drop(&mut self) {
4088                 if self.result_ok {
4089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4091                         }
4092                 } else {
4093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4095                         }
4096                 }
4097         }
4098 }
4099 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4100         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4101                 let contents = if o.result_ok {
4102                         let result = unsafe { o.contents.result };
4103                         unsafe { o.contents.result = std::ptr::null_mut() };
4104                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4105                 } else {
4106                         let err = unsafe { o.contents.err };
4107                         unsafe { o.contents.err = std::ptr::null_mut(); }
4108                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4109                 };
4110                 Self {
4111                         contents,
4112                         result_ok: o.result_ok,
4113                 }
4114         }
4115 }
4116 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4117         fn clone(&self) -> Self {
4118                 if self.result_ok {
4119                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4120                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4121                         } }
4122                 } else {
4123                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4124                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4125                         } }
4126                 }
4127         }
4128 }
4129 #[no_mangle]
4130 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4131 /// but with all dynamically-allocated buffers duplicated in new buffers.
4132 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4133 #[repr(C)]
4134 /// The contents of CResult_NoneNoneZ
4135 pub union CResult_NoneNoneZPtr {
4136         /// Note that this value is always NULL, as there are no contents in the OK variant
4137         pub result: *mut std::ffi::c_void,
4138         /// Note that this value is always NULL, as there are no contents in the Err variant
4139         pub err: *mut std::ffi::c_void,
4140 }
4141 #[repr(C)]
4142 /// A CResult_NoneNoneZ represents the result of a fallible operation,
4143 /// containing a () on success and a () on failure.
4144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4145 pub struct CResult_NoneNoneZ {
4146         /// The contents of this CResult_NoneNoneZ, accessible via either
4147         /// `err` or `result` depending on the state of `result_ok`.
4148         pub contents: CResult_NoneNoneZPtr,
4149         /// Whether this CResult_NoneNoneZ represents a success state.
4150         pub result_ok: bool,
4151 }
4152 #[no_mangle]
4153 /// Creates a new CResult_NoneNoneZ in the success state.
4154 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
4155         CResult_NoneNoneZ {
4156                 contents: CResult_NoneNoneZPtr {
4157                         result: std::ptr::null_mut(),
4158                 },
4159                 result_ok: true,
4160         }
4161 }
4162 #[no_mangle]
4163 /// Creates a new CResult_NoneNoneZ in the error state.
4164 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
4165         CResult_NoneNoneZ {
4166                 contents: CResult_NoneNoneZPtr {
4167                         err: std::ptr::null_mut(),
4168                 },
4169                 result_ok: false,
4170         }
4171 }
4172 /// Checks if the given object is currently in the success state
4173 #[no_mangle]
4174 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
4175         o.result_ok
4176 }
4177 #[no_mangle]
4178 /// Frees any resources used by the CResult_NoneNoneZ.
4179 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
4180 impl Drop for CResult_NoneNoneZ {
4181         fn drop(&mut self) {
4182                 if self.result_ok {
4183                 } else {
4184                 }
4185         }
4186 }
4187 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
4188         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
4189                 let contents = if o.result_ok {
4190                         let _ = unsafe { Box::from_raw(o.contents.result) };
4191                         o.contents.result = std::ptr::null_mut();
4192                         CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
4193                 } else {
4194                         let _ = unsafe { Box::from_raw(o.contents.err) };
4195                         o.contents.err = std::ptr::null_mut();
4196                         CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
4197                 };
4198                 Self {
4199                         contents,
4200                         result_ok: o.result_ok,
4201                 }
4202         }
4203 }
4204 impl Clone for CResult_NoneNoneZ {
4205         fn clone(&self) -> Self {
4206                 if self.result_ok {
4207                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
4208                                 result: std::ptr::null_mut()
4209                         } }
4210                 } else {
4211                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
4212                                 err: std::ptr::null_mut()
4213                         } }
4214                 }
4215         }
4216 }
4217 #[no_mangle]
4218 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
4219 /// but with all dynamically-allocated buffers duplicated in new buffers.
4220 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
4221 #[repr(C)]
4222 /// A tuple of 2 elements. See the individual fields for the types contained.
4223 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4224         /// The element at position 0
4225         pub a: crate::c_types::Signature,
4226         /// The element at position 1
4227         pub b: crate::c_types::derived::CVec_SignatureZ,
4228 }
4229 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4230         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4231                 Self {
4232                         a: tup.0,
4233                         b: tup.1,
4234                 }
4235         }
4236 }
4237 impl C2Tuple_SignatureCVec_SignatureZZ {
4238         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4239                 (self.a, self.b)
4240         }
4241 }
4242 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4243         fn clone(&self) -> Self {
4244                 Self {
4245                         a: Clone::clone(&self.a),
4246                         b: Clone::clone(&self.b),
4247                 }
4248         }
4249 }
4250 #[no_mangle]
4251 /// Creates a new tuple which has the same data as `orig`
4252 /// but with all dynamically-allocated buffers duplicated in new buffers.
4253 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4254 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4255 #[no_mangle]
4256 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4257         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4258 }
4259
4260 #[no_mangle]
4261 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4262 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4263 #[repr(C)]
4264 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4265 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4266         /// A pointer to the contents in the success state.
4267         /// Reading from this pointer when `result_ok` is not set is undefined.
4268         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4269         /// Note that this value is always NULL, as there are no contents in the Err variant
4270         pub err: *mut std::ffi::c_void,
4271 }
4272 #[repr(C)]
4273 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4274 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4275 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4276 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4277         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4278         /// `err` or `result` depending on the state of `result_ok`.
4279         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4280         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4281         pub result_ok: bool,
4282 }
4283 #[no_mangle]
4284 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4285 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4286         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4287                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4288                         result: Box::into_raw(Box::new(o)),
4289                 },
4290                 result_ok: true,
4291         }
4292 }
4293 #[no_mangle]
4294 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4295 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4296         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4297                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4298                         err: std::ptr::null_mut(),
4299                 },
4300                 result_ok: false,
4301         }
4302 }
4303 /// Checks if the given object is currently in the success state
4304 #[no_mangle]
4305 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4306         o.result_ok
4307 }
4308 #[no_mangle]
4309 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4310 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4311 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4312         fn drop(&mut self) {
4313                 if self.result_ok {
4314                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4315                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4316                         }
4317                 } else {
4318                 }
4319         }
4320 }
4321 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4322         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4323                 let contents = if o.result_ok {
4324                         let result = unsafe { o.contents.result };
4325                         unsafe { o.contents.result = std::ptr::null_mut() };
4326                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4327                 } else {
4328                         let _ = unsafe { Box::from_raw(o.contents.err) };
4329                         o.contents.err = std::ptr::null_mut();
4330                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
4331                 };
4332                 Self {
4333                         contents,
4334                         result_ok: o.result_ok,
4335                 }
4336         }
4337 }
4338 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4339         fn clone(&self) -> Self {
4340                 if self.result_ok {
4341                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4342                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4343                         } }
4344                 } else {
4345                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4346                                 err: std::ptr::null_mut()
4347                         } }
4348                 }
4349         }
4350 }
4351 #[no_mangle]
4352 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4353 /// but with all dynamically-allocated buffers duplicated in new buffers.
4354 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4355 #[repr(C)]
4356 /// The contents of CResult_SignatureNoneZ
4357 pub union CResult_SignatureNoneZPtr {
4358         /// A pointer to the contents in the success state.
4359         /// Reading from this pointer when `result_ok` is not set is undefined.
4360         pub result: *mut crate::c_types::Signature,
4361         /// Note that this value is always NULL, as there are no contents in the Err variant
4362         pub err: *mut std::ffi::c_void,
4363 }
4364 #[repr(C)]
4365 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4366 /// containing a crate::c_types::Signature on success and a () on failure.
4367 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4368 pub struct CResult_SignatureNoneZ {
4369         /// The contents of this CResult_SignatureNoneZ, accessible via either
4370         /// `err` or `result` depending on the state of `result_ok`.
4371         pub contents: CResult_SignatureNoneZPtr,
4372         /// Whether this CResult_SignatureNoneZ represents a success state.
4373         pub result_ok: bool,
4374 }
4375 #[no_mangle]
4376 /// Creates a new CResult_SignatureNoneZ in the success state.
4377 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4378         CResult_SignatureNoneZ {
4379                 contents: CResult_SignatureNoneZPtr {
4380                         result: Box::into_raw(Box::new(o)),
4381                 },
4382                 result_ok: true,
4383         }
4384 }
4385 #[no_mangle]
4386 /// Creates a new CResult_SignatureNoneZ in the error state.
4387 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4388         CResult_SignatureNoneZ {
4389                 contents: CResult_SignatureNoneZPtr {
4390                         err: std::ptr::null_mut(),
4391                 },
4392                 result_ok: false,
4393         }
4394 }
4395 /// Checks if the given object is currently in the success state
4396 #[no_mangle]
4397 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4398         o.result_ok
4399 }
4400 #[no_mangle]
4401 /// Frees any resources used by the CResult_SignatureNoneZ.
4402 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4403 impl Drop for CResult_SignatureNoneZ {
4404         fn drop(&mut self) {
4405                 if self.result_ok {
4406                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4407                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4408                         }
4409                 } else {
4410                 }
4411         }
4412 }
4413 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4414         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4415                 let contents = if o.result_ok {
4416                         let result = unsafe { o.contents.result };
4417                         unsafe { o.contents.result = std::ptr::null_mut() };
4418                         CResult_SignatureNoneZPtr { result }
4419                 } else {
4420                         let _ = unsafe { Box::from_raw(o.contents.err) };
4421                         o.contents.err = std::ptr::null_mut();
4422                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
4423                 };
4424                 Self {
4425                         contents,
4426                         result_ok: o.result_ok,
4427                 }
4428         }
4429 }
4430 impl Clone for CResult_SignatureNoneZ {
4431         fn clone(&self) -> Self {
4432                 if self.result_ok {
4433                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4434                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4435                         } }
4436                 } else {
4437                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4438                                 err: std::ptr::null_mut()
4439                         } }
4440                 }
4441         }
4442 }
4443 #[no_mangle]
4444 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4445 /// but with all dynamically-allocated buffers duplicated in new buffers.
4446 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4447 #[repr(C)]
4448 /// The contents of CResult_SignDecodeErrorZ
4449 pub union CResult_SignDecodeErrorZPtr {
4450         /// A pointer to the contents in the success state.
4451         /// Reading from this pointer when `result_ok` is not set is undefined.
4452         pub result: *mut crate::lightning::chain::keysinterface::Sign,
4453         /// A pointer to the contents in the error state.
4454         /// Reading from this pointer when `result_ok` is set is undefined.
4455         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4456 }
4457 #[repr(C)]
4458 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4459 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4460 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4461 pub struct CResult_SignDecodeErrorZ {
4462         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4463         /// `err` or `result` depending on the state of `result_ok`.
4464         pub contents: CResult_SignDecodeErrorZPtr,
4465         /// Whether this CResult_SignDecodeErrorZ represents a success state.
4466         pub result_ok: bool,
4467 }
4468 #[no_mangle]
4469 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4470 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4471         CResult_SignDecodeErrorZ {
4472                 contents: CResult_SignDecodeErrorZPtr {
4473                         result: Box::into_raw(Box::new(o)),
4474                 },
4475                 result_ok: true,
4476         }
4477 }
4478 #[no_mangle]
4479 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4480 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4481         CResult_SignDecodeErrorZ {
4482                 contents: CResult_SignDecodeErrorZPtr {
4483                         err: Box::into_raw(Box::new(e)),
4484                 },
4485                 result_ok: false,
4486         }
4487 }
4488 /// Checks if the given object is currently in the success state
4489 #[no_mangle]
4490 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
4491         o.result_ok
4492 }
4493 #[no_mangle]
4494 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4495 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4496 impl Drop for CResult_SignDecodeErrorZ {
4497         fn drop(&mut self) {
4498                 if self.result_ok {
4499                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4500                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4501                         }
4502                 } else {
4503                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4504                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4505                         }
4506                 }
4507         }
4508 }
4509 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4510         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4511                 let contents = if o.result_ok {
4512                         let result = unsafe { o.contents.result };
4513                         unsafe { o.contents.result = std::ptr::null_mut() };
4514                         CResult_SignDecodeErrorZPtr { result }
4515                 } else {
4516                         let err = unsafe { o.contents.err };
4517                         unsafe { o.contents.err = std::ptr::null_mut(); }
4518                         CResult_SignDecodeErrorZPtr { err }
4519                 };
4520                 Self {
4521                         contents,
4522                         result_ok: o.result_ok,
4523                 }
4524         }
4525 }
4526 impl Clone for CResult_SignDecodeErrorZ {
4527         fn clone(&self) -> Self {
4528                 if self.result_ok {
4529                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4530                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4531                         } }
4532                 } else {
4533                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4534                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4535                         } }
4536                 }
4537         }
4538 }
4539 #[no_mangle]
4540 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4541 /// but with all dynamically-allocated buffers duplicated in new buffers.
4542 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4543 #[repr(C)]
4544 /// A dynamically-allocated array of u8s of arbitrary size.
4545 /// This corresponds to std::vector in C++
4546 pub struct CVec_u8Z {
4547         /// The elements in the array.
4548         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4549         pub data: *mut u8,
4550         /// The number of elements pointed to by `data`.
4551         pub datalen: usize
4552 }
4553 impl CVec_u8Z {
4554         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4555                 if self.datalen == 0 { return Vec::new(); }
4556                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4557                 self.data = std::ptr::null_mut();
4558                 self.datalen = 0;
4559                 ret
4560         }
4561         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4562                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4563         }
4564 }
4565 impl From<Vec<u8>> for CVec_u8Z {
4566         fn from(v: Vec<u8>) -> Self {
4567                 let datalen = v.len();
4568                 let data = Box::into_raw(v.into_boxed_slice());
4569                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4570         }
4571 }
4572 #[no_mangle]
4573 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4574 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4575 impl Drop for CVec_u8Z {
4576         fn drop(&mut self) {
4577                 if self.datalen == 0 { return; }
4578                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4579         }
4580 }
4581 impl Clone for CVec_u8Z {
4582         fn clone(&self) -> Self {
4583                 let mut res = Vec::new();
4584                 if self.datalen == 0 { return Self::from(res); }
4585                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4586                 Self::from(res)
4587         }
4588 }
4589 #[repr(C)]
4590 /// The contents of CResult_RecoverableSignatureNoneZ
4591 pub union CResult_RecoverableSignatureNoneZPtr {
4592         /// A pointer to the contents in the success state.
4593         /// Reading from this pointer when `result_ok` is not set is undefined.
4594         pub result: *mut crate::c_types::RecoverableSignature,
4595         /// Note that this value is always NULL, as there are no contents in the Err variant
4596         pub err: *mut std::ffi::c_void,
4597 }
4598 #[repr(C)]
4599 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4600 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4602 pub struct CResult_RecoverableSignatureNoneZ {
4603         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4604         /// `err` or `result` depending on the state of `result_ok`.
4605         pub contents: CResult_RecoverableSignatureNoneZPtr,
4606         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4607         pub result_ok: bool,
4608 }
4609 #[no_mangle]
4610 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4611 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4612         CResult_RecoverableSignatureNoneZ {
4613                 contents: CResult_RecoverableSignatureNoneZPtr {
4614                         result: Box::into_raw(Box::new(o)),
4615                 },
4616                 result_ok: true,
4617         }
4618 }
4619 #[no_mangle]
4620 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4621 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4622         CResult_RecoverableSignatureNoneZ {
4623                 contents: CResult_RecoverableSignatureNoneZPtr {
4624                         err: std::ptr::null_mut(),
4625                 },
4626                 result_ok: false,
4627         }
4628 }
4629 /// Checks if the given object is currently in the success state
4630 #[no_mangle]
4631 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
4632         o.result_ok
4633 }
4634 #[no_mangle]
4635 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4636 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4637 impl Drop for CResult_RecoverableSignatureNoneZ {
4638         fn drop(&mut self) {
4639                 if self.result_ok {
4640                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4641                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4642                         }
4643                 } else {
4644                 }
4645         }
4646 }
4647 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4648         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4649                 let contents = if o.result_ok {
4650                         let result = unsafe { o.contents.result };
4651                         unsafe { o.contents.result = std::ptr::null_mut() };
4652                         CResult_RecoverableSignatureNoneZPtr { result }
4653                 } else {
4654                         let _ = unsafe { Box::from_raw(o.contents.err) };
4655                         o.contents.err = std::ptr::null_mut();
4656                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4657                 };
4658                 Self {
4659                         contents,
4660                         result_ok: o.result_ok,
4661                 }
4662         }
4663 }
4664 impl Clone for CResult_RecoverableSignatureNoneZ {
4665         fn clone(&self) -> Self {
4666                 if self.result_ok {
4667                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4668                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4669                         } }
4670                 } else {
4671                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4672                                 err: std::ptr::null_mut()
4673                         } }
4674                 }
4675         }
4676 }
4677 #[no_mangle]
4678 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4679 /// but with all dynamically-allocated buffers duplicated in new buffers.
4680 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4681 #[repr(C)]
4682 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4683 /// This corresponds to std::vector in C++
4684 pub struct CVec_CVec_u8ZZ {
4685         /// The elements in the array.
4686         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4687         pub data: *mut crate::c_types::derived::CVec_u8Z,
4688         /// The number of elements pointed to by `data`.
4689         pub datalen: usize
4690 }
4691 impl CVec_CVec_u8ZZ {
4692         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4693                 if self.datalen == 0 { return Vec::new(); }
4694                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4695                 self.data = std::ptr::null_mut();
4696                 self.datalen = 0;
4697                 ret
4698         }
4699         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4700                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4701         }
4702 }
4703 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4704         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4705                 let datalen = v.len();
4706                 let data = Box::into_raw(v.into_boxed_slice());
4707                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4708         }
4709 }
4710 #[no_mangle]
4711 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4712 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4713 impl Drop for CVec_CVec_u8ZZ {
4714         fn drop(&mut self) {
4715                 if self.datalen == 0 { return; }
4716                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4717         }
4718 }
4719 impl Clone for CVec_CVec_u8ZZ {
4720         fn clone(&self) -> Self {
4721                 let mut res = Vec::new();
4722                 if self.datalen == 0 { return Self::from(res); }
4723                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4724                 Self::from(res)
4725         }
4726 }
4727 #[repr(C)]
4728 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4729 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4730         /// A pointer to the contents in the success state.
4731         /// Reading from this pointer when `result_ok` is not set is undefined.
4732         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4733         /// Note that this value is always NULL, as there are no contents in the Err variant
4734         pub err: *mut std::ffi::c_void,
4735 }
4736 #[repr(C)]
4737 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4738 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4739 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4740 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4741         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4742         /// `err` or `result` depending on the state of `result_ok`.
4743         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4744         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4745         pub result_ok: bool,
4746 }
4747 #[no_mangle]
4748 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4749 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4750         CResult_CVec_CVec_u8ZZNoneZ {
4751                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4752                         result: Box::into_raw(Box::new(o)),
4753                 },
4754                 result_ok: true,
4755         }
4756 }
4757 #[no_mangle]
4758 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4759 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4760         CResult_CVec_CVec_u8ZZNoneZ {
4761                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4762                         err: std::ptr::null_mut(),
4763                 },
4764                 result_ok: false,
4765         }
4766 }
4767 /// Checks if the given object is currently in the success state
4768 #[no_mangle]
4769 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
4770         o.result_ok
4771 }
4772 #[no_mangle]
4773 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4774 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4775 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4776         fn drop(&mut self) {
4777                 if self.result_ok {
4778                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4779                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4780                         }
4781                 } else {
4782                 }
4783         }
4784 }
4785 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4786         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4787                 let contents = if o.result_ok {
4788                         let result = unsafe { o.contents.result };
4789                         unsafe { o.contents.result = std::ptr::null_mut() };
4790                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
4791                 } else {
4792                         let _ = unsafe { Box::from_raw(o.contents.err) };
4793                         o.contents.err = std::ptr::null_mut();
4794                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4795                 };
4796                 Self {
4797                         contents,
4798                         result_ok: o.result_ok,
4799                 }
4800         }
4801 }
4802 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4803         fn clone(&self) -> Self {
4804                 if self.result_ok {
4805                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4806                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4807                         } }
4808                 } else {
4809                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4810                                 err: std::ptr::null_mut()
4811                         } }
4812                 }
4813         }
4814 }
4815 #[no_mangle]
4816 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4817 /// but with all dynamically-allocated buffers duplicated in new buffers.
4818 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4819 #[repr(C)]
4820 /// The contents of CResult_InMemorySignerDecodeErrorZ
4821 pub union CResult_InMemorySignerDecodeErrorZPtr {
4822         /// A pointer to the contents in the success state.
4823         /// Reading from this pointer when `result_ok` is not set is undefined.
4824         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4825         /// A pointer to the contents in the error state.
4826         /// Reading from this pointer when `result_ok` is set is undefined.
4827         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4828 }
4829 #[repr(C)]
4830 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4831 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4833 pub struct CResult_InMemorySignerDecodeErrorZ {
4834         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4835         /// `err` or `result` depending on the state of `result_ok`.
4836         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4837         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4838         pub result_ok: bool,
4839 }
4840 #[no_mangle]
4841 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4842 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4843         CResult_InMemorySignerDecodeErrorZ {
4844                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4845                         result: Box::into_raw(Box::new(o)),
4846                 },
4847                 result_ok: true,
4848         }
4849 }
4850 #[no_mangle]
4851 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4852 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4853         CResult_InMemorySignerDecodeErrorZ {
4854                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4855                         err: Box::into_raw(Box::new(e)),
4856                 },
4857                 result_ok: false,
4858         }
4859 }
4860 /// Checks if the given object is currently in the success state
4861 #[no_mangle]
4862 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
4863         o.result_ok
4864 }
4865 #[no_mangle]
4866 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4867 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4868 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4869         fn drop(&mut self) {
4870                 if self.result_ok {
4871                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4872                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4873                         }
4874                 } else {
4875                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4876                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4877                         }
4878                 }
4879         }
4880 }
4881 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4882         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
4883                 let contents = if o.result_ok {
4884                         let result = unsafe { o.contents.result };
4885                         unsafe { o.contents.result = std::ptr::null_mut() };
4886                         CResult_InMemorySignerDecodeErrorZPtr { result }
4887                 } else {
4888                         let err = unsafe { o.contents.err };
4889                         unsafe { o.contents.err = std::ptr::null_mut(); }
4890                         CResult_InMemorySignerDecodeErrorZPtr { err }
4891                 };
4892                 Self {
4893                         contents,
4894                         result_ok: o.result_ok,
4895                 }
4896         }
4897 }
4898 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4899         fn clone(&self) -> Self {
4900                 if self.result_ok {
4901                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4902                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4903                         } }
4904                 } else {
4905                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4906                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4907                         } }
4908                 }
4909         }
4910 }
4911 #[no_mangle]
4912 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
4913 /// but with all dynamically-allocated buffers duplicated in new buffers.
4914 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
4915 #[repr(C)]
4916 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4917 /// This corresponds to std::vector in C++
4918 pub struct CVec_TxOutZ {
4919         /// The elements in the array.
4920         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4921         pub data: *mut crate::c_types::TxOut,
4922         /// The number of elements pointed to by `data`.
4923         pub datalen: usize
4924 }
4925 impl CVec_TxOutZ {
4926         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4927                 if self.datalen == 0 { return Vec::new(); }
4928                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4929                 self.data = std::ptr::null_mut();
4930                 self.datalen = 0;
4931                 ret
4932         }
4933         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4934                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4935         }
4936 }
4937 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4938         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4939                 let datalen = v.len();
4940                 let data = Box::into_raw(v.into_boxed_slice());
4941                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4942         }
4943 }
4944 #[no_mangle]
4945 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4946 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4947 impl Drop for CVec_TxOutZ {
4948         fn drop(&mut self) {
4949                 if self.datalen == 0 { return; }
4950                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4951         }
4952 }
4953 impl Clone for CVec_TxOutZ {
4954         fn clone(&self) -> Self {
4955                 let mut res = Vec::new();
4956                 if self.datalen == 0 { return Self::from(res); }
4957                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4958                 Self::from(res)
4959         }
4960 }
4961 #[repr(C)]
4962 /// The contents of CResult_TransactionNoneZ
4963 pub union CResult_TransactionNoneZPtr {
4964         /// A pointer to the contents in the success state.
4965         /// Reading from this pointer when `result_ok` is not set is undefined.
4966         pub result: *mut crate::c_types::Transaction,
4967         /// Note that this value is always NULL, as there are no contents in the Err variant
4968         pub err: *mut std::ffi::c_void,
4969 }
4970 #[repr(C)]
4971 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
4972 /// containing a crate::c_types::Transaction on success and a () on failure.
4973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4974 pub struct CResult_TransactionNoneZ {
4975         /// The contents of this CResult_TransactionNoneZ, accessible via either
4976         /// `err` or `result` depending on the state of `result_ok`.
4977         pub contents: CResult_TransactionNoneZPtr,
4978         /// Whether this CResult_TransactionNoneZ represents a success state.
4979         pub result_ok: bool,
4980 }
4981 #[no_mangle]
4982 /// Creates a new CResult_TransactionNoneZ in the success state.
4983 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4984         CResult_TransactionNoneZ {
4985                 contents: CResult_TransactionNoneZPtr {
4986                         result: Box::into_raw(Box::new(o)),
4987                 },
4988                 result_ok: true,
4989         }
4990 }
4991 #[no_mangle]
4992 /// Creates a new CResult_TransactionNoneZ in the error state.
4993 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4994         CResult_TransactionNoneZ {
4995                 contents: CResult_TransactionNoneZPtr {
4996                         err: std::ptr::null_mut(),
4997                 },
4998                 result_ok: false,
4999         }
5000 }
5001 /// Checks if the given object is currently in the success state
5002 #[no_mangle]
5003 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5004         o.result_ok
5005 }
5006 #[no_mangle]
5007 /// Frees any resources used by the CResult_TransactionNoneZ.
5008 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5009 impl Drop for CResult_TransactionNoneZ {
5010         fn drop(&mut self) {
5011                 if self.result_ok {
5012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5014                         }
5015                 } else {
5016                 }
5017         }
5018 }
5019 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5020         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5021                 let contents = if o.result_ok {
5022                         let result = unsafe { o.contents.result };
5023                         unsafe { o.contents.result = std::ptr::null_mut() };
5024                         CResult_TransactionNoneZPtr { result }
5025                 } else {
5026                         let _ = unsafe { Box::from_raw(o.contents.err) };
5027                         o.contents.err = std::ptr::null_mut();
5028                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
5029                 };
5030                 Self {
5031                         contents,
5032                         result_ok: o.result_ok,
5033                 }
5034         }
5035 }
5036 impl Clone for CResult_TransactionNoneZ {
5037         fn clone(&self) -> Self {
5038                 if self.result_ok {
5039                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5040                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5041                         } }
5042                 } else {
5043                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5044                                 err: std::ptr::null_mut()
5045                         } }
5046                 }
5047         }
5048 }
5049 #[no_mangle]
5050 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5051 /// but with all dynamically-allocated buffers duplicated in new buffers.
5052 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5053 #[repr(C)]
5054 /// A tuple of 2 elements. See the individual fields for the types contained.
5055 pub struct C2Tuple_BlockHashChannelMonitorZ {
5056         /// The element at position 0
5057         pub a: crate::c_types::ThirtyTwoBytes,
5058         /// The element at position 1
5059         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5060 }
5061 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5062         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5063                 Self {
5064                         a: tup.0,
5065                         b: tup.1,
5066                 }
5067         }
5068 }
5069 impl C2Tuple_BlockHashChannelMonitorZ {
5070         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5071                 (self.a, self.b)
5072         }
5073 }
5074 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5075 #[no_mangle]
5076 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5077         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5078 }
5079
5080 #[no_mangle]
5081 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5082 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5083 #[repr(C)]
5084 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5085 /// This corresponds to std::vector in C++
5086 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5087         /// The elements in the array.
5088         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5089         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5090         /// The number of elements pointed to by `data`.
5091         pub datalen: usize
5092 }
5093 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5094         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5095                 if self.datalen == 0 { return Vec::new(); }
5096                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5097                 self.data = std::ptr::null_mut();
5098                 self.datalen = 0;
5099                 ret
5100         }
5101         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5102                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5103         }
5104 }
5105 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5106         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5107                 let datalen = v.len();
5108                 let data = Box::into_raw(v.into_boxed_slice());
5109                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5110         }
5111 }
5112 #[no_mangle]
5113 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5114 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5115 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5116         fn drop(&mut self) {
5117                 if self.datalen == 0 { return; }
5118                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5119         }
5120 }
5121 #[repr(C)]
5122 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5123 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5124         /// A pointer to the contents in the success state.
5125         /// Reading from this pointer when `result_ok` is not set is undefined.
5126         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5127         /// A pointer to the contents in the error state.
5128         /// Reading from this pointer when `result_ok` is set is undefined.
5129         pub err: *mut crate::c_types::IOError,
5130 }
5131 #[repr(C)]
5132 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5133 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5135 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5136         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5137         /// `err` or `result` depending on the state of `result_ok`.
5138         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5139         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5140         pub result_ok: bool,
5141 }
5142 #[no_mangle]
5143 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5144 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5145         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5146                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5147                         result: Box::into_raw(Box::new(o)),
5148                 },
5149                 result_ok: true,
5150         }
5151 }
5152 #[no_mangle]
5153 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5154 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5155         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5156                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5157                         err: Box::into_raw(Box::new(e)),
5158                 },
5159                 result_ok: false,
5160         }
5161 }
5162 /// Checks if the given object is currently in the success state
5163 #[no_mangle]
5164 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5165         o.result_ok
5166 }
5167 #[no_mangle]
5168 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5169 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5170 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5171         fn drop(&mut self) {
5172                 if self.result_ok {
5173                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5174                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5175                         }
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::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5184         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5185                 let contents = if o.result_ok {
5186                         let result = unsafe { o.contents.result };
5187                         unsafe { o.contents.result = std::ptr::null_mut() };
5188                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5189                 } else {
5190                         let err = unsafe { o.contents.err };
5191                         unsafe { o.contents.err = std::ptr::null_mut(); }
5192                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5193                 };
5194                 Self {
5195                         contents,
5196                         result_ok: o.result_ok,
5197                 }
5198         }
5199 }
5200 #[repr(C)]
5201 #[derive(Clone)]
5202 /// An enum which can either contain a u16 or not
5203 pub enum COption_u16Z {
5204         /// When we're in this state, this COption_u16Z contains a u16
5205         Some(u16),
5206         /// When we're in this state, this COption_u16Z contains nothing
5207         None
5208 }
5209 impl COption_u16Z {
5210         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5211                 if let Self::Some(_) = self { true } else { false }
5212         }
5213         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5214                 !self.is_some()
5215         }
5216         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5217                 if let Self::Some(v) = self { v } else { unreachable!() }
5218         }
5219 }
5220 #[no_mangle]
5221 /// Constructs a new COption_u16Z containing a u16
5222 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5223         COption_u16Z::Some(o)
5224 }
5225 #[no_mangle]
5226 /// Constructs a new COption_u16Z containing nothing
5227 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5228         COption_u16Z::None
5229 }
5230 #[no_mangle]
5231 /// Frees any resources associated with the u16, if we are in the Some state
5232 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5233 #[no_mangle]
5234 /// Creates a new COption_u16Z which has the same data as `orig`
5235 /// but with all dynamically-allocated buffers duplicated in new buffers.
5236 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5237 #[repr(C)]
5238 /// The contents of CResult_NoneAPIErrorZ
5239 pub union CResult_NoneAPIErrorZPtr {
5240         /// Note that this value is always NULL, as there are no contents in the OK variant
5241         pub result: *mut std::ffi::c_void,
5242         /// A pointer to the contents in the error state.
5243         /// Reading from this pointer when `result_ok` is set is undefined.
5244         pub err: *mut crate::lightning::util::errors::APIError,
5245 }
5246 #[repr(C)]
5247 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5248 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5249 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5250 pub struct CResult_NoneAPIErrorZ {
5251         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5252         /// `err` or `result` depending on the state of `result_ok`.
5253         pub contents: CResult_NoneAPIErrorZPtr,
5254         /// Whether this CResult_NoneAPIErrorZ represents a success state.
5255         pub result_ok: bool,
5256 }
5257 #[no_mangle]
5258 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5259 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5260         CResult_NoneAPIErrorZ {
5261                 contents: CResult_NoneAPIErrorZPtr {
5262                         result: std::ptr::null_mut(),
5263                 },
5264                 result_ok: true,
5265         }
5266 }
5267 #[no_mangle]
5268 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5269 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5270         CResult_NoneAPIErrorZ {
5271                 contents: CResult_NoneAPIErrorZPtr {
5272                         err: Box::into_raw(Box::new(e)),
5273                 },
5274                 result_ok: false,
5275         }
5276 }
5277 /// Checks if the given object is currently in the success state
5278 #[no_mangle]
5279 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5280         o.result_ok
5281 }
5282 #[no_mangle]
5283 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5284 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5285 impl Drop for CResult_NoneAPIErrorZ {
5286         fn drop(&mut self) {
5287                 if self.result_ok {
5288                 } else {
5289                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5290                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5291                         }
5292                 }
5293         }
5294 }
5295 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
5296         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
5297                 let contents = if o.result_ok {
5298                         let _ = unsafe { Box::from_raw(o.contents.result) };
5299                         o.contents.result = std::ptr::null_mut();
5300                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
5301                 } else {
5302                         let err = unsafe { o.contents.err };
5303                         unsafe { o.contents.err = std::ptr::null_mut(); }
5304                         CResult_NoneAPIErrorZPtr { err }
5305                 };
5306                 Self {
5307                         contents,
5308                         result_ok: o.result_ok,
5309                 }
5310         }
5311 }
5312 impl Clone for CResult_NoneAPIErrorZ {
5313         fn clone(&self) -> Self {
5314                 if self.result_ok {
5315                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
5316                                 result: std::ptr::null_mut()
5317                         } }
5318                 } else {
5319                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
5320                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5321                         } }
5322                 }
5323         }
5324 }
5325 #[no_mangle]
5326 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
5327 /// but with all dynamically-allocated buffers duplicated in new buffers.
5328 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
5329 #[repr(C)]
5330 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5331 /// This corresponds to std::vector in C++
5332 pub struct CVec_CResult_NoneAPIErrorZZ {
5333         /// The elements in the array.
5334         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5335         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
5336         /// The number of elements pointed to by `data`.
5337         pub datalen: usize
5338 }
5339 impl CVec_CResult_NoneAPIErrorZZ {
5340         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
5341                 if self.datalen == 0 { return Vec::new(); }
5342                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5343                 self.data = std::ptr::null_mut();
5344                 self.datalen = 0;
5345                 ret
5346         }
5347         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
5348                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5349         }
5350 }
5351 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
5352         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
5353                 let datalen = v.len();
5354                 let data = Box::into_raw(v.into_boxed_slice());
5355                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5356         }
5357 }
5358 #[no_mangle]
5359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5360 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
5361 impl Drop for CVec_CResult_NoneAPIErrorZZ {
5362         fn drop(&mut self) {
5363                 if self.datalen == 0 { return; }
5364                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5365         }
5366 }
5367 impl Clone for CVec_CResult_NoneAPIErrorZZ {
5368         fn clone(&self) -> Self {
5369                 let mut res = Vec::new();
5370                 if self.datalen == 0 { return Self::from(res); }
5371                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5372                 Self::from(res)
5373         }
5374 }
5375 #[repr(C)]
5376 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5377 /// This corresponds to std::vector in C++
5378 pub struct CVec_APIErrorZ {
5379         /// The elements in the array.
5380         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5381         pub data: *mut crate::lightning::util::errors::APIError,
5382         /// The number of elements pointed to by `data`.
5383         pub datalen: usize
5384 }
5385 impl CVec_APIErrorZ {
5386         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
5387                 if self.datalen == 0 { return Vec::new(); }
5388                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5389                 self.data = std::ptr::null_mut();
5390                 self.datalen = 0;
5391                 ret
5392         }
5393         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
5394                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5395         }
5396 }
5397 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
5398         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
5399                 let datalen = v.len();
5400                 let data = Box::into_raw(v.into_boxed_slice());
5401                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5402         }
5403 }
5404 #[no_mangle]
5405 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5406 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
5407 impl Drop for CVec_APIErrorZ {
5408         fn drop(&mut self) {
5409                 if self.datalen == 0 { return; }
5410                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5411         }
5412 }
5413 impl Clone for CVec_APIErrorZ {
5414         fn clone(&self) -> Self {
5415                 let mut res = Vec::new();
5416                 if self.datalen == 0 { return Self::from(res); }
5417                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5418                 Self::from(res)
5419         }
5420 }
5421 #[repr(C)]
5422 /// The contents of CResult__u832APIErrorZ
5423 pub union CResult__u832APIErrorZPtr {
5424         /// A pointer to the contents in the success state.
5425         /// Reading from this pointer when `result_ok` is not set is undefined.
5426         pub result: *mut crate::c_types::ThirtyTwoBytes,
5427         /// A pointer to the contents in the error state.
5428         /// Reading from this pointer when `result_ok` is set is undefined.
5429         pub err: *mut crate::lightning::util::errors::APIError,
5430 }
5431 #[repr(C)]
5432 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
5433 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5435 pub struct CResult__u832APIErrorZ {
5436         /// The contents of this CResult__u832APIErrorZ, accessible via either
5437         /// `err` or `result` depending on the state of `result_ok`.
5438         pub contents: CResult__u832APIErrorZPtr,
5439         /// Whether this CResult__u832APIErrorZ represents a success state.
5440         pub result_ok: bool,
5441 }
5442 #[no_mangle]
5443 /// Creates a new CResult__u832APIErrorZ in the success state.
5444 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
5445         CResult__u832APIErrorZ {
5446                 contents: CResult__u832APIErrorZPtr {
5447                         result: Box::into_raw(Box::new(o)),
5448                 },
5449                 result_ok: true,
5450         }
5451 }
5452 #[no_mangle]
5453 /// Creates a new CResult__u832APIErrorZ in the error state.
5454 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
5455         CResult__u832APIErrorZ {
5456                 contents: CResult__u832APIErrorZPtr {
5457                         err: Box::into_raw(Box::new(e)),
5458                 },
5459                 result_ok: false,
5460         }
5461 }
5462 /// Checks if the given object is currently in the success state
5463 #[no_mangle]
5464 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
5465         o.result_ok
5466 }
5467 #[no_mangle]
5468 /// Frees any resources used by the CResult__u832APIErrorZ.
5469 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
5470 impl Drop for CResult__u832APIErrorZ {
5471         fn drop(&mut self) {
5472                 if self.result_ok {
5473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5475                         }
5476                 } else {
5477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5479                         }
5480                 }
5481         }
5482 }
5483 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
5484         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5485                 let contents = if o.result_ok {
5486                         let result = unsafe { o.contents.result };
5487                         unsafe { o.contents.result = std::ptr::null_mut() };
5488                         CResult__u832APIErrorZPtr { result }
5489                 } else {
5490                         let err = unsafe { o.contents.err };
5491                         unsafe { o.contents.err = std::ptr::null_mut(); }
5492                         CResult__u832APIErrorZPtr { err }
5493                 };
5494                 Self {
5495                         contents,
5496                         result_ok: o.result_ok,
5497                 }
5498         }
5499 }
5500 impl Clone for CResult__u832APIErrorZ {
5501         fn clone(&self) -> Self {
5502                 if self.result_ok {
5503                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5504                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5505                         } }
5506                 } else {
5507                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5508                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5509                         } }
5510                 }
5511         }
5512 }
5513 #[no_mangle]
5514 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5515 /// but with all dynamically-allocated buffers duplicated in new buffers.
5516 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5517 #[repr(C)]
5518 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5519 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5520         /// A pointer to the contents in the success state.
5521         /// Reading from this pointer when `result_ok` is not set is undefined.
5522         pub result: *mut crate::c_types::ThirtyTwoBytes,
5523         /// A pointer to the contents in the error state.
5524         /// Reading from this pointer when `result_ok` is set is undefined.
5525         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5526 }
5527 #[repr(C)]
5528 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5529 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5531 pub struct CResult_PaymentIdPaymentSendFailureZ {
5532         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5533         /// `err` or `result` depending on the state of `result_ok`.
5534         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5535         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5536         pub result_ok: bool,
5537 }
5538 #[no_mangle]
5539 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5540 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5541         CResult_PaymentIdPaymentSendFailureZ {
5542                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5543                         result: Box::into_raw(Box::new(o)),
5544                 },
5545                 result_ok: true,
5546         }
5547 }
5548 #[no_mangle]
5549 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5550 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5551         CResult_PaymentIdPaymentSendFailureZ {
5552                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5553                         err: Box::into_raw(Box::new(e)),
5554                 },
5555                 result_ok: false,
5556         }
5557 }
5558 /// Checks if the given object is currently in the success state
5559 #[no_mangle]
5560 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
5561         o.result_ok
5562 }
5563 #[no_mangle]
5564 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5565 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5566 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5567         fn drop(&mut self) {
5568                 if self.result_ok {
5569                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5570                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5571                         }
5572                 } else {
5573                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5574                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5575                         }
5576                 }
5577         }
5578 }
5579 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5580         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5581                 let contents = if o.result_ok {
5582                         let result = unsafe { o.contents.result };
5583                         unsafe { o.contents.result = std::ptr::null_mut() };
5584                         CResult_PaymentIdPaymentSendFailureZPtr { result }
5585                 } else {
5586                         let err = unsafe { o.contents.err };
5587                         unsafe { o.contents.err = std::ptr::null_mut(); }
5588                         CResult_PaymentIdPaymentSendFailureZPtr { err }
5589                 };
5590                 Self {
5591                         contents,
5592                         result_ok: o.result_ok,
5593                 }
5594         }
5595 }
5596 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5597         fn clone(&self) -> Self {
5598                 if self.result_ok {
5599                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5600                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5601                         } }
5602                 } else {
5603                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5604                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5605                         } }
5606                 }
5607         }
5608 }
5609 #[no_mangle]
5610 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5611 /// but with all dynamically-allocated buffers duplicated in new buffers.
5612 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5613 #[repr(C)]
5614 /// The contents of CResult_NonePaymentSendFailureZ
5615 pub union CResult_NonePaymentSendFailureZPtr {
5616         /// Note that this value is always NULL, as there are no contents in the OK variant
5617         pub result: *mut std::ffi::c_void,
5618         /// A pointer to the contents in the error state.
5619         /// Reading from this pointer when `result_ok` is set is undefined.
5620         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5621 }
5622 #[repr(C)]
5623 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5624 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5626 pub struct CResult_NonePaymentSendFailureZ {
5627         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5628         /// `err` or `result` depending on the state of `result_ok`.
5629         pub contents: CResult_NonePaymentSendFailureZPtr,
5630         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5631         pub result_ok: bool,
5632 }
5633 #[no_mangle]
5634 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5635 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5636         CResult_NonePaymentSendFailureZ {
5637                 contents: CResult_NonePaymentSendFailureZPtr {
5638                         result: std::ptr::null_mut(),
5639                 },
5640                 result_ok: true,
5641         }
5642 }
5643 #[no_mangle]
5644 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5645 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5646         CResult_NonePaymentSendFailureZ {
5647                 contents: CResult_NonePaymentSendFailureZPtr {
5648                         err: Box::into_raw(Box::new(e)),
5649                 },
5650                 result_ok: false,
5651         }
5652 }
5653 /// Checks if the given object is currently in the success state
5654 #[no_mangle]
5655 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
5656         o.result_ok
5657 }
5658 #[no_mangle]
5659 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5660 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5661 impl Drop for CResult_NonePaymentSendFailureZ {
5662         fn drop(&mut self) {
5663                 if self.result_ok {
5664                 } else {
5665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5667                         }
5668                 }
5669         }
5670 }
5671 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5672         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5673                 let contents = if o.result_ok {
5674                         let _ = unsafe { Box::from_raw(o.contents.result) };
5675                         o.contents.result = std::ptr::null_mut();
5676                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5677                 } else {
5678                         let err = unsafe { o.contents.err };
5679                         unsafe { o.contents.err = std::ptr::null_mut(); }
5680                         CResult_NonePaymentSendFailureZPtr { err }
5681                 };
5682                 Self {
5683                         contents,
5684                         result_ok: o.result_ok,
5685                 }
5686         }
5687 }
5688 impl Clone for CResult_NonePaymentSendFailureZ {
5689         fn clone(&self) -> Self {
5690                 if self.result_ok {
5691                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5692                                 result: std::ptr::null_mut()
5693                         } }
5694                 } else {
5695                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5696                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5697                         } }
5698                 }
5699         }
5700 }
5701 #[no_mangle]
5702 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5703 /// but with all dynamically-allocated buffers duplicated in new buffers.
5704 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5705 #[repr(C)]
5706 /// A tuple of 2 elements. See the individual fields for the types contained.
5707 pub struct C2Tuple_PaymentHashPaymentIdZ {
5708         /// The element at position 0
5709         pub a: crate::c_types::ThirtyTwoBytes,
5710         /// The element at position 1
5711         pub b: crate::c_types::ThirtyTwoBytes,
5712 }
5713 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5714         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5715                 Self {
5716                         a: tup.0,
5717                         b: tup.1,
5718                 }
5719         }
5720 }
5721 impl C2Tuple_PaymentHashPaymentIdZ {
5722         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5723                 (self.a, self.b)
5724         }
5725 }
5726 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5727         fn clone(&self) -> Self {
5728                 Self {
5729                         a: Clone::clone(&self.a),
5730                         b: Clone::clone(&self.b),
5731                 }
5732         }
5733 }
5734 #[no_mangle]
5735 /// Creates a new tuple which has the same data as `orig`
5736 /// but with all dynamically-allocated buffers duplicated in new buffers.
5737 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5738 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5739 #[no_mangle]
5740 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5741         C2Tuple_PaymentHashPaymentIdZ { a, b, }
5742 }
5743
5744 #[no_mangle]
5745 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5746 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5747 #[repr(C)]
5748 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5749 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5750         /// A pointer to the contents in the success state.
5751         /// Reading from this pointer when `result_ok` is not set is undefined.
5752         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5753         /// A pointer to the contents in the error state.
5754         /// Reading from this pointer when `result_ok` is set is undefined.
5755         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5756 }
5757 #[repr(C)]
5758 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5759 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5761 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5762         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5763         /// `err` or `result` depending on the state of `result_ok`.
5764         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5765         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5766         pub result_ok: bool,
5767 }
5768 #[no_mangle]
5769 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5770 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5771         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5772                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5773                         result: Box::into_raw(Box::new(o)),
5774                 },
5775                 result_ok: true,
5776         }
5777 }
5778 #[no_mangle]
5779 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5780 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5781         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5782                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5783                         err: Box::into_raw(Box::new(e)),
5784                 },
5785                 result_ok: false,
5786         }
5787 }
5788 /// Checks if the given object is currently in the success state
5789 #[no_mangle]
5790 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
5791         o.result_ok
5792 }
5793 #[no_mangle]
5794 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5795 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5796 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5797         fn drop(&mut self) {
5798                 if self.result_ok {
5799                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5800                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5801                         }
5802                 } else {
5803                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5804                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5805                         }
5806                 }
5807         }
5808 }
5809 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5810         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5811                 let contents = if o.result_ok {
5812                         let result = unsafe { o.contents.result };
5813                         unsafe { o.contents.result = std::ptr::null_mut() };
5814                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5815                 } else {
5816                         let err = unsafe { o.contents.err };
5817                         unsafe { o.contents.err = std::ptr::null_mut(); }
5818                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5819                 };
5820                 Self {
5821                         contents,
5822                         result_ok: o.result_ok,
5823                 }
5824         }
5825 }
5826 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5827         fn clone(&self) -> Self {
5828                 if self.result_ok {
5829                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5830                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5831                         } }
5832                 } else {
5833                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5834                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5835                         } }
5836                 }
5837         }
5838 }
5839 #[no_mangle]
5840 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5841 /// but with all dynamically-allocated buffers duplicated in new buffers.
5842 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5843 #[repr(C)]
5844 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5845 /// This corresponds to std::vector in C++
5846 pub struct CVec_NetAddressZ {
5847         /// The elements in the array.
5848         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5849         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5850         /// The number of elements pointed to by `data`.
5851         pub datalen: usize
5852 }
5853 impl CVec_NetAddressZ {
5854         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5855                 if self.datalen == 0 { return Vec::new(); }
5856                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5857                 self.data = std::ptr::null_mut();
5858                 self.datalen = 0;
5859                 ret
5860         }
5861         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5862                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5863         }
5864 }
5865 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5866         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5867                 let datalen = v.len();
5868                 let data = Box::into_raw(v.into_boxed_slice());
5869                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5870         }
5871 }
5872 #[no_mangle]
5873 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5874 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5875 impl Drop for CVec_NetAddressZ {
5876         fn drop(&mut self) {
5877                 if self.datalen == 0 { return; }
5878                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5879         }
5880 }
5881 impl Clone for CVec_NetAddressZ {
5882         fn clone(&self) -> Self {
5883                 let mut res = Vec::new();
5884                 if self.datalen == 0 { return Self::from(res); }
5885                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5886                 Self::from(res)
5887         }
5888 }
5889 #[repr(C)]
5890 /// A tuple of 2 elements. See the individual fields for the types contained.
5891 pub struct C2Tuple_PaymentHashPaymentSecretZ {
5892         /// The element at position 0
5893         pub a: crate::c_types::ThirtyTwoBytes,
5894         /// The element at position 1
5895         pub b: crate::c_types::ThirtyTwoBytes,
5896 }
5897 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
5898         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5899                 Self {
5900                         a: tup.0,
5901                         b: tup.1,
5902                 }
5903         }
5904 }
5905 impl C2Tuple_PaymentHashPaymentSecretZ {
5906         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5907                 (self.a, self.b)
5908         }
5909 }
5910 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
5911         fn clone(&self) -> Self {
5912                 Self {
5913                         a: Clone::clone(&self.a),
5914                         b: Clone::clone(&self.b),
5915                 }
5916         }
5917 }
5918 #[no_mangle]
5919 /// Creates a new tuple which has the same data as `orig`
5920 /// but with all dynamically-allocated buffers duplicated in new buffers.
5921 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
5922 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
5923 #[no_mangle]
5924 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
5925         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
5926 }
5927
5928 #[no_mangle]
5929 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
5930 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
5931 #[repr(C)]
5932 /// The contents of CResult_PaymentSecretAPIErrorZ
5933 pub union CResult_PaymentSecretAPIErrorZPtr {
5934         /// A pointer to the contents in the success state.
5935         /// Reading from this pointer when `result_ok` is not set is undefined.
5936         pub result: *mut crate::c_types::ThirtyTwoBytes,
5937         /// A pointer to the contents in the error state.
5938         /// Reading from this pointer when `result_ok` is set is undefined.
5939         pub err: *mut crate::lightning::util::errors::APIError,
5940 }
5941 #[repr(C)]
5942 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5943 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5945 pub struct CResult_PaymentSecretAPIErrorZ {
5946         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5947         /// `err` or `result` depending on the state of `result_ok`.
5948         pub contents: CResult_PaymentSecretAPIErrorZPtr,
5949         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5950         pub result_ok: bool,
5951 }
5952 #[no_mangle]
5953 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
5954 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
5955         CResult_PaymentSecretAPIErrorZ {
5956                 contents: CResult_PaymentSecretAPIErrorZPtr {
5957                         result: Box::into_raw(Box::new(o)),
5958                 },
5959                 result_ok: true,
5960         }
5961 }
5962 #[no_mangle]
5963 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
5964 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
5965         CResult_PaymentSecretAPIErrorZ {
5966                 contents: CResult_PaymentSecretAPIErrorZPtr {
5967                         err: Box::into_raw(Box::new(e)),
5968                 },
5969                 result_ok: false,
5970         }
5971 }
5972 /// Checks if the given object is currently in the success state
5973 #[no_mangle]
5974 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
5975         o.result_ok
5976 }
5977 #[no_mangle]
5978 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
5979 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
5980 impl Drop for CResult_PaymentSecretAPIErrorZ {
5981         fn drop(&mut self) {
5982                 if self.result_ok {
5983                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5984                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5985                         }
5986                 } else {
5987                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5988                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5989                         }
5990                 }
5991         }
5992 }
5993 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
5994         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5995                 let contents = if o.result_ok {
5996                         let result = unsafe { o.contents.result };
5997                         unsafe { o.contents.result = std::ptr::null_mut() };
5998                         CResult_PaymentSecretAPIErrorZPtr { result }
5999                 } else {
6000                         let err = unsafe { o.contents.err };
6001                         unsafe { o.contents.err = std::ptr::null_mut(); }
6002                         CResult_PaymentSecretAPIErrorZPtr { err }
6003                 };
6004                 Self {
6005                         contents,
6006                         result_ok: o.result_ok,
6007                 }
6008         }
6009 }
6010 impl Clone for CResult_PaymentSecretAPIErrorZ {
6011         fn clone(&self) -> Self {
6012                 if self.result_ok {
6013                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
6014                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6015                         } }
6016                 } else {
6017                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
6018                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6019                         } }
6020                 }
6021         }
6022 }
6023 #[no_mangle]
6024 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
6025 /// but with all dynamically-allocated buffers duplicated in new buffers.
6026 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
6027 #[repr(C)]
6028 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6029 /// This corresponds to std::vector in C++
6030 pub struct CVec_ChannelMonitorZ {
6031         /// The elements in the array.
6032         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6033         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
6034         /// The number of elements pointed to by `data`.
6035         pub datalen: usize
6036 }
6037 impl CVec_ChannelMonitorZ {
6038         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
6039                 if self.datalen == 0 { return Vec::new(); }
6040                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6041                 self.data = std::ptr::null_mut();
6042                 self.datalen = 0;
6043                 ret
6044         }
6045         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
6046                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6047         }
6048 }
6049 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
6050         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
6051                 let datalen = v.len();
6052                 let data = Box::into_raw(v.into_boxed_slice());
6053                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6054         }
6055 }
6056 #[no_mangle]
6057 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6058 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
6059 impl Drop for CVec_ChannelMonitorZ {
6060         fn drop(&mut self) {
6061                 if self.datalen == 0 { return; }
6062                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6063         }
6064 }
6065 #[repr(C)]
6066 /// A tuple of 2 elements. See the individual fields for the types contained.
6067 pub struct C2Tuple_BlockHashChannelManagerZ {
6068         /// The element at position 0
6069         pub a: crate::c_types::ThirtyTwoBytes,
6070         /// The element at position 1
6071         pub b: crate::lightning::ln::channelmanager::ChannelManager,
6072 }
6073 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
6074         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
6075                 Self {
6076                         a: tup.0,
6077                         b: tup.1,
6078                 }
6079         }
6080 }
6081 impl C2Tuple_BlockHashChannelManagerZ {
6082         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
6083                 (self.a, self.b)
6084         }
6085 }
6086 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
6087 #[no_mangle]
6088 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
6089         C2Tuple_BlockHashChannelManagerZ { a, b, }
6090 }
6091
6092 #[no_mangle]
6093 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
6094 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
6095 #[repr(C)]
6096 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6097 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6098         /// A pointer to the contents in the success state.
6099         /// Reading from this pointer when `result_ok` is not set is undefined.
6100         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
6101         /// A pointer to the contents in the error state.
6102         /// Reading from this pointer when `result_ok` is set is undefined.
6103         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6104 }
6105 #[repr(C)]
6106 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6107 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6109 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6110         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6111         /// `err` or `result` depending on the state of `result_ok`.
6112         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
6113         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6114         pub result_ok: bool,
6115 }
6116 #[no_mangle]
6117 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
6118 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6119         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6120                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6121                         result: Box::into_raw(Box::new(o)),
6122                 },
6123                 result_ok: true,
6124         }
6125 }
6126 #[no_mangle]
6127 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
6128 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6129         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6130                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6131                         err: Box::into_raw(Box::new(e)),
6132                 },
6133                 result_ok: false,
6134         }
6135 }
6136 /// Checks if the given object is currently in the success state
6137 #[no_mangle]
6138 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
6139         o.result_ok
6140 }
6141 #[no_mangle]
6142 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
6143 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
6144 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6145         fn drop(&mut self) {
6146                 if self.result_ok {
6147                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6148                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6149                         }
6150                 } else {
6151                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6152                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6153                         }
6154                 }
6155         }
6156 }
6157 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6158         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6159                 let contents = if o.result_ok {
6160                         let result = unsafe { o.contents.result };
6161                         unsafe { o.contents.result = std::ptr::null_mut() };
6162                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
6163                 } else {
6164                         let err = unsafe { o.contents.err };
6165                         unsafe { o.contents.err = std::ptr::null_mut(); }
6166                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
6167                 };
6168                 Self {
6169                         contents,
6170                         result_ok: o.result_ok,
6171                 }
6172         }
6173 }
6174 #[repr(C)]
6175 /// The contents of CResult_ChannelConfigDecodeErrorZ
6176 pub union CResult_ChannelConfigDecodeErrorZPtr {
6177         /// A pointer to the contents in the success state.
6178         /// Reading from this pointer when `result_ok` is not set is undefined.
6179         pub result: *mut crate::lightning::util::config::ChannelConfig,
6180         /// A pointer to the contents in the error state.
6181         /// Reading from this pointer when `result_ok` is set is undefined.
6182         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6183 }
6184 #[repr(C)]
6185 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6186 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6188 pub struct CResult_ChannelConfigDecodeErrorZ {
6189         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6190         /// `err` or `result` depending on the state of `result_ok`.
6191         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
6192         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6193         pub result_ok: bool,
6194 }
6195 #[no_mangle]
6196 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
6197 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
6198         CResult_ChannelConfigDecodeErrorZ {
6199                 contents: CResult_ChannelConfigDecodeErrorZPtr {
6200                         result: Box::into_raw(Box::new(o)),
6201                 },
6202                 result_ok: true,
6203         }
6204 }
6205 #[no_mangle]
6206 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
6207 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
6208         CResult_ChannelConfigDecodeErrorZ {
6209                 contents: CResult_ChannelConfigDecodeErrorZPtr {
6210                         err: Box::into_raw(Box::new(e)),
6211                 },
6212                 result_ok: false,
6213         }
6214 }
6215 /// Checks if the given object is currently in the success state
6216 #[no_mangle]
6217 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
6218         o.result_ok
6219 }
6220 #[no_mangle]
6221 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
6222 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
6223 impl Drop for CResult_ChannelConfigDecodeErrorZ {
6224         fn drop(&mut self) {
6225                 if self.result_ok {
6226                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6227                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6228                         }
6229                 } else {
6230                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6231                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6232                         }
6233                 }
6234         }
6235 }
6236 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
6237         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
6238                 let contents = if o.result_ok {
6239                         let result = unsafe { o.contents.result };
6240                         unsafe { o.contents.result = std::ptr::null_mut() };
6241                         CResult_ChannelConfigDecodeErrorZPtr { result }
6242                 } else {
6243                         let err = unsafe { o.contents.err };
6244                         unsafe { o.contents.err = std::ptr::null_mut(); }
6245                         CResult_ChannelConfigDecodeErrorZPtr { err }
6246                 };
6247                 Self {
6248                         contents,
6249                         result_ok: o.result_ok,
6250                 }
6251         }
6252 }
6253 impl Clone for CResult_ChannelConfigDecodeErrorZ {
6254         fn clone(&self) -> Self {
6255                 if self.result_ok {
6256                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
6257                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
6258                         } }
6259                 } else {
6260                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
6261                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6262                         } }
6263                 }
6264         }
6265 }
6266 #[no_mangle]
6267 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
6268 /// but with all dynamically-allocated buffers duplicated in new buffers.
6269 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
6270 #[repr(C)]
6271 /// The contents of CResult_OutPointDecodeErrorZ
6272 pub union CResult_OutPointDecodeErrorZPtr {
6273         /// A pointer to the contents in the success state.
6274         /// Reading from this pointer when `result_ok` is not set is undefined.
6275         pub result: *mut crate::lightning::chain::transaction::OutPoint,
6276         /// A pointer to the contents in the error state.
6277         /// Reading from this pointer when `result_ok` is set is undefined.
6278         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6279 }
6280 #[repr(C)]
6281 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6282 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6284 pub struct CResult_OutPointDecodeErrorZ {
6285         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6286         /// `err` or `result` depending on the state of `result_ok`.
6287         pub contents: CResult_OutPointDecodeErrorZPtr,
6288         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
6289         pub result_ok: bool,
6290 }
6291 #[no_mangle]
6292 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
6293 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
6294         CResult_OutPointDecodeErrorZ {
6295                 contents: CResult_OutPointDecodeErrorZPtr {
6296                         result: Box::into_raw(Box::new(o)),
6297                 },
6298                 result_ok: true,
6299         }
6300 }
6301 #[no_mangle]
6302 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
6303 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
6304         CResult_OutPointDecodeErrorZ {
6305                 contents: CResult_OutPointDecodeErrorZPtr {
6306                         err: Box::into_raw(Box::new(e)),
6307                 },
6308                 result_ok: false,
6309         }
6310 }
6311 /// Checks if the given object is currently in the success state
6312 #[no_mangle]
6313 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
6314         o.result_ok
6315 }
6316 #[no_mangle]
6317 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
6318 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
6319 impl Drop for CResult_OutPointDecodeErrorZ {
6320         fn drop(&mut self) {
6321                 if self.result_ok {
6322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6324                         }
6325                 } else {
6326                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6327                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6328                         }
6329                 }
6330         }
6331 }
6332 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
6333         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
6334                 let contents = if o.result_ok {
6335                         let result = unsafe { o.contents.result };
6336                         unsafe { o.contents.result = std::ptr::null_mut() };
6337                         CResult_OutPointDecodeErrorZPtr { result }
6338                 } else {
6339                         let err = unsafe { o.contents.err };
6340                         unsafe { o.contents.err = std::ptr::null_mut(); }
6341                         CResult_OutPointDecodeErrorZPtr { err }
6342                 };
6343                 Self {
6344                         contents,
6345                         result_ok: o.result_ok,
6346                 }
6347         }
6348 }
6349 impl Clone for CResult_OutPointDecodeErrorZ {
6350         fn clone(&self) -> Self {
6351                 if self.result_ok {
6352                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
6353                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
6354                         } }
6355                 } else {
6356                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
6357                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6358                         } }
6359                 }
6360         }
6361 }
6362 #[no_mangle]
6363 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
6364 /// but with all dynamically-allocated buffers duplicated in new buffers.
6365 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
6366 #[repr(C)]
6367 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
6368 pub enum COption_TypeZ {
6369         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6370         Some(crate::lightning::ln::wire::Type),
6371         /// When we're in this state, this COption_TypeZ contains nothing
6372         None
6373 }
6374 impl COption_TypeZ {
6375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6376                 if let Self::Some(_) = self { true } else { false }
6377         }
6378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6379                 !self.is_some()
6380         }
6381         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
6382                 if let Self::Some(v) = self { v } else { unreachable!() }
6383         }
6384 }
6385 #[no_mangle]
6386 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
6387 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
6388         COption_TypeZ::Some(o)
6389 }
6390 #[no_mangle]
6391 /// Constructs a new COption_TypeZ containing nothing
6392 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
6393         COption_TypeZ::None
6394 }
6395 #[no_mangle]
6396 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
6397 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
6398 #[repr(C)]
6399 /// The contents of CResult_COption_TypeZDecodeErrorZ
6400 pub union CResult_COption_TypeZDecodeErrorZPtr {
6401         /// A pointer to the contents in the success state.
6402         /// Reading from this pointer when `result_ok` is not set is undefined.
6403         pub result: *mut crate::c_types::derived::COption_TypeZ,
6404         /// A pointer to the contents in the error state.
6405         /// Reading from this pointer when `result_ok` is set is undefined.
6406         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6407 }
6408 #[repr(C)]
6409 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6410 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6411 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6412 pub struct CResult_COption_TypeZDecodeErrorZ {
6413         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6414         /// `err` or `result` depending on the state of `result_ok`.
6415         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
6416         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6417         pub result_ok: bool,
6418 }
6419 #[no_mangle]
6420 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
6421 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
6422         CResult_COption_TypeZDecodeErrorZ {
6423                 contents: CResult_COption_TypeZDecodeErrorZPtr {
6424                         result: Box::into_raw(Box::new(o)),
6425                 },
6426                 result_ok: true,
6427         }
6428 }
6429 #[no_mangle]
6430 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
6431 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
6432         CResult_COption_TypeZDecodeErrorZ {
6433                 contents: CResult_COption_TypeZDecodeErrorZPtr {
6434                         err: Box::into_raw(Box::new(e)),
6435                 },
6436                 result_ok: false,
6437         }
6438 }
6439 /// Checks if the given object is currently in the success state
6440 #[no_mangle]
6441 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
6442         o.result_ok
6443 }
6444 #[no_mangle]
6445 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
6446 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
6447 impl Drop for CResult_COption_TypeZDecodeErrorZ {
6448         fn drop(&mut self) {
6449                 if self.result_ok {
6450                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6451                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6452                         }
6453                 } else {
6454                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6455                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6456                         }
6457                 }
6458         }
6459 }
6460 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
6461         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6462                 let contents = if o.result_ok {
6463                         let result = unsafe { o.contents.result };
6464                         unsafe { o.contents.result = std::ptr::null_mut() };
6465                         CResult_COption_TypeZDecodeErrorZPtr { result }
6466                 } else {
6467                         let err = unsafe { o.contents.err };
6468                         unsafe { o.contents.err = std::ptr::null_mut(); }
6469                         CResult_COption_TypeZDecodeErrorZPtr { err }
6470                 };
6471                 Self {
6472                         contents,
6473                         result_ok: o.result_ok,
6474                 }
6475         }
6476 }
6477 #[repr(C)]
6478 /// The contents of CResult_PaymentIdPaymentErrorZ
6479 pub union CResult_PaymentIdPaymentErrorZPtr {
6480         /// A pointer to the contents in the success state.
6481         /// Reading from this pointer when `result_ok` is not set is undefined.
6482         pub result: *mut crate::c_types::ThirtyTwoBytes,
6483         /// A pointer to the contents in the error state.
6484         /// Reading from this pointer when `result_ok` is set is undefined.
6485         pub err: *mut crate::lightning_invoice::payment::PaymentError,
6486 }
6487 #[repr(C)]
6488 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6489 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
6490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6491 pub struct CResult_PaymentIdPaymentErrorZ {
6492         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
6493         /// `err` or `result` depending on the state of `result_ok`.
6494         pub contents: CResult_PaymentIdPaymentErrorZPtr,
6495         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
6496         pub result_ok: bool,
6497 }
6498 #[no_mangle]
6499 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
6500 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
6501         CResult_PaymentIdPaymentErrorZ {
6502                 contents: CResult_PaymentIdPaymentErrorZPtr {
6503                         result: Box::into_raw(Box::new(o)),
6504                 },
6505                 result_ok: true,
6506         }
6507 }
6508 #[no_mangle]
6509 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
6510 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
6511         CResult_PaymentIdPaymentErrorZ {
6512                 contents: CResult_PaymentIdPaymentErrorZPtr {
6513                         err: Box::into_raw(Box::new(e)),
6514                 },
6515                 result_ok: false,
6516         }
6517 }
6518 /// Checks if the given object is currently in the success state
6519 #[no_mangle]
6520 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
6521         o.result_ok
6522 }
6523 #[no_mangle]
6524 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
6525 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
6526 impl Drop for CResult_PaymentIdPaymentErrorZ {
6527         fn drop(&mut self) {
6528                 if self.result_ok {
6529                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6530                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6531                         }
6532                 } else {
6533                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6534                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6535                         }
6536                 }
6537         }
6538 }
6539 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
6540         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
6541                 let contents = if o.result_ok {
6542                         let result = unsafe { o.contents.result };
6543                         unsafe { o.contents.result = std::ptr::null_mut() };
6544                         CResult_PaymentIdPaymentErrorZPtr { result }
6545                 } else {
6546                         let err = unsafe { o.contents.err };
6547                         unsafe { o.contents.err = std::ptr::null_mut(); }
6548                         CResult_PaymentIdPaymentErrorZPtr { err }
6549                 };
6550                 Self {
6551                         contents,
6552                         result_ok: o.result_ok,
6553                 }
6554         }
6555 }
6556 impl Clone for CResult_PaymentIdPaymentErrorZ {
6557         fn clone(&self) -> Self {
6558                 if self.result_ok {
6559                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
6560                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6561                         } }
6562                 } else {
6563                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
6564                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
6565                         } }
6566                 }
6567         }
6568 }
6569 #[no_mangle]
6570 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
6571 /// but with all dynamically-allocated buffers duplicated in new buffers.
6572 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
6573 #[repr(C)]
6574 /// The contents of CResult_SiPrefixNoneZ
6575 pub union CResult_SiPrefixNoneZPtr {
6576         /// A pointer to the contents in the success state.
6577         /// Reading from this pointer when `result_ok` is not set is undefined.
6578         pub result: *mut crate::lightning_invoice::SiPrefix,
6579         /// Note that this value is always NULL, as there are no contents in the Err variant
6580         pub err: *mut std::ffi::c_void,
6581 }
6582 #[repr(C)]
6583 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
6584 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
6585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6586 pub struct CResult_SiPrefixNoneZ {
6587         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
6588         /// `err` or `result` depending on the state of `result_ok`.
6589         pub contents: CResult_SiPrefixNoneZPtr,
6590         /// Whether this CResult_SiPrefixNoneZ represents a success state.
6591         pub result_ok: bool,
6592 }
6593 #[no_mangle]
6594 /// Creates a new CResult_SiPrefixNoneZ in the success state.
6595 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
6596         CResult_SiPrefixNoneZ {
6597                 contents: CResult_SiPrefixNoneZPtr {
6598                         result: Box::into_raw(Box::new(o)),
6599                 },
6600                 result_ok: true,
6601         }
6602 }
6603 #[no_mangle]
6604 /// Creates a new CResult_SiPrefixNoneZ in the error state.
6605 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
6606         CResult_SiPrefixNoneZ {
6607                 contents: CResult_SiPrefixNoneZPtr {
6608                         err: std::ptr::null_mut(),
6609                 },
6610                 result_ok: false,
6611         }
6612 }
6613 /// Checks if the given object is currently in the success state
6614 #[no_mangle]
6615 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
6616         o.result_ok
6617 }
6618 #[no_mangle]
6619 /// Frees any resources used by the CResult_SiPrefixNoneZ.
6620 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
6621 impl Drop for CResult_SiPrefixNoneZ {
6622         fn drop(&mut self) {
6623                 if self.result_ok {
6624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6626                         }
6627                 } else {
6628                 }
6629         }
6630 }
6631 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
6632         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
6633                 let contents = if o.result_ok {
6634                         let result = unsafe { o.contents.result };
6635                         unsafe { o.contents.result = std::ptr::null_mut() };
6636                         CResult_SiPrefixNoneZPtr { result }
6637                 } else {
6638                         let _ = unsafe { Box::from_raw(o.contents.err) };
6639                         o.contents.err = std::ptr::null_mut();
6640                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
6641                 };
6642                 Self {
6643                         contents,
6644                         result_ok: o.result_ok,
6645                 }
6646         }
6647 }
6648 impl Clone for CResult_SiPrefixNoneZ {
6649         fn clone(&self) -> Self {
6650                 if self.result_ok {
6651                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
6652                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
6653                         } }
6654                 } else {
6655                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
6656                                 err: std::ptr::null_mut()
6657                         } }
6658                 }
6659         }
6660 }
6661 #[no_mangle]
6662 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
6663 /// but with all dynamically-allocated buffers duplicated in new buffers.
6664 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
6665 #[repr(C)]
6666 /// The contents of CResult_InvoiceNoneZ
6667 pub union CResult_InvoiceNoneZPtr {
6668         /// A pointer to the contents in the success state.
6669         /// Reading from this pointer when `result_ok` is not set is undefined.
6670         pub result: *mut crate::lightning_invoice::Invoice,
6671         /// Note that this value is always NULL, as there are no contents in the Err variant
6672         pub err: *mut std::ffi::c_void,
6673 }
6674 #[repr(C)]
6675 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
6676 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
6677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6678 pub struct CResult_InvoiceNoneZ {
6679         /// The contents of this CResult_InvoiceNoneZ, accessible via either
6680         /// `err` or `result` depending on the state of `result_ok`.
6681         pub contents: CResult_InvoiceNoneZPtr,
6682         /// Whether this CResult_InvoiceNoneZ represents a success state.
6683         pub result_ok: bool,
6684 }
6685 #[no_mangle]
6686 /// Creates a new CResult_InvoiceNoneZ in the success state.
6687 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
6688         CResult_InvoiceNoneZ {
6689                 contents: CResult_InvoiceNoneZPtr {
6690                         result: Box::into_raw(Box::new(o)),
6691                 },
6692                 result_ok: true,
6693         }
6694 }
6695 #[no_mangle]
6696 /// Creates a new CResult_InvoiceNoneZ in the error state.
6697 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
6698         CResult_InvoiceNoneZ {
6699                 contents: CResult_InvoiceNoneZPtr {
6700                         err: std::ptr::null_mut(),
6701                 },
6702                 result_ok: false,
6703         }
6704 }
6705 /// Checks if the given object is currently in the success state
6706 #[no_mangle]
6707 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
6708         o.result_ok
6709 }
6710 #[no_mangle]
6711 /// Frees any resources used by the CResult_InvoiceNoneZ.
6712 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
6713 impl Drop for CResult_InvoiceNoneZ {
6714         fn drop(&mut self) {
6715                 if self.result_ok {
6716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6718                         }
6719                 } else {
6720                 }
6721         }
6722 }
6723 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
6724         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
6725                 let contents = if o.result_ok {
6726                         let result = unsafe { o.contents.result };
6727                         unsafe { o.contents.result = std::ptr::null_mut() };
6728                         CResult_InvoiceNoneZPtr { result }
6729                 } else {
6730                         let _ = unsafe { Box::from_raw(o.contents.err) };
6731                         o.contents.err = std::ptr::null_mut();
6732                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
6733                 };
6734                 Self {
6735                         contents,
6736                         result_ok: o.result_ok,
6737                 }
6738         }
6739 }
6740 impl Clone for CResult_InvoiceNoneZ {
6741         fn clone(&self) -> Self {
6742                 if self.result_ok {
6743                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
6744                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
6745                         } }
6746                 } else {
6747                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
6748                                 err: std::ptr::null_mut()
6749                         } }
6750                 }
6751         }
6752 }
6753 #[no_mangle]
6754 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
6755 /// but with all dynamically-allocated buffers duplicated in new buffers.
6756 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
6757 #[repr(C)]
6758 /// The contents of CResult_SignedRawInvoiceNoneZ
6759 pub union CResult_SignedRawInvoiceNoneZPtr {
6760         /// A pointer to the contents in the success state.
6761         /// Reading from this pointer when `result_ok` is not set is undefined.
6762         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
6763         /// Note that this value is always NULL, as there are no contents in the Err variant
6764         pub err: *mut std::ffi::c_void,
6765 }
6766 #[repr(C)]
6767 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6768 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6769 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6770 pub struct CResult_SignedRawInvoiceNoneZ {
6771         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6772         /// `err` or `result` depending on the state of `result_ok`.
6773         pub contents: CResult_SignedRawInvoiceNoneZPtr,
6774         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6775         pub result_ok: bool,
6776 }
6777 #[no_mangle]
6778 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
6779 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
6780         CResult_SignedRawInvoiceNoneZ {
6781                 contents: CResult_SignedRawInvoiceNoneZPtr {
6782                         result: Box::into_raw(Box::new(o)),
6783                 },
6784                 result_ok: true,
6785         }
6786 }
6787 #[no_mangle]
6788 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
6789 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
6790         CResult_SignedRawInvoiceNoneZ {
6791                 contents: CResult_SignedRawInvoiceNoneZPtr {
6792                         err: std::ptr::null_mut(),
6793                 },
6794                 result_ok: false,
6795         }
6796 }
6797 /// Checks if the given object is currently in the success state
6798 #[no_mangle]
6799 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
6800         o.result_ok
6801 }
6802 #[no_mangle]
6803 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
6804 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
6805 impl Drop for CResult_SignedRawInvoiceNoneZ {
6806         fn drop(&mut self) {
6807                 if self.result_ok {
6808                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6809                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6810                         }
6811                 } else {
6812                 }
6813         }
6814 }
6815 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
6816         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
6817                 let contents = if o.result_ok {
6818                         let result = unsafe { o.contents.result };
6819                         unsafe { o.contents.result = std::ptr::null_mut() };
6820                         CResult_SignedRawInvoiceNoneZPtr { result }
6821                 } else {
6822                         let _ = unsafe { Box::from_raw(o.contents.err) };
6823                         o.contents.err = std::ptr::null_mut();
6824                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
6825                 };
6826                 Self {
6827                         contents,
6828                         result_ok: o.result_ok,
6829                 }
6830         }
6831 }
6832 impl Clone for CResult_SignedRawInvoiceNoneZ {
6833         fn clone(&self) -> Self {
6834                 if self.result_ok {
6835                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
6836                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
6837                         } }
6838                 } else {
6839                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
6840                                 err: std::ptr::null_mut()
6841                         } }
6842                 }
6843         }
6844 }
6845 #[no_mangle]
6846 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
6847 /// but with all dynamically-allocated buffers duplicated in new buffers.
6848 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
6849 #[repr(C)]
6850 /// A tuple of 3 elements. See the individual fields for the types contained.
6851 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6852         /// The element at position 0
6853         pub a: crate::lightning_invoice::RawInvoice,
6854         /// The element at position 1
6855         pub b: crate::c_types::ThirtyTwoBytes,
6856         /// The element at position 2
6857         pub c: crate::lightning_invoice::InvoiceSignature,
6858 }
6859 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6860         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
6861                 Self {
6862                         a: tup.0,
6863                         b: tup.1,
6864                         c: tup.2,
6865                 }
6866         }
6867 }
6868 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6869         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
6870                 (self.a, self.b, self.c)
6871         }
6872 }
6873 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
6874         fn clone(&self) -> Self {
6875                 Self {
6876                         a: Clone::clone(&self.a),
6877                         b: Clone::clone(&self.b),
6878                         c: Clone::clone(&self.c),
6879                 }
6880         }
6881 }
6882 #[no_mangle]
6883 /// Creates a new tuple which has the same data as `orig`
6884 /// but with all dynamically-allocated buffers duplicated in new buffers.
6885 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
6886 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
6887 #[no_mangle]
6888 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 {
6889         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
6890 }
6891
6892 #[no_mangle]
6893 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
6894 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
6895 #[repr(C)]
6896 /// The contents of CResult_PayeePubKeyErrorZ
6897 pub union CResult_PayeePubKeyErrorZPtr {
6898         /// A pointer to the contents in the success state.
6899         /// Reading from this pointer when `result_ok` is not set is undefined.
6900         pub result: *mut crate::lightning_invoice::PayeePubKey,
6901         /// A pointer to the contents in the error state.
6902         /// Reading from this pointer when `result_ok` is set is undefined.
6903         pub err: *mut crate::c_types::Secp256k1Error,
6904 }
6905 #[repr(C)]
6906 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6907 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6908 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6909 pub struct CResult_PayeePubKeyErrorZ {
6910         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6911         /// `err` or `result` depending on the state of `result_ok`.
6912         pub contents: CResult_PayeePubKeyErrorZPtr,
6913         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
6914         pub result_ok: bool,
6915 }
6916 #[no_mangle]
6917 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
6918 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
6919         CResult_PayeePubKeyErrorZ {
6920                 contents: CResult_PayeePubKeyErrorZPtr {
6921                         result: Box::into_raw(Box::new(o)),
6922                 },
6923                 result_ok: true,
6924         }
6925 }
6926 #[no_mangle]
6927 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
6928 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
6929         CResult_PayeePubKeyErrorZ {
6930                 contents: CResult_PayeePubKeyErrorZPtr {
6931                         err: Box::into_raw(Box::new(e)),
6932                 },
6933                 result_ok: false,
6934         }
6935 }
6936 /// Checks if the given object is currently in the success state
6937 #[no_mangle]
6938 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
6939         o.result_ok
6940 }
6941 #[no_mangle]
6942 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
6943 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
6944 impl Drop for CResult_PayeePubKeyErrorZ {
6945         fn drop(&mut self) {
6946                 if self.result_ok {
6947                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6948                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6949                         }
6950                 } else {
6951                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6952                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6953                         }
6954                 }
6955         }
6956 }
6957 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
6958         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
6959                 let contents = if o.result_ok {
6960                         let result = unsafe { o.contents.result };
6961                         unsafe { o.contents.result = std::ptr::null_mut() };
6962                         CResult_PayeePubKeyErrorZPtr { result }
6963                 } else {
6964                         let err = unsafe { o.contents.err };
6965                         unsafe { o.contents.err = std::ptr::null_mut(); }
6966                         CResult_PayeePubKeyErrorZPtr { err }
6967                 };
6968                 Self {
6969                         contents,
6970                         result_ok: o.result_ok,
6971                 }
6972         }
6973 }
6974 impl Clone for CResult_PayeePubKeyErrorZ {
6975         fn clone(&self) -> Self {
6976                 if self.result_ok {
6977                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
6978                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
6979                         } }
6980                 } else {
6981                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
6982                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6983                         } }
6984                 }
6985         }
6986 }
6987 #[no_mangle]
6988 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
6989 /// but with all dynamically-allocated buffers duplicated in new buffers.
6990 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
6991 #[repr(C)]
6992 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6993 /// This corresponds to std::vector in C++
6994 pub struct CVec_PrivateRouteZ {
6995         /// The elements in the array.
6996         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6997         pub data: *mut crate::lightning_invoice::PrivateRoute,
6998         /// The number of elements pointed to by `data`.
6999         pub datalen: usize
7000 }
7001 impl CVec_PrivateRouteZ {
7002         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
7003                 if self.datalen == 0 { return Vec::new(); }
7004                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7005                 self.data = std::ptr::null_mut();
7006                 self.datalen = 0;
7007                 ret
7008         }
7009         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
7010                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7011         }
7012 }
7013 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
7014         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
7015                 let datalen = v.len();
7016                 let data = Box::into_raw(v.into_boxed_slice());
7017                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7018         }
7019 }
7020 #[no_mangle]
7021 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7022 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
7023 impl Drop for CVec_PrivateRouteZ {
7024         fn drop(&mut self) {
7025                 if self.datalen == 0 { return; }
7026                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7027         }
7028 }
7029 impl Clone for CVec_PrivateRouteZ {
7030         fn clone(&self) -> Self {
7031                 let mut res = Vec::new();
7032                 if self.datalen == 0 { return Self::from(res); }
7033                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7034                 Self::from(res)
7035         }
7036 }
7037 #[repr(C)]
7038 /// The contents of CResult_PositiveTimestampCreationErrorZ
7039 pub union CResult_PositiveTimestampCreationErrorZPtr {
7040         /// A pointer to the contents in the success state.
7041         /// Reading from this pointer when `result_ok` is not set is undefined.
7042         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
7043         /// A pointer to the contents in the error state.
7044         /// Reading from this pointer when `result_ok` is set is undefined.
7045         pub err: *mut crate::lightning_invoice::CreationError,
7046 }
7047 #[repr(C)]
7048 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7049 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7051 pub struct CResult_PositiveTimestampCreationErrorZ {
7052         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7053         /// `err` or `result` depending on the state of `result_ok`.
7054         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
7055         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7056         pub result_ok: bool,
7057 }
7058 #[no_mangle]
7059 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
7060 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
7061         CResult_PositiveTimestampCreationErrorZ {
7062                 contents: CResult_PositiveTimestampCreationErrorZPtr {
7063                         result: Box::into_raw(Box::new(o)),
7064                 },
7065                 result_ok: true,
7066         }
7067 }
7068 #[no_mangle]
7069 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
7070 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
7071         CResult_PositiveTimestampCreationErrorZ {
7072                 contents: CResult_PositiveTimestampCreationErrorZPtr {
7073                         err: Box::into_raw(Box::new(e)),
7074                 },
7075                 result_ok: false,
7076         }
7077 }
7078 /// Checks if the given object is currently in the success state
7079 #[no_mangle]
7080 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
7081         o.result_ok
7082 }
7083 #[no_mangle]
7084 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
7085 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
7086 impl Drop for CResult_PositiveTimestampCreationErrorZ {
7087         fn drop(&mut self) {
7088                 if self.result_ok {
7089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7091                         }
7092                 } else {
7093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7095                         }
7096                 }
7097         }
7098 }
7099 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
7100         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
7101                 let contents = if o.result_ok {
7102                         let result = unsafe { o.contents.result };
7103                         unsafe { o.contents.result = std::ptr::null_mut() };
7104                         CResult_PositiveTimestampCreationErrorZPtr { result }
7105                 } else {
7106                         let err = unsafe { o.contents.err };
7107                         unsafe { o.contents.err = std::ptr::null_mut(); }
7108                         CResult_PositiveTimestampCreationErrorZPtr { err }
7109                 };
7110                 Self {
7111                         contents,
7112                         result_ok: o.result_ok,
7113                 }
7114         }
7115 }
7116 impl Clone for CResult_PositiveTimestampCreationErrorZ {
7117         fn clone(&self) -> Self {
7118                 if self.result_ok {
7119                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
7120                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
7121                         } }
7122                 } else {
7123                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
7124                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7125                         } }
7126                 }
7127         }
7128 }
7129 #[no_mangle]
7130 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
7131 /// but with all dynamically-allocated buffers duplicated in new buffers.
7132 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
7133 #[repr(C)]
7134 /// The contents of CResult_NoneSemanticErrorZ
7135 pub union CResult_NoneSemanticErrorZPtr {
7136         /// Note that this value is always NULL, as there are no contents in the OK variant
7137         pub result: *mut std::ffi::c_void,
7138         /// A pointer to the contents in the error state.
7139         /// Reading from this pointer when `result_ok` is set is undefined.
7140         pub err: *mut crate::lightning_invoice::SemanticError,
7141 }
7142 #[repr(C)]
7143 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7144 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7145 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7146 pub struct CResult_NoneSemanticErrorZ {
7147         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
7148         /// `err` or `result` depending on the state of `result_ok`.
7149         pub contents: CResult_NoneSemanticErrorZPtr,
7150         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
7151         pub result_ok: bool,
7152 }
7153 #[no_mangle]
7154 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
7155 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
7156         CResult_NoneSemanticErrorZ {
7157                 contents: CResult_NoneSemanticErrorZPtr {
7158                         result: std::ptr::null_mut(),
7159                 },
7160                 result_ok: true,
7161         }
7162 }
7163 #[no_mangle]
7164 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
7165 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
7166         CResult_NoneSemanticErrorZ {
7167                 contents: CResult_NoneSemanticErrorZPtr {
7168                         err: Box::into_raw(Box::new(e)),
7169                 },
7170                 result_ok: false,
7171         }
7172 }
7173 /// Checks if the given object is currently in the success state
7174 #[no_mangle]
7175 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
7176         o.result_ok
7177 }
7178 #[no_mangle]
7179 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
7180 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
7181 impl Drop for CResult_NoneSemanticErrorZ {
7182         fn drop(&mut self) {
7183                 if self.result_ok {
7184                 } else {
7185                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7186                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7187                         }
7188                 }
7189         }
7190 }
7191 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
7192         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
7193                 let contents = if o.result_ok {
7194                         let _ = unsafe { Box::from_raw(o.contents.result) };
7195                         o.contents.result = std::ptr::null_mut();
7196                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
7197                 } else {
7198                         let err = unsafe { o.contents.err };
7199                         unsafe { o.contents.err = std::ptr::null_mut(); }
7200                         CResult_NoneSemanticErrorZPtr { err }
7201                 };
7202                 Self {
7203                         contents,
7204                         result_ok: o.result_ok,
7205                 }
7206         }
7207 }
7208 impl Clone for CResult_NoneSemanticErrorZ {
7209         fn clone(&self) -> Self {
7210                 if self.result_ok {
7211                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
7212                                 result: std::ptr::null_mut()
7213                         } }
7214                 } else {
7215                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
7216                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7217                         } }
7218                 }
7219         }
7220 }
7221 #[no_mangle]
7222 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
7223 /// but with all dynamically-allocated buffers duplicated in new buffers.
7224 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
7225 #[repr(C)]
7226 /// The contents of CResult_InvoiceSemanticErrorZ
7227 pub union CResult_InvoiceSemanticErrorZPtr {
7228         /// A pointer to the contents in the success state.
7229         /// Reading from this pointer when `result_ok` is not set is undefined.
7230         pub result: *mut crate::lightning_invoice::Invoice,
7231         /// A pointer to the contents in the error state.
7232         /// Reading from this pointer when `result_ok` is set is undefined.
7233         pub err: *mut crate::lightning_invoice::SemanticError,
7234 }
7235 #[repr(C)]
7236 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7237 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7239 pub struct CResult_InvoiceSemanticErrorZ {
7240         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7241         /// `err` or `result` depending on the state of `result_ok`.
7242         pub contents: CResult_InvoiceSemanticErrorZPtr,
7243         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7244         pub result_ok: bool,
7245 }
7246 #[no_mangle]
7247 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
7248 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
7249         CResult_InvoiceSemanticErrorZ {
7250                 contents: CResult_InvoiceSemanticErrorZPtr {
7251                         result: Box::into_raw(Box::new(o)),
7252                 },
7253                 result_ok: true,
7254         }
7255 }
7256 #[no_mangle]
7257 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
7258 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
7259         CResult_InvoiceSemanticErrorZ {
7260                 contents: CResult_InvoiceSemanticErrorZPtr {
7261                         err: Box::into_raw(Box::new(e)),
7262                 },
7263                 result_ok: false,
7264         }
7265 }
7266 /// Checks if the given object is currently in the success state
7267 #[no_mangle]
7268 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
7269         o.result_ok
7270 }
7271 #[no_mangle]
7272 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
7273 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
7274 impl Drop for CResult_InvoiceSemanticErrorZ {
7275         fn drop(&mut self) {
7276                 if self.result_ok {
7277                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7278                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7279                         }
7280                 } else {
7281                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7282                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7283                         }
7284                 }
7285         }
7286 }
7287 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
7288         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
7289                 let contents = if o.result_ok {
7290                         let result = unsafe { o.contents.result };
7291                         unsafe { o.contents.result = std::ptr::null_mut() };
7292                         CResult_InvoiceSemanticErrorZPtr { result }
7293                 } else {
7294                         let err = unsafe { o.contents.err };
7295                         unsafe { o.contents.err = std::ptr::null_mut(); }
7296                         CResult_InvoiceSemanticErrorZPtr { err }
7297                 };
7298                 Self {
7299                         contents,
7300                         result_ok: o.result_ok,
7301                 }
7302         }
7303 }
7304 impl Clone for CResult_InvoiceSemanticErrorZ {
7305         fn clone(&self) -> Self {
7306                 if self.result_ok {
7307                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
7308                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7309                         } }
7310                 } else {
7311                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
7312                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7313                         } }
7314                 }
7315         }
7316 }
7317 #[no_mangle]
7318 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
7319 /// but with all dynamically-allocated buffers duplicated in new buffers.
7320 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
7321 #[repr(C)]
7322 /// The contents of CResult_DescriptionCreationErrorZ
7323 pub union CResult_DescriptionCreationErrorZPtr {
7324         /// A pointer to the contents in the success state.
7325         /// Reading from this pointer when `result_ok` is not set is undefined.
7326         pub result: *mut crate::lightning_invoice::Description,
7327         /// A pointer to the contents in the error state.
7328         /// Reading from this pointer when `result_ok` is set is undefined.
7329         pub err: *mut crate::lightning_invoice::CreationError,
7330 }
7331 #[repr(C)]
7332 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7333 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7335 pub struct CResult_DescriptionCreationErrorZ {
7336         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7337         /// `err` or `result` depending on the state of `result_ok`.
7338         pub contents: CResult_DescriptionCreationErrorZPtr,
7339         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
7340         pub result_ok: bool,
7341 }
7342 #[no_mangle]
7343 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
7344 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
7345         CResult_DescriptionCreationErrorZ {
7346                 contents: CResult_DescriptionCreationErrorZPtr {
7347                         result: Box::into_raw(Box::new(o)),
7348                 },
7349                 result_ok: true,
7350         }
7351 }
7352 #[no_mangle]
7353 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
7354 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
7355         CResult_DescriptionCreationErrorZ {
7356                 contents: CResult_DescriptionCreationErrorZPtr {
7357                         err: Box::into_raw(Box::new(e)),
7358                 },
7359                 result_ok: false,
7360         }
7361 }
7362 /// Checks if the given object is currently in the success state
7363 #[no_mangle]
7364 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
7365         o.result_ok
7366 }
7367 #[no_mangle]
7368 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
7369 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
7370 impl Drop for CResult_DescriptionCreationErrorZ {
7371         fn drop(&mut self) {
7372                 if self.result_ok {
7373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7375                         }
7376                 } else {
7377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7379                         }
7380                 }
7381         }
7382 }
7383 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
7384         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
7385                 let contents = if o.result_ok {
7386                         let result = unsafe { o.contents.result };
7387                         unsafe { o.contents.result = std::ptr::null_mut() };
7388                         CResult_DescriptionCreationErrorZPtr { result }
7389                 } else {
7390                         let err = unsafe { o.contents.err };
7391                         unsafe { o.contents.err = std::ptr::null_mut(); }
7392                         CResult_DescriptionCreationErrorZPtr { err }
7393                 };
7394                 Self {
7395                         contents,
7396                         result_ok: o.result_ok,
7397                 }
7398         }
7399 }
7400 impl Clone for CResult_DescriptionCreationErrorZ {
7401         fn clone(&self) -> Self {
7402                 if self.result_ok {
7403                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
7404                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
7405                         } }
7406                 } else {
7407                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
7408                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7409                         } }
7410                 }
7411         }
7412 }
7413 #[no_mangle]
7414 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
7415 /// but with all dynamically-allocated buffers duplicated in new buffers.
7416 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
7417 #[repr(C)]
7418 /// The contents of CResult_ExpiryTimeCreationErrorZ
7419 pub union CResult_ExpiryTimeCreationErrorZPtr {
7420         /// A pointer to the contents in the success state.
7421         /// Reading from this pointer when `result_ok` is not set is undefined.
7422         pub result: *mut crate::lightning_invoice::ExpiryTime,
7423         /// A pointer to the contents in the error state.
7424         /// Reading from this pointer when `result_ok` is set is undefined.
7425         pub err: *mut crate::lightning_invoice::CreationError,
7426 }
7427 #[repr(C)]
7428 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
7429 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
7430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7431 pub struct CResult_ExpiryTimeCreationErrorZ {
7432         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
7433         /// `err` or `result` depending on the state of `result_ok`.
7434         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
7435         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
7436         pub result_ok: bool,
7437 }
7438 #[no_mangle]
7439 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
7440 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
7441         CResult_ExpiryTimeCreationErrorZ {
7442                 contents: CResult_ExpiryTimeCreationErrorZPtr {
7443                         result: Box::into_raw(Box::new(o)),
7444                 },
7445                 result_ok: true,
7446         }
7447 }
7448 #[no_mangle]
7449 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
7450 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
7451         CResult_ExpiryTimeCreationErrorZ {
7452                 contents: CResult_ExpiryTimeCreationErrorZPtr {
7453                         err: Box::into_raw(Box::new(e)),
7454                 },
7455                 result_ok: false,
7456         }
7457 }
7458 /// Checks if the given object is currently in the success state
7459 #[no_mangle]
7460 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_is_ok(o: &CResult_ExpiryTimeCreationErrorZ) -> bool {
7461         o.result_ok
7462 }
7463 #[no_mangle]
7464 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
7465 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
7466 impl Drop for CResult_ExpiryTimeCreationErrorZ {
7467         fn drop(&mut self) {
7468                 if self.result_ok {
7469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7471                         }
7472                 } else {
7473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7475                         }
7476                 }
7477         }
7478 }
7479 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
7480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
7481                 let contents = if o.result_ok {
7482                         let result = unsafe { o.contents.result };
7483                         unsafe { o.contents.result = std::ptr::null_mut() };
7484                         CResult_ExpiryTimeCreationErrorZPtr { result }
7485                 } else {
7486                         let err = unsafe { o.contents.err };
7487                         unsafe { o.contents.err = std::ptr::null_mut(); }
7488                         CResult_ExpiryTimeCreationErrorZPtr { err }
7489                 };
7490                 Self {
7491                         contents,
7492                         result_ok: o.result_ok,
7493                 }
7494         }
7495 }
7496 impl Clone for CResult_ExpiryTimeCreationErrorZ {
7497         fn clone(&self) -> Self {
7498                 if self.result_ok {
7499                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
7500                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
7501                         } }
7502                 } else {
7503                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
7504                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7505                         } }
7506                 }
7507         }
7508 }
7509 #[no_mangle]
7510 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
7511 /// but with all dynamically-allocated buffers duplicated in new buffers.
7512 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
7513 #[repr(C)]
7514 /// The contents of CResult_PrivateRouteCreationErrorZ
7515 pub union CResult_PrivateRouteCreationErrorZPtr {
7516         /// A pointer to the contents in the success state.
7517         /// Reading from this pointer when `result_ok` is not set is undefined.
7518         pub result: *mut crate::lightning_invoice::PrivateRoute,
7519         /// A pointer to the contents in the error state.
7520         /// Reading from this pointer when `result_ok` is set is undefined.
7521         pub err: *mut crate::lightning_invoice::CreationError,
7522 }
7523 #[repr(C)]
7524 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
7525 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
7526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7527 pub struct CResult_PrivateRouteCreationErrorZ {
7528         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
7529         /// `err` or `result` depending on the state of `result_ok`.
7530         pub contents: CResult_PrivateRouteCreationErrorZPtr,
7531         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
7532         pub result_ok: bool,
7533 }
7534 #[no_mangle]
7535 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
7536 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
7537         CResult_PrivateRouteCreationErrorZ {
7538                 contents: CResult_PrivateRouteCreationErrorZPtr {
7539                         result: Box::into_raw(Box::new(o)),
7540                 },
7541                 result_ok: true,
7542         }
7543 }
7544 #[no_mangle]
7545 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
7546 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
7547         CResult_PrivateRouteCreationErrorZ {
7548                 contents: CResult_PrivateRouteCreationErrorZPtr {
7549                         err: Box::into_raw(Box::new(e)),
7550                 },
7551                 result_ok: false,
7552         }
7553 }
7554 /// Checks if the given object is currently in the success state
7555 #[no_mangle]
7556 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
7557         o.result_ok
7558 }
7559 #[no_mangle]
7560 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
7561 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
7562 impl Drop for CResult_PrivateRouteCreationErrorZ {
7563         fn drop(&mut self) {
7564                 if self.result_ok {
7565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7567                         }
7568                 } else {
7569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7571                         }
7572                 }
7573         }
7574 }
7575 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
7576         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
7577                 let contents = if o.result_ok {
7578                         let result = unsafe { o.contents.result };
7579                         unsafe { o.contents.result = std::ptr::null_mut() };
7580                         CResult_PrivateRouteCreationErrorZPtr { result }
7581                 } else {
7582                         let err = unsafe { o.contents.err };
7583                         unsafe { o.contents.err = std::ptr::null_mut(); }
7584                         CResult_PrivateRouteCreationErrorZPtr { err }
7585                 };
7586                 Self {
7587                         contents,
7588                         result_ok: o.result_ok,
7589                 }
7590         }
7591 }
7592 impl Clone for CResult_PrivateRouteCreationErrorZ {
7593         fn clone(&self) -> Self {
7594                 if self.result_ok {
7595                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
7596                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
7597                         } }
7598                 } else {
7599                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
7600                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7601                         } }
7602                 }
7603         }
7604 }
7605 #[no_mangle]
7606 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
7607 /// but with all dynamically-allocated buffers duplicated in new buffers.
7608 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
7609 #[repr(C)]
7610 /// The contents of CResult_StringErrorZ
7611 pub union CResult_StringErrorZPtr {
7612         /// A pointer to the contents in the success state.
7613         /// Reading from this pointer when `result_ok` is not set is undefined.
7614         pub result: *mut crate::c_types::Str,
7615         /// A pointer to the contents in the error state.
7616         /// Reading from this pointer when `result_ok` is set is undefined.
7617         pub err: *mut crate::c_types::Secp256k1Error,
7618 }
7619 #[repr(C)]
7620 /// A CResult_StringErrorZ represents the result of a fallible operation,
7621 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7623 pub struct CResult_StringErrorZ {
7624         /// The contents of this CResult_StringErrorZ, accessible via either
7625         /// `err` or `result` depending on the state of `result_ok`.
7626         pub contents: CResult_StringErrorZPtr,
7627         /// Whether this CResult_StringErrorZ represents a success state.
7628         pub result_ok: bool,
7629 }
7630 #[no_mangle]
7631 /// Creates a new CResult_StringErrorZ in the success state.
7632 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
7633         CResult_StringErrorZ {
7634                 contents: CResult_StringErrorZPtr {
7635                         result: Box::into_raw(Box::new(o)),
7636                 },
7637                 result_ok: true,
7638         }
7639 }
7640 #[no_mangle]
7641 /// Creates a new CResult_StringErrorZ in the error state.
7642 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
7643         CResult_StringErrorZ {
7644                 contents: CResult_StringErrorZPtr {
7645                         err: Box::into_raw(Box::new(e)),
7646                 },
7647                 result_ok: false,
7648         }
7649 }
7650 /// Checks if the given object is currently in the success state
7651 #[no_mangle]
7652 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
7653         o.result_ok
7654 }
7655 #[no_mangle]
7656 /// Frees any resources used by the CResult_StringErrorZ.
7657 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
7658 impl Drop for CResult_StringErrorZ {
7659         fn drop(&mut self) {
7660                 if self.result_ok {
7661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7663                         }
7664                 } else {
7665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7667                         }
7668                 }
7669         }
7670 }
7671 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
7672         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
7673                 let contents = if o.result_ok {
7674                         let result = unsafe { o.contents.result };
7675                         unsafe { o.contents.result = std::ptr::null_mut() };
7676                         CResult_StringErrorZPtr { result }
7677                 } else {
7678                         let err = unsafe { o.contents.err };
7679                         unsafe { o.contents.err = std::ptr::null_mut(); }
7680                         CResult_StringErrorZPtr { err }
7681                 };
7682                 Self {
7683                         contents,
7684                         result_ok: o.result_ok,
7685                 }
7686         }
7687 }
7688 #[repr(C)]
7689 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7690 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7691         /// A pointer to the contents in the success state.
7692         /// Reading from this pointer when `result_ok` is not set is undefined.
7693         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
7694         /// A pointer to the contents in the error state.
7695         /// Reading from this pointer when `result_ok` is set is undefined.
7696         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7697 }
7698 #[repr(C)]
7699 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7700 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7702 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
7703         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7704         /// `err` or `result` depending on the state of `result_ok`.
7705         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
7706         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7707         pub result_ok: bool,
7708 }
7709 #[no_mangle]
7710 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
7711 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7712         CResult_ChannelMonitorUpdateDecodeErrorZ {
7713                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7714                         result: Box::into_raw(Box::new(o)),
7715                 },
7716                 result_ok: true,
7717         }
7718 }
7719 #[no_mangle]
7720 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
7721 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
7722         CResult_ChannelMonitorUpdateDecodeErrorZ {
7723                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7724                         err: Box::into_raw(Box::new(e)),
7725                 },
7726                 result_ok: false,
7727         }
7728 }
7729 /// Checks if the given object is currently in the success state
7730 #[no_mangle]
7731 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
7732         o.result_ok
7733 }
7734 #[no_mangle]
7735 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
7736 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
7737 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
7738         fn drop(&mut self) {
7739                 if self.result_ok {
7740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7742                         }
7743                 } else {
7744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7746                         }
7747                 }
7748         }
7749 }
7750 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
7751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7752                 let contents = if o.result_ok {
7753                         let result = unsafe { o.contents.result };
7754                         unsafe { o.contents.result = std::ptr::null_mut() };
7755                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
7756                 } else {
7757                         let err = unsafe { o.contents.err };
7758                         unsafe { o.contents.err = std::ptr::null_mut(); }
7759                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
7760                 };
7761                 Self {
7762                         contents,
7763                         result_ok: o.result_ok,
7764                 }
7765         }
7766 }
7767 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
7768         fn clone(&self) -> Self {
7769                 if self.result_ok {
7770                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7771                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
7772                         } }
7773                 } else {
7774                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
7775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7776                         } }
7777                 }
7778         }
7779 }
7780 #[no_mangle]
7781 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7782 /// but with all dynamically-allocated buffers duplicated in new buffers.
7783 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
7784 #[repr(C)]
7785 #[derive(Clone)]
7786 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
7787 pub enum COption_MonitorEventZ {
7788         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
7789         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
7790         /// When we're in this state, this COption_MonitorEventZ contains nothing
7791         None
7792 }
7793 impl COption_MonitorEventZ {
7794         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7795                 if let Self::Some(_) = self { true } else { false }
7796         }
7797         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7798                 !self.is_some()
7799         }
7800         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
7801                 if let Self::Some(v) = self { v } else { unreachable!() }
7802         }
7803 }
7804 #[no_mangle]
7805 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
7806 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
7807         COption_MonitorEventZ::Some(o)
7808 }
7809 #[no_mangle]
7810 /// Constructs a new COption_MonitorEventZ containing nothing
7811 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
7812         COption_MonitorEventZ::None
7813 }
7814 #[no_mangle]
7815 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
7816 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
7817 #[no_mangle]
7818 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
7819 /// but with all dynamically-allocated buffers duplicated in new buffers.
7820 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
7821 #[repr(C)]
7822 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
7823 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
7824         /// A pointer to the contents in the success state.
7825         /// Reading from this pointer when `result_ok` is not set is undefined.
7826         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
7827         /// A pointer to the contents in the error state.
7828         /// Reading from this pointer when `result_ok` is set is undefined.
7829         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7830 }
7831 #[repr(C)]
7832 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
7833 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7835 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
7836         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
7837         /// `err` or `result` depending on the state of `result_ok`.
7838         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
7839         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
7840         pub result_ok: bool,
7841 }
7842 #[no_mangle]
7843 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
7844 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
7845         CResult_COption_MonitorEventZDecodeErrorZ {
7846                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7847                         result: Box::into_raw(Box::new(o)),
7848                 },
7849                 result_ok: true,
7850         }
7851 }
7852 #[no_mangle]
7853 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
7854 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
7855         CResult_COption_MonitorEventZDecodeErrorZ {
7856                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7857                         err: Box::into_raw(Box::new(e)),
7858                 },
7859                 result_ok: false,
7860         }
7861 }
7862 /// Checks if the given object is currently in the success state
7863 #[no_mangle]
7864 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
7865         o.result_ok
7866 }
7867 #[no_mangle]
7868 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
7869 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
7870 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
7871         fn drop(&mut self) {
7872                 if self.result_ok {
7873                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7874                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7875                         }
7876                 } else {
7877                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7878                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7879                         }
7880                 }
7881         }
7882 }
7883 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
7884         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7885                 let contents = if o.result_ok {
7886                         let result = unsafe { o.contents.result };
7887                         unsafe { o.contents.result = std::ptr::null_mut() };
7888                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
7889                 } else {
7890                         let err = unsafe { o.contents.err };
7891                         unsafe { o.contents.err = std::ptr::null_mut(); }
7892                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
7893                 };
7894                 Self {
7895                         contents,
7896                         result_ok: o.result_ok,
7897                 }
7898         }
7899 }
7900 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
7901         fn clone(&self) -> Self {
7902                 if self.result_ok {
7903                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7904                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
7905                         } }
7906                 } else {
7907                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
7908                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7909                         } }
7910                 }
7911         }
7912 }
7913 #[no_mangle]
7914 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
7915 /// but with all dynamically-allocated buffers duplicated in new buffers.
7916 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
7917 #[repr(C)]
7918 /// The contents of CResult_HTLCUpdateDecodeErrorZ
7919 pub union CResult_HTLCUpdateDecodeErrorZPtr {
7920         /// A pointer to the contents in the success state.
7921         /// Reading from this pointer when `result_ok` is not set is undefined.
7922         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
7923         /// A pointer to the contents in the error state.
7924         /// Reading from this pointer when `result_ok` is set is undefined.
7925         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7926 }
7927 #[repr(C)]
7928 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7929 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7931 pub struct CResult_HTLCUpdateDecodeErrorZ {
7932         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7933         /// `err` or `result` depending on the state of `result_ok`.
7934         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
7935         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7936         pub result_ok: bool,
7937 }
7938 #[no_mangle]
7939 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7940 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
7941         CResult_HTLCUpdateDecodeErrorZ {
7942                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7943                         result: Box::into_raw(Box::new(o)),
7944                 },
7945                 result_ok: true,
7946         }
7947 }
7948 #[no_mangle]
7949 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7950 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
7951         CResult_HTLCUpdateDecodeErrorZ {
7952                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
7953                         err: Box::into_raw(Box::new(e)),
7954                 },
7955                 result_ok: false,
7956         }
7957 }
7958 /// Checks if the given object is currently in the success state
7959 #[no_mangle]
7960 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
7961         o.result_ok
7962 }
7963 #[no_mangle]
7964 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7965 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
7966 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
7967         fn drop(&mut self) {
7968                 if self.result_ok {
7969                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7970                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7971                         }
7972                 } else {
7973                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7974                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7975                         }
7976                 }
7977         }
7978 }
7979 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
7980         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7981                 let contents = if o.result_ok {
7982                         let result = unsafe { o.contents.result };
7983                         unsafe { o.contents.result = std::ptr::null_mut() };
7984                         CResult_HTLCUpdateDecodeErrorZPtr { result }
7985                 } else {
7986                         let err = unsafe { o.contents.err };
7987                         unsafe { o.contents.err = std::ptr::null_mut(); }
7988                         CResult_HTLCUpdateDecodeErrorZPtr { err }
7989                 };
7990                 Self {
7991                         contents,
7992                         result_ok: o.result_ok,
7993                 }
7994         }
7995 }
7996 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
7997         fn clone(&self) -> Self {
7998                 if self.result_ok {
7999                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8000                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
8001                         } }
8002                 } else {
8003                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8004                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8005                         } }
8006                 }
8007         }
8008 }
8009 #[no_mangle]
8010 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8011 /// but with all dynamically-allocated buffers duplicated in new buffers.
8012 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
8013 #[repr(C)]
8014 /// The contents of CResult_NoneMonitorUpdateErrorZ
8015 pub union CResult_NoneMonitorUpdateErrorZPtr {
8016         /// Note that this value is always NULL, as there are no contents in the OK variant
8017         pub result: *mut std::ffi::c_void,
8018         /// A pointer to the contents in the error state.
8019         /// Reading from this pointer when `result_ok` is set is undefined.
8020         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
8021 }
8022 #[repr(C)]
8023 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
8024 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
8025 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8026 pub struct CResult_NoneMonitorUpdateErrorZ {
8027         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
8028         /// `err` or `result` depending on the state of `result_ok`.
8029         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
8030         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
8031         pub result_ok: bool,
8032 }
8033 #[no_mangle]
8034 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
8035 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
8036         CResult_NoneMonitorUpdateErrorZ {
8037                 contents: CResult_NoneMonitorUpdateErrorZPtr {
8038                         result: std::ptr::null_mut(),
8039                 },
8040                 result_ok: true,
8041         }
8042 }
8043 #[no_mangle]
8044 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
8045 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
8046         CResult_NoneMonitorUpdateErrorZ {
8047                 contents: CResult_NoneMonitorUpdateErrorZPtr {
8048                         err: Box::into_raw(Box::new(e)),
8049                 },
8050                 result_ok: false,
8051         }
8052 }
8053 /// Checks if the given object is currently in the success state
8054 #[no_mangle]
8055 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_is_ok(o: &CResult_NoneMonitorUpdateErrorZ) -> bool {
8056         o.result_ok
8057 }
8058 #[no_mangle]
8059 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
8060 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
8061 impl Drop for CResult_NoneMonitorUpdateErrorZ {
8062         fn drop(&mut self) {
8063                 if self.result_ok {
8064                 } else {
8065                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8066                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8067                         }
8068                 }
8069         }
8070 }
8071 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
8072         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
8073                 let contents = if o.result_ok {
8074                         let _ = unsafe { Box::from_raw(o.contents.result) };
8075                         o.contents.result = std::ptr::null_mut();
8076                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
8077                 } else {
8078                         let err = unsafe { o.contents.err };
8079                         unsafe { o.contents.err = std::ptr::null_mut(); }
8080                         CResult_NoneMonitorUpdateErrorZPtr { err }
8081                 };
8082                 Self {
8083                         contents,
8084                         result_ok: o.result_ok,
8085                 }
8086         }
8087 }
8088 impl Clone for CResult_NoneMonitorUpdateErrorZ {
8089         fn clone(&self) -> Self {
8090                 if self.result_ok {
8091                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
8092                                 result: std::ptr::null_mut()
8093                         } }
8094                 } else {
8095                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
8096                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
8097                         } }
8098                 }
8099         }
8100 }
8101 #[no_mangle]
8102 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
8103 /// but with all dynamically-allocated buffers duplicated in new buffers.
8104 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
8105 #[repr(C)]
8106 /// A tuple of 2 elements. See the individual fields for the types contained.
8107 pub struct C2Tuple_OutPointScriptZ {
8108         /// The element at position 0
8109         pub a: crate::lightning::chain::transaction::OutPoint,
8110         /// The element at position 1
8111         pub b: crate::c_types::derived::CVec_u8Z,
8112 }
8113 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
8114         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
8115                 Self {
8116                         a: tup.0,
8117                         b: tup.1,
8118                 }
8119         }
8120 }
8121 impl C2Tuple_OutPointScriptZ {
8122         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
8123                 (self.a, self.b)
8124         }
8125 }
8126 impl Clone for C2Tuple_OutPointScriptZ {
8127         fn clone(&self) -> Self {
8128                 Self {
8129                         a: Clone::clone(&self.a),
8130                         b: Clone::clone(&self.b),
8131                 }
8132         }
8133 }
8134 #[no_mangle]
8135 /// Creates a new tuple which has the same data as `orig`
8136 /// but with all dynamically-allocated buffers duplicated in new buffers.
8137 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
8138 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8139 #[no_mangle]
8140 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
8141         C2Tuple_OutPointScriptZ { a, b, }
8142 }
8143
8144 #[no_mangle]
8145 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
8146 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
8147 #[repr(C)]
8148 /// A tuple of 2 elements. See the individual fields for the types contained.
8149 pub struct C2Tuple_u32ScriptZ {
8150         /// The element at position 0
8151         pub a: u32,
8152         /// The element at position 1
8153         pub b: crate::c_types::derived::CVec_u8Z,
8154 }
8155 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
8156         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
8157                 Self {
8158                         a: tup.0,
8159                         b: tup.1,
8160                 }
8161         }
8162 }
8163 impl C2Tuple_u32ScriptZ {
8164         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
8165                 (self.a, self.b)
8166         }
8167 }
8168 impl Clone for C2Tuple_u32ScriptZ {
8169         fn clone(&self) -> Self {
8170                 Self {
8171                         a: Clone::clone(&self.a),
8172                         b: Clone::clone(&self.b),
8173                 }
8174         }
8175 }
8176 #[no_mangle]
8177 /// Creates a new tuple which has the same data as `orig`
8178 /// but with all dynamically-allocated buffers duplicated in new buffers.
8179 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
8180 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
8181 #[no_mangle]
8182 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
8183         C2Tuple_u32ScriptZ { a, b, }
8184 }
8185
8186 #[no_mangle]
8187 /// Frees any resources used by the C2Tuple_u32ScriptZ.
8188 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
8189 #[repr(C)]
8190 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8191 /// This corresponds to std::vector in C++
8192 pub struct CVec_C2Tuple_u32ScriptZZ {
8193         /// The elements in the array.
8194         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8195         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
8196         /// The number of elements pointed to by `data`.
8197         pub datalen: usize
8198 }
8199 impl CVec_C2Tuple_u32ScriptZZ {
8200         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
8201                 if self.datalen == 0 { return Vec::new(); }
8202                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8203                 self.data = std::ptr::null_mut();
8204                 self.datalen = 0;
8205                 ret
8206         }
8207         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
8208                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8209         }
8210 }
8211 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
8212         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
8213                 let datalen = v.len();
8214                 let data = Box::into_raw(v.into_boxed_slice());
8215                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8216         }
8217 }
8218 #[no_mangle]
8219 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8220 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
8221 impl Drop for CVec_C2Tuple_u32ScriptZZ {
8222         fn drop(&mut self) {
8223                 if self.datalen == 0 { return; }
8224                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8225         }
8226 }
8227 impl Clone for CVec_C2Tuple_u32ScriptZZ {
8228         fn clone(&self) -> Self {
8229                 let mut res = Vec::new();
8230                 if self.datalen == 0 { return Self::from(res); }
8231                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8232                 Self::from(res)
8233         }
8234 }
8235 #[repr(C)]
8236 /// A tuple of 2 elements. See the individual fields for the types contained.
8237 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8238         /// The element at position 0
8239         pub a: crate::c_types::ThirtyTwoBytes,
8240         /// The element at position 1
8241         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
8242 }
8243 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8244         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
8245                 Self {
8246                         a: tup.0,
8247                         b: tup.1,
8248                 }
8249         }
8250 }
8251 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8252         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
8253                 (self.a, self.b)
8254         }
8255 }
8256 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8257         fn clone(&self) -> Self {
8258                 Self {
8259                         a: Clone::clone(&self.a),
8260                         b: Clone::clone(&self.b),
8261                 }
8262         }
8263 }
8264 #[no_mangle]
8265 /// Creates a new tuple which has the same data as `orig`
8266 /// but with all dynamically-allocated buffers duplicated in new buffers.
8267 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
8268 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8269 #[no_mangle]
8270 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 {
8271         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
8272 }
8273
8274 #[no_mangle]
8275 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8276 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
8277 #[repr(C)]
8278 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8279 /// This corresponds to std::vector in C++
8280 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8281         /// The elements in the array.
8282         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8283         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
8284         /// The number of elements pointed to by `data`.
8285         pub datalen: usize
8286 }
8287 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8288         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
8289                 if self.datalen == 0 { return Vec::new(); }
8290                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8291                 self.data = std::ptr::null_mut();
8292                 self.datalen = 0;
8293                 ret
8294         }
8295         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
8296                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8297         }
8298 }
8299 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8300         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
8301                 let datalen = v.len();
8302                 let data = Box::into_raw(v.into_boxed_slice());
8303                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8304         }
8305 }
8306 #[no_mangle]
8307 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8308 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
8309 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8310         fn drop(&mut self) {
8311                 if self.datalen == 0 { return; }
8312                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8313         }
8314 }
8315 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8316         fn clone(&self) -> Self {
8317                 let mut res = Vec::new();
8318                 if self.datalen == 0 { return Self::from(res); }
8319                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8320                 Self::from(res)
8321         }
8322 }
8323 #[repr(C)]
8324 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8325 /// This corresponds to std::vector in C++
8326 pub struct CVec_EventZ {
8327         /// The elements in the array.
8328         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8329         pub data: *mut crate::lightning::util::events::Event,
8330         /// The number of elements pointed to by `data`.
8331         pub datalen: usize
8332 }
8333 impl CVec_EventZ {
8334         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
8335                 if self.datalen == 0 { return Vec::new(); }
8336                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8337                 self.data = std::ptr::null_mut();
8338                 self.datalen = 0;
8339                 ret
8340         }
8341         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
8342                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8343         }
8344 }
8345 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
8346         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
8347                 let datalen = v.len();
8348                 let data = Box::into_raw(v.into_boxed_slice());
8349                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8350         }
8351 }
8352 #[no_mangle]
8353 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8354 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
8355 impl Drop for CVec_EventZ {
8356         fn drop(&mut self) {
8357                 if self.datalen == 0 { return; }
8358                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8359         }
8360 }
8361 impl Clone for CVec_EventZ {
8362         fn clone(&self) -> Self {
8363                 let mut res = Vec::new();
8364                 if self.datalen == 0 { return Self::from(res); }
8365                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8366                 Self::from(res)
8367         }
8368 }
8369 #[repr(C)]
8370 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8371 /// This corresponds to std::vector in C++
8372 pub struct CVec_TransactionZ {
8373         /// The elements in the array.
8374         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8375         pub data: *mut crate::c_types::Transaction,
8376         /// The number of elements pointed to by `data`.
8377         pub datalen: usize
8378 }
8379 impl CVec_TransactionZ {
8380         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
8381                 if self.datalen == 0 { return Vec::new(); }
8382                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8383                 self.data = std::ptr::null_mut();
8384                 self.datalen = 0;
8385                 ret
8386         }
8387         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
8388                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8389         }
8390 }
8391 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
8392         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
8393                 let datalen = v.len();
8394                 let data = Box::into_raw(v.into_boxed_slice());
8395                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8396         }
8397 }
8398 #[no_mangle]
8399 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8400 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
8401 impl Drop for CVec_TransactionZ {
8402         fn drop(&mut self) {
8403                 if self.datalen == 0 { return; }
8404                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8405         }
8406 }
8407 impl Clone for CVec_TransactionZ {
8408         fn clone(&self) -> Self {
8409                 let mut res = Vec::new();
8410                 if self.datalen == 0 { return Self::from(res); }
8411                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8412                 Self::from(res)
8413         }
8414 }
8415 #[repr(C)]
8416 /// A tuple of 2 elements. See the individual fields for the types contained.
8417 pub struct C2Tuple_u32TxOutZ {
8418         /// The element at position 0
8419         pub a: u32,
8420         /// The element at position 1
8421         pub b: crate::c_types::TxOut,
8422 }
8423 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
8424         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
8425                 Self {
8426                         a: tup.0,
8427                         b: tup.1,
8428                 }
8429         }
8430 }
8431 impl C2Tuple_u32TxOutZ {
8432         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
8433                 (self.a, self.b)
8434         }
8435 }
8436 impl Clone for C2Tuple_u32TxOutZ {
8437         fn clone(&self) -> Self {
8438                 Self {
8439                         a: Clone::clone(&self.a),
8440                         b: Clone::clone(&self.b),
8441                 }
8442         }
8443 }
8444 #[no_mangle]
8445 /// Creates a new tuple which has the same data as `orig`
8446 /// but with all dynamically-allocated buffers duplicated in new buffers.
8447 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
8448 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
8449 #[no_mangle]
8450 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
8451         C2Tuple_u32TxOutZ { a, b, }
8452 }
8453
8454 #[no_mangle]
8455 /// Frees any resources used by the C2Tuple_u32TxOutZ.
8456 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
8457 #[repr(C)]
8458 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8459 /// This corresponds to std::vector in C++
8460 pub struct CVec_C2Tuple_u32TxOutZZ {
8461         /// The elements in the array.
8462         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8463         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
8464         /// The number of elements pointed to by `data`.
8465         pub datalen: usize
8466 }
8467 impl CVec_C2Tuple_u32TxOutZZ {
8468         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
8469                 if self.datalen == 0 { return Vec::new(); }
8470                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8471                 self.data = std::ptr::null_mut();
8472                 self.datalen = 0;
8473                 ret
8474         }
8475         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
8476                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8477         }
8478 }
8479 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
8480         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
8481                 let datalen = v.len();
8482                 let data = Box::into_raw(v.into_boxed_slice());
8483                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8484         }
8485 }
8486 #[no_mangle]
8487 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8488 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
8489 impl Drop for CVec_C2Tuple_u32TxOutZZ {
8490         fn drop(&mut self) {
8491                 if self.datalen == 0 { return; }
8492                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8493         }
8494 }
8495 impl Clone for CVec_C2Tuple_u32TxOutZZ {
8496         fn clone(&self) -> Self {
8497                 let mut res = Vec::new();
8498                 if self.datalen == 0 { return Self::from(res); }
8499                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8500                 Self::from(res)
8501         }
8502 }
8503 #[repr(C)]
8504 /// A tuple of 2 elements. See the individual fields for the types contained.
8505 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8506         /// The element at position 0
8507         pub a: crate::c_types::ThirtyTwoBytes,
8508         /// The element at position 1
8509         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
8510 }
8511 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8512         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
8513                 Self {
8514                         a: tup.0,
8515                         b: tup.1,
8516                 }
8517         }
8518 }
8519 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8520         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
8521                 (self.a, self.b)
8522         }
8523 }
8524 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8525         fn clone(&self) -> Self {
8526                 Self {
8527                         a: Clone::clone(&self.a),
8528                         b: Clone::clone(&self.b),
8529                 }
8530         }
8531 }
8532 #[no_mangle]
8533 /// Creates a new tuple which has the same data as `orig`
8534 /// but with all dynamically-allocated buffers duplicated in new buffers.
8535 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
8536 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8537 #[no_mangle]
8538 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 {
8539         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
8540 }
8541
8542 #[no_mangle]
8543 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8544 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
8545 #[repr(C)]
8546 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8547 /// This corresponds to std::vector in C++
8548 pub struct CVec_TransactionOutputsZ {
8549         /// The elements in the array.
8550         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8551         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
8552         /// The number of elements pointed to by `data`.
8553         pub datalen: usize
8554 }
8555 impl CVec_TransactionOutputsZ {
8556         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
8557                 if self.datalen == 0 { return Vec::new(); }
8558                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8559                 self.data = std::ptr::null_mut();
8560                 self.datalen = 0;
8561                 ret
8562         }
8563         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
8564                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8565         }
8566 }
8567 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
8568         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
8569                 let datalen = v.len();
8570                 let data = Box::into_raw(v.into_boxed_slice());
8571                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8572         }
8573 }
8574 #[no_mangle]
8575 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8576 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
8577 impl Drop for CVec_TransactionOutputsZ {
8578         fn drop(&mut self) {
8579                 if self.datalen == 0 { return; }
8580                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8581         }
8582 }
8583 impl Clone for CVec_TransactionOutputsZ {
8584         fn clone(&self) -> Self {
8585                 let mut res = Vec::new();
8586                 if self.datalen == 0 { return Self::from(res); }
8587                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8588                 Self::from(res)
8589         }
8590 }
8591 #[repr(C)]
8592 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
8593 /// This corresponds to std::vector in C++
8594 pub struct CVec_BalanceZ {
8595         /// The elements in the array.
8596         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8597         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
8598         /// The number of elements pointed to by `data`.
8599         pub datalen: usize
8600 }
8601 impl CVec_BalanceZ {
8602         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
8603                 if self.datalen == 0 { return Vec::new(); }
8604                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8605                 self.data = std::ptr::null_mut();
8606                 self.datalen = 0;
8607                 ret
8608         }
8609         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
8610                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8611         }
8612 }
8613 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
8614         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
8615                 let datalen = v.len();
8616                 let data = Box::into_raw(v.into_boxed_slice());
8617                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8618         }
8619 }
8620 #[no_mangle]
8621 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8622 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
8623 impl Drop for CVec_BalanceZ {
8624         fn drop(&mut self) {
8625                 if self.datalen == 0 { return; }
8626                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8627         }
8628 }
8629 impl Clone for CVec_BalanceZ {
8630         fn clone(&self) -> Self {
8631                 let mut res = Vec::new();
8632                 if self.datalen == 0 { return Self::from(res); }
8633                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8634                 Self::from(res)
8635         }
8636 }
8637 #[repr(C)]
8638 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
8639 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8640         /// A pointer to the contents in the success state.
8641         /// Reading from this pointer when `result_ok` is not set is undefined.
8642         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8643         /// A pointer to the contents in the error state.
8644         /// Reading from this pointer when `result_ok` is set is undefined.
8645         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8646 }
8647 #[repr(C)]
8648 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
8649 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8650 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8651 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8652         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
8653         /// `err` or `result` depending on the state of `result_ok`.
8654         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
8655         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
8656         pub result_ok: bool,
8657 }
8658 #[no_mangle]
8659 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
8660 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8661         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8662                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8663                         result: Box::into_raw(Box::new(o)),
8664                 },
8665                 result_ok: true,
8666         }
8667 }
8668 #[no_mangle]
8669 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
8670 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8671         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8672                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8673                         err: Box::into_raw(Box::new(e)),
8674                 },
8675                 result_ok: false,
8676         }
8677 }
8678 /// Checks if the given object is currently in the success state
8679 #[no_mangle]
8680 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
8681         o.result_ok
8682 }
8683 #[no_mangle]
8684 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
8685 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
8686 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8687         fn drop(&mut self) {
8688                 if self.result_ok {
8689                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8690                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8691                         }
8692                 } else {
8693                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8694                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8695                         }
8696                 }
8697         }
8698 }
8699 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8700         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8701                 let contents = if o.result_ok {
8702                         let result = unsafe { o.contents.result };
8703                         unsafe { o.contents.result = std::ptr::null_mut() };
8704                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
8705                 } else {
8706                         let err = unsafe { o.contents.err };
8707                         unsafe { o.contents.err = std::ptr::null_mut(); }
8708                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
8709                 };
8710                 Self {
8711                         contents,
8712                         result_ok: o.result_ok,
8713                 }
8714         }
8715 }
8716 #[repr(C)]
8717 /// The contents of CResult_NoneLightningErrorZ
8718 pub union CResult_NoneLightningErrorZPtr {
8719         /// Note that this value is always NULL, as there are no contents in the OK variant
8720         pub result: *mut std::ffi::c_void,
8721         /// A pointer to the contents in the error state.
8722         /// Reading from this pointer when `result_ok` is set is undefined.
8723         pub err: *mut crate::lightning::ln::msgs::LightningError,
8724 }
8725 #[repr(C)]
8726 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
8727 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
8728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8729 pub struct CResult_NoneLightningErrorZ {
8730         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
8731         /// `err` or `result` depending on the state of `result_ok`.
8732         pub contents: CResult_NoneLightningErrorZPtr,
8733         /// Whether this CResult_NoneLightningErrorZ represents a success state.
8734         pub result_ok: bool,
8735 }
8736 #[no_mangle]
8737 /// Creates a new CResult_NoneLightningErrorZ in the success state.
8738 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
8739         CResult_NoneLightningErrorZ {
8740                 contents: CResult_NoneLightningErrorZPtr {
8741                         result: std::ptr::null_mut(),
8742                 },
8743                 result_ok: true,
8744         }
8745 }
8746 #[no_mangle]
8747 /// Creates a new CResult_NoneLightningErrorZ in the error state.
8748 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
8749         CResult_NoneLightningErrorZ {
8750                 contents: CResult_NoneLightningErrorZPtr {
8751                         err: Box::into_raw(Box::new(e)),
8752                 },
8753                 result_ok: false,
8754         }
8755 }
8756 /// Checks if the given object is currently in the success state
8757 #[no_mangle]
8758 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
8759         o.result_ok
8760 }
8761 #[no_mangle]
8762 /// Frees any resources used by the CResult_NoneLightningErrorZ.
8763 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
8764 impl Drop for CResult_NoneLightningErrorZ {
8765         fn drop(&mut self) {
8766                 if self.result_ok {
8767                 } else {
8768                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8769                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8770                         }
8771                 }
8772         }
8773 }
8774 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
8775         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
8776                 let contents = if o.result_ok {
8777                         let _ = unsafe { Box::from_raw(o.contents.result) };
8778                         o.contents.result = std::ptr::null_mut();
8779                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
8780                 } else {
8781                         let err = unsafe { o.contents.err };
8782                         unsafe { o.contents.err = std::ptr::null_mut(); }
8783                         CResult_NoneLightningErrorZPtr { err }
8784                 };
8785                 Self {
8786                         contents,
8787                         result_ok: o.result_ok,
8788                 }
8789         }
8790 }
8791 impl Clone for CResult_NoneLightningErrorZ {
8792         fn clone(&self) -> Self {
8793                 if self.result_ok {
8794                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
8795                                 result: std::ptr::null_mut()
8796                         } }
8797                 } else {
8798                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
8799                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8800                         } }
8801                 }
8802         }
8803 }
8804 #[no_mangle]
8805 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8806 /// but with all dynamically-allocated buffers duplicated in new buffers.
8807 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
8808 #[repr(C)]
8809 /// A tuple of 2 elements. See the individual fields for the types contained.
8810 pub struct C2Tuple_PublicKeyTypeZ {
8811         /// The element at position 0
8812         pub a: crate::c_types::PublicKey,
8813         /// The element at position 1
8814         pub b: crate::lightning::ln::wire::Type,
8815 }
8816 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
8817         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
8818                 Self {
8819                         a: tup.0,
8820                         b: tup.1,
8821                 }
8822         }
8823 }
8824 impl C2Tuple_PublicKeyTypeZ {
8825         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
8826                 (self.a, self.b)
8827         }
8828 }
8829 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
8830 #[no_mangle]
8831 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
8832         C2Tuple_PublicKeyTypeZ { a, b, }
8833 }
8834
8835 #[no_mangle]
8836 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
8837 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
8838 #[repr(C)]
8839 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8840 /// This corresponds to std::vector in C++
8841 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
8842         /// The elements in the array.
8843         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8844         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
8845         /// The number of elements pointed to by `data`.
8846         pub datalen: usize
8847 }
8848 impl CVec_C2Tuple_PublicKeyTypeZZ {
8849         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
8850                 if self.datalen == 0 { return Vec::new(); }
8851                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8852                 self.data = std::ptr::null_mut();
8853                 self.datalen = 0;
8854                 ret
8855         }
8856         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
8857                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8858         }
8859 }
8860 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
8861         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
8862                 let datalen = v.len();
8863                 let data = Box::into_raw(v.into_boxed_slice());
8864                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8865         }
8866 }
8867 #[no_mangle]
8868 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8869 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
8870 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
8871         fn drop(&mut self) {
8872                 if self.datalen == 0 { return; }
8873                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8874         }
8875 }
8876 #[repr(C)]
8877 /// The contents of CResult_boolLightningErrorZ
8878 pub union CResult_boolLightningErrorZPtr {
8879         /// A pointer to the contents in the success state.
8880         /// Reading from this pointer when `result_ok` is not set is undefined.
8881         pub result: *mut bool,
8882         /// A pointer to the contents in the error state.
8883         /// Reading from this pointer when `result_ok` is set is undefined.
8884         pub err: *mut crate::lightning::ln::msgs::LightningError,
8885 }
8886 #[repr(C)]
8887 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
8888 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8890 pub struct CResult_boolLightningErrorZ {
8891         /// The contents of this CResult_boolLightningErrorZ, accessible via either
8892         /// `err` or `result` depending on the state of `result_ok`.
8893         pub contents: CResult_boolLightningErrorZPtr,
8894         /// Whether this CResult_boolLightningErrorZ represents a success state.
8895         pub result_ok: bool,
8896 }
8897 #[no_mangle]
8898 /// Creates a new CResult_boolLightningErrorZ in the success state.
8899 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
8900         CResult_boolLightningErrorZ {
8901                 contents: CResult_boolLightningErrorZPtr {
8902                         result: Box::into_raw(Box::new(o)),
8903                 },
8904                 result_ok: true,
8905         }
8906 }
8907 #[no_mangle]
8908 /// Creates a new CResult_boolLightningErrorZ in the error state.
8909 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8910         CResult_boolLightningErrorZ {
8911                 contents: CResult_boolLightningErrorZPtr {
8912                         err: Box::into_raw(Box::new(e)),
8913                 },
8914                 result_ok: false,
8915         }
8916 }
8917 /// Checks if the given object is currently in the success state
8918 #[no_mangle]
8919 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
8920         o.result_ok
8921 }
8922 #[no_mangle]
8923 /// Frees any resources used by the CResult_boolLightningErrorZ.
8924 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8925 impl Drop for CResult_boolLightningErrorZ {
8926         fn drop(&mut self) {
8927                 if self.result_ok {
8928                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8929                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8930                         }
8931                 } else {
8932                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8933                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8934                         }
8935                 }
8936         }
8937 }
8938 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8939         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8940                 let contents = if o.result_ok {
8941                         let result = unsafe { o.contents.result };
8942                         unsafe { o.contents.result = std::ptr::null_mut() };
8943                         CResult_boolLightningErrorZPtr { result }
8944                 } else {
8945                         let err = unsafe { o.contents.err };
8946                         unsafe { o.contents.err = std::ptr::null_mut(); }
8947                         CResult_boolLightningErrorZPtr { err }
8948                 };
8949                 Self {
8950                         contents,
8951                         result_ok: o.result_ok,
8952                 }
8953         }
8954 }
8955 impl Clone for CResult_boolLightningErrorZ {
8956         fn clone(&self) -> Self {
8957                 if self.result_ok {
8958                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8959                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8960                         } }
8961                 } else {
8962                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8963                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8964                         } }
8965                 }
8966         }
8967 }
8968 #[no_mangle]
8969 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8970 /// but with all dynamically-allocated buffers duplicated in new buffers.
8971 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8972 #[repr(C)]
8973 /// A tuple of 3 elements. See the individual fields for the types contained.
8974 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8975         /// The element at position 0
8976         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8977         /// The element at position 1
8978         pub b: crate::lightning::ln::msgs::ChannelUpdate,
8979         /// The element at position 2
8980         pub c: crate::lightning::ln::msgs::ChannelUpdate,
8981 }
8982 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8983         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8984                 Self {
8985                         a: tup.0,
8986                         b: tup.1,
8987                         c: tup.2,
8988                 }
8989         }
8990 }
8991 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8992         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8993                 (self.a, self.b, self.c)
8994         }
8995 }
8996 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8997         fn clone(&self) -> Self {
8998                 Self {
8999                         a: Clone::clone(&self.a),
9000                         b: Clone::clone(&self.b),
9001                         c: Clone::clone(&self.c),
9002                 }
9003         }
9004 }
9005 #[no_mangle]
9006 /// Creates a new tuple which has the same data as `orig`
9007 /// but with all dynamically-allocated buffers duplicated in new buffers.
9008 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
9009 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9010 #[no_mangle]
9011 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 {
9012         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
9013 }
9014
9015 #[no_mangle]
9016 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9017 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
9018 #[repr(C)]
9019 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
9020 /// This corresponds to std::vector in C++
9021 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9022         /// The elements in the array.
9023         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9024         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
9025         /// The number of elements pointed to by `data`.
9026         pub datalen: usize
9027 }
9028 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9029         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
9030                 if self.datalen == 0 { return Vec::new(); }
9031                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9032                 self.data = std::ptr::null_mut();
9033                 self.datalen = 0;
9034                 ret
9035         }
9036         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
9037                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9038         }
9039 }
9040 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9041         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
9042                 let datalen = v.len();
9043                 let data = Box::into_raw(v.into_boxed_slice());
9044                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9045         }
9046 }
9047 #[no_mangle]
9048 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9049 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
9050 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9051         fn drop(&mut self) {
9052                 if self.datalen == 0 { return; }
9053                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9054         }
9055 }
9056 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9057         fn clone(&self) -> Self {
9058                 let mut res = Vec::new();
9059                 if self.datalen == 0 { return Self::from(res); }
9060                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9061                 Self::from(res)
9062         }
9063 }
9064 #[repr(C)]
9065 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
9066 /// This corresponds to std::vector in C++
9067 pub struct CVec_NodeAnnouncementZ {
9068         /// The elements in the array.
9069         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9070         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
9071         /// The number of elements pointed to by `data`.
9072         pub datalen: usize
9073 }
9074 impl CVec_NodeAnnouncementZ {
9075         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
9076                 if self.datalen == 0 { return Vec::new(); }
9077                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9078                 self.data = std::ptr::null_mut();
9079                 self.datalen = 0;
9080                 ret
9081         }
9082         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
9083                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9084         }
9085 }
9086 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
9087         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
9088                 let datalen = v.len();
9089                 let data = Box::into_raw(v.into_boxed_slice());
9090                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9091         }
9092 }
9093 #[no_mangle]
9094 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9095 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
9096 impl Drop for CVec_NodeAnnouncementZ {
9097         fn drop(&mut self) {
9098                 if self.datalen == 0 { return; }
9099                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9100         }
9101 }
9102 impl Clone for CVec_NodeAnnouncementZ {
9103         fn clone(&self) -> Self {
9104                 let mut res = Vec::new();
9105                 if self.datalen == 0 { return Self::from(res); }
9106                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9107                 Self::from(res)
9108         }
9109 }
9110 #[repr(C)]
9111 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
9112 /// This corresponds to std::vector in C++
9113 pub struct CVec_PublicKeyZ {
9114         /// The elements in the array.
9115         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9116         pub data: *mut crate::c_types::PublicKey,
9117         /// The number of elements pointed to by `data`.
9118         pub datalen: usize
9119 }
9120 impl CVec_PublicKeyZ {
9121         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
9122                 if self.datalen == 0 { return Vec::new(); }
9123                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9124                 self.data = std::ptr::null_mut();
9125                 self.datalen = 0;
9126                 ret
9127         }
9128         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
9129                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9130         }
9131 }
9132 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
9133         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
9134                 let datalen = v.len();
9135                 let data = Box::into_raw(v.into_boxed_slice());
9136                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9137         }
9138 }
9139 #[no_mangle]
9140 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9141 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
9142 impl Drop for CVec_PublicKeyZ {
9143         fn drop(&mut self) {
9144                 if self.datalen == 0 { return; }
9145                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9146         }
9147 }
9148 impl Clone for CVec_PublicKeyZ {
9149         fn clone(&self) -> Self {
9150                 let mut res = Vec::new();
9151                 if self.datalen == 0 { return Self::from(res); }
9152                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9153                 Self::from(res)
9154         }
9155 }
9156 #[repr(C)]
9157 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
9158 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
9159         /// A pointer to the contents in the success state.
9160         /// Reading from this pointer when `result_ok` is not set is undefined.
9161         pub result: *mut crate::c_types::derived::CVec_u8Z,
9162         /// A pointer to the contents in the error state.
9163         /// Reading from this pointer when `result_ok` is set is undefined.
9164         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9165 }
9166 #[repr(C)]
9167 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9168 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9170 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
9171         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9172         /// `err` or `result` depending on the state of `result_ok`.
9173         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
9174         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9175         pub result_ok: bool,
9176 }
9177 #[no_mangle]
9178 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9179 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
9180         CResult_CVec_u8ZPeerHandleErrorZ {
9181                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9182                         result: Box::into_raw(Box::new(o)),
9183                 },
9184                 result_ok: true,
9185         }
9186 }
9187 #[no_mangle]
9188 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9189 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
9190         CResult_CVec_u8ZPeerHandleErrorZ {
9191                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9192                         err: Box::into_raw(Box::new(e)),
9193                 },
9194                 result_ok: false,
9195         }
9196 }
9197 /// Checks if the given object is currently in the success state
9198 #[no_mangle]
9199 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
9200         o.result_ok
9201 }
9202 #[no_mangle]
9203 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9204 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
9205 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
9206         fn drop(&mut self) {
9207                 if self.result_ok {
9208                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9209                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9210                         }
9211                 } else {
9212                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9213                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9214                         }
9215                 }
9216         }
9217 }
9218 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
9219         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9220                 let contents = if o.result_ok {
9221                         let result = unsafe { o.contents.result };
9222                         unsafe { o.contents.result = std::ptr::null_mut() };
9223                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
9224                 } else {
9225                         let err = unsafe { o.contents.err };
9226                         unsafe { o.contents.err = std::ptr::null_mut(); }
9227                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
9228                 };
9229                 Self {
9230                         contents,
9231                         result_ok: o.result_ok,
9232                 }
9233         }
9234 }
9235 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
9236         fn clone(&self) -> Self {
9237                 if self.result_ok {
9238                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9239                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
9240                         } }
9241                 } else {
9242                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9243                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9244                         } }
9245                 }
9246         }
9247 }
9248 #[no_mangle]
9249 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9250 /// but with all dynamically-allocated buffers duplicated in new buffers.
9251 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
9252 #[repr(C)]
9253 /// The contents of CResult_NonePeerHandleErrorZ
9254 pub union CResult_NonePeerHandleErrorZPtr {
9255         /// Note that this value is always NULL, as there are no contents in the OK variant
9256         pub result: *mut std::ffi::c_void,
9257         /// A pointer to the contents in the error state.
9258         /// Reading from this pointer when `result_ok` is set is undefined.
9259         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9260 }
9261 #[repr(C)]
9262 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9263 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9264 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9265 pub struct CResult_NonePeerHandleErrorZ {
9266         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9267         /// `err` or `result` depending on the state of `result_ok`.
9268         pub contents: CResult_NonePeerHandleErrorZPtr,
9269         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
9270         pub result_ok: bool,
9271 }
9272 #[no_mangle]
9273 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
9274 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
9275         CResult_NonePeerHandleErrorZ {
9276                 contents: CResult_NonePeerHandleErrorZPtr {
9277                         result: std::ptr::null_mut(),
9278                 },
9279                 result_ok: true,
9280         }
9281 }
9282 #[no_mangle]
9283 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
9284 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
9285         CResult_NonePeerHandleErrorZ {
9286                 contents: CResult_NonePeerHandleErrorZPtr {
9287                         err: Box::into_raw(Box::new(e)),
9288                 },
9289                 result_ok: false,
9290         }
9291 }
9292 /// Checks if the given object is currently in the success state
9293 #[no_mangle]
9294 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
9295         o.result_ok
9296 }
9297 #[no_mangle]
9298 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
9299 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
9300 impl Drop for CResult_NonePeerHandleErrorZ {
9301         fn drop(&mut self) {
9302                 if self.result_ok {
9303                 } else {
9304                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9305                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9306                         }
9307                 }
9308         }
9309 }
9310 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
9311         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9312                 let contents = if o.result_ok {
9313                         let _ = unsafe { Box::from_raw(o.contents.result) };
9314                         o.contents.result = std::ptr::null_mut();
9315                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
9316                 } else {
9317                         let err = unsafe { o.contents.err };
9318                         unsafe { o.contents.err = std::ptr::null_mut(); }
9319                         CResult_NonePeerHandleErrorZPtr { err }
9320                 };
9321                 Self {
9322                         contents,
9323                         result_ok: o.result_ok,
9324                 }
9325         }
9326 }
9327 impl Clone for CResult_NonePeerHandleErrorZ {
9328         fn clone(&self) -> Self {
9329                 if self.result_ok {
9330                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
9331                                 result: std::ptr::null_mut()
9332                         } }
9333                 } else {
9334                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
9335                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9336                         } }
9337                 }
9338         }
9339 }
9340 #[no_mangle]
9341 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9342 /// but with all dynamically-allocated buffers duplicated in new buffers.
9343 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
9344 #[repr(C)]
9345 /// The contents of CResult_boolPeerHandleErrorZ
9346 pub union CResult_boolPeerHandleErrorZPtr {
9347         /// A pointer to the contents in the success state.
9348         /// Reading from this pointer when `result_ok` is not set is undefined.
9349         pub result: *mut bool,
9350         /// A pointer to the contents in the error state.
9351         /// Reading from this pointer when `result_ok` is set is undefined.
9352         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9353 }
9354 #[repr(C)]
9355 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9356 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9358 pub struct CResult_boolPeerHandleErrorZ {
9359         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9360         /// `err` or `result` depending on the state of `result_ok`.
9361         pub contents: CResult_boolPeerHandleErrorZPtr,
9362         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
9363         pub result_ok: bool,
9364 }
9365 #[no_mangle]
9366 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
9367 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
9368         CResult_boolPeerHandleErrorZ {
9369                 contents: CResult_boolPeerHandleErrorZPtr {
9370                         result: Box::into_raw(Box::new(o)),
9371                 },
9372                 result_ok: true,
9373         }
9374 }
9375 #[no_mangle]
9376 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
9377 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
9378         CResult_boolPeerHandleErrorZ {
9379                 contents: CResult_boolPeerHandleErrorZPtr {
9380                         err: Box::into_raw(Box::new(e)),
9381                 },
9382                 result_ok: false,
9383         }
9384 }
9385 /// Checks if the given object is currently in the success state
9386 #[no_mangle]
9387 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
9388         o.result_ok
9389 }
9390 #[no_mangle]
9391 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
9392 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
9393 impl Drop for CResult_boolPeerHandleErrorZ {
9394         fn drop(&mut self) {
9395                 if self.result_ok {
9396                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9397                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9398                         }
9399                 } else {
9400                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9401                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9402                         }
9403                 }
9404         }
9405 }
9406 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
9407         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9408                 let contents = if o.result_ok {
9409                         let result = unsafe { o.contents.result };
9410                         unsafe { o.contents.result = std::ptr::null_mut() };
9411                         CResult_boolPeerHandleErrorZPtr { result }
9412                 } else {
9413                         let err = unsafe { o.contents.err };
9414                         unsafe { o.contents.err = std::ptr::null_mut(); }
9415                         CResult_boolPeerHandleErrorZPtr { err }
9416                 };
9417                 Self {
9418                         contents,
9419                         result_ok: o.result_ok,
9420                 }
9421         }
9422 }
9423 impl Clone for CResult_boolPeerHandleErrorZ {
9424         fn clone(&self) -> Self {
9425                 if self.result_ok {
9426                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
9427                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9428                         } }
9429                 } else {
9430                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
9431                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9432                         } }
9433                 }
9434         }
9435 }
9436 #[no_mangle]
9437 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9438 /// but with all dynamically-allocated buffers duplicated in new buffers.
9439 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
9440 #[repr(C)]
9441 /// The contents of CResult_NodeIdDecodeErrorZ
9442 pub union CResult_NodeIdDecodeErrorZPtr {
9443         /// A pointer to the contents in the success state.
9444         /// Reading from this pointer when `result_ok` is not set is undefined.
9445         pub result: *mut crate::lightning::routing::network_graph::NodeId,
9446         /// A pointer to the contents in the error state.
9447         /// Reading from this pointer when `result_ok` is set is undefined.
9448         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9449 }
9450 #[repr(C)]
9451 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
9452 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
9453 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9454 pub struct CResult_NodeIdDecodeErrorZ {
9455         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
9456         /// `err` or `result` depending on the state of `result_ok`.
9457         pub contents: CResult_NodeIdDecodeErrorZPtr,
9458         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
9459         pub result_ok: bool,
9460 }
9461 #[no_mangle]
9462 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
9463 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
9464         CResult_NodeIdDecodeErrorZ {
9465                 contents: CResult_NodeIdDecodeErrorZPtr {
9466                         result: Box::into_raw(Box::new(o)),
9467                 },
9468                 result_ok: true,
9469         }
9470 }
9471 #[no_mangle]
9472 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
9473 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
9474         CResult_NodeIdDecodeErrorZ {
9475                 contents: CResult_NodeIdDecodeErrorZPtr {
9476                         err: Box::into_raw(Box::new(e)),
9477                 },
9478                 result_ok: false,
9479         }
9480 }
9481 /// Checks if the given object is currently in the success state
9482 #[no_mangle]
9483 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
9484         o.result_ok
9485 }
9486 #[no_mangle]
9487 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
9488 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
9489 impl Drop for CResult_NodeIdDecodeErrorZ {
9490         fn drop(&mut self) {
9491                 if self.result_ok {
9492                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9493                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9494                         }
9495                 } else {
9496                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9497                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9498                         }
9499                 }
9500         }
9501 }
9502 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
9503         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
9504                 let contents = if o.result_ok {
9505                         let result = unsafe { o.contents.result };
9506                         unsafe { o.contents.result = std::ptr::null_mut() };
9507                         CResult_NodeIdDecodeErrorZPtr { result }
9508                 } else {
9509                         let err = unsafe { o.contents.err };
9510                         unsafe { o.contents.err = std::ptr::null_mut(); }
9511                         CResult_NodeIdDecodeErrorZPtr { err }
9512                 };
9513                 Self {
9514                         contents,
9515                         result_ok: o.result_ok,
9516                 }
9517         }
9518 }
9519 impl Clone for CResult_NodeIdDecodeErrorZ {
9520         fn clone(&self) -> Self {
9521                 if self.result_ok {
9522                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
9523                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
9524                         } }
9525                 } else {
9526                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
9527                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9528                         } }
9529                 }
9530         }
9531 }
9532 #[no_mangle]
9533 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
9534 /// but with all dynamically-allocated buffers duplicated in new buffers.
9535 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
9536 #[repr(C)]
9537 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
9538 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9539         /// A pointer to the contents in the success state.
9540         /// Reading from this pointer when `result_ok` is not set is undefined.
9541         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
9542         /// A pointer to the contents in the error state.
9543         /// Reading from this pointer when `result_ok` is set is undefined.
9544         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9545 }
9546 #[repr(C)]
9547 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
9548 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9550 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
9551         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
9552         /// `err` or `result` depending on the state of `result_ok`.
9553         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
9554         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
9555         pub result_ok: bool,
9556 }
9557 #[no_mangle]
9558 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
9559 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9560         CResult_COption_NetworkUpdateZDecodeErrorZ {
9561                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9562                         result: Box::into_raw(Box::new(o)),
9563                 },
9564                 result_ok: true,
9565         }
9566 }
9567 #[no_mangle]
9568 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
9569 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9570         CResult_COption_NetworkUpdateZDecodeErrorZ {
9571                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9572                         err: Box::into_raw(Box::new(e)),
9573                 },
9574                 result_ok: false,
9575         }
9576 }
9577 /// Checks if the given object is currently in the success state
9578 #[no_mangle]
9579 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
9580         o.result_ok
9581 }
9582 #[no_mangle]
9583 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
9584 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
9585 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
9586         fn drop(&mut self) {
9587                 if self.result_ok {
9588                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9589                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9590                         }
9591                 } else {
9592                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9593                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9594                         }
9595                 }
9596         }
9597 }
9598 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
9599         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9600                 let contents = if o.result_ok {
9601                         let result = unsafe { o.contents.result };
9602                         unsafe { o.contents.result = std::ptr::null_mut() };
9603                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
9604                 } else {
9605                         let err = unsafe { o.contents.err };
9606                         unsafe { o.contents.err = std::ptr::null_mut(); }
9607                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
9608                 };
9609                 Self {
9610                         contents,
9611                         result_ok: o.result_ok,
9612                 }
9613         }
9614 }
9615 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
9616         fn clone(&self) -> Self {
9617                 if self.result_ok {
9618                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9619                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
9620                         } }
9621                 } else {
9622                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9623                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9624                         } }
9625                 }
9626         }
9627 }
9628 #[no_mangle]
9629 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
9630 /// but with all dynamically-allocated buffers duplicated in new buffers.
9631 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
9632 #[repr(C)]
9633 /// An enum which can either contain a crate::lightning::chain::Access or not
9634 pub enum COption_AccessZ {
9635         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
9636         Some(crate::lightning::chain::Access),
9637         /// When we're in this state, this COption_AccessZ contains nothing
9638         None
9639 }
9640 impl COption_AccessZ {
9641         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9642                 if let Self::Some(_) = self { true } else { false }
9643         }
9644         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9645                 !self.is_some()
9646         }
9647         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
9648                 if let Self::Some(v) = self { v } else { unreachable!() }
9649         }
9650 }
9651 #[no_mangle]
9652 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
9653 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
9654         COption_AccessZ::Some(o)
9655 }
9656 #[no_mangle]
9657 /// Constructs a new COption_AccessZ containing nothing
9658 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
9659         COption_AccessZ::None
9660 }
9661 #[no_mangle]
9662 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
9663 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
9664 #[repr(C)]
9665 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
9666 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
9667         /// A pointer to the contents in the success state.
9668         /// Reading from this pointer when `result_ok` is not set is undefined.
9669         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
9670         /// A pointer to the contents in the error state.
9671         /// Reading from this pointer when `result_ok` is set is undefined.
9672         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9673 }
9674 #[repr(C)]
9675 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
9676 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9678 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
9679         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
9680         /// `err` or `result` depending on the state of `result_ok`.
9681         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
9682         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
9683         pub result_ok: bool,
9684 }
9685 #[no_mangle]
9686 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
9687 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
9688         CResult_DirectionalChannelInfoDecodeErrorZ {
9689                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9690                         result: Box::into_raw(Box::new(o)),
9691                 },
9692                 result_ok: true,
9693         }
9694 }
9695 #[no_mangle]
9696 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
9697 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
9698         CResult_DirectionalChannelInfoDecodeErrorZ {
9699                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9700                         err: Box::into_raw(Box::new(e)),
9701                 },
9702                 result_ok: false,
9703         }
9704 }
9705 /// Checks if the given object is currently in the success state
9706 #[no_mangle]
9707 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o: &CResult_DirectionalChannelInfoDecodeErrorZ) -> bool {
9708         o.result_ok
9709 }
9710 #[no_mangle]
9711 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
9712 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
9713 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
9714         fn drop(&mut self) {
9715                 if self.result_ok {
9716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9718                         }
9719                 } else {
9720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9722                         }
9723                 }
9724         }
9725 }
9726 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
9727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9728                 let contents = if o.result_ok {
9729                         let result = unsafe { o.contents.result };
9730                         unsafe { o.contents.result = std::ptr::null_mut() };
9731                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
9732                 } else {
9733                         let err = unsafe { o.contents.err };
9734                         unsafe { o.contents.err = std::ptr::null_mut(); }
9735                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
9736                 };
9737                 Self {
9738                         contents,
9739                         result_ok: o.result_ok,
9740                 }
9741         }
9742 }
9743 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
9744         fn clone(&self) -> Self {
9745                 if self.result_ok {
9746                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9747                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
9748                         } }
9749                 } else {
9750                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
9751                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9752                         } }
9753                 }
9754         }
9755 }
9756 #[no_mangle]
9757 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
9758 /// but with all dynamically-allocated buffers duplicated in new buffers.
9759 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
9760 #[repr(C)]
9761 /// The contents of CResult_ChannelInfoDecodeErrorZ
9762 pub union CResult_ChannelInfoDecodeErrorZPtr {
9763         /// A pointer to the contents in the success state.
9764         /// Reading from this pointer when `result_ok` is not set is undefined.
9765         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
9766         /// A pointer to the contents in the error state.
9767         /// Reading from this pointer when `result_ok` is set is undefined.
9768         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9769 }
9770 #[repr(C)]
9771 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
9772 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9774 pub struct CResult_ChannelInfoDecodeErrorZ {
9775         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
9776         /// `err` or `result` depending on the state of `result_ok`.
9777         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
9778         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
9779         pub result_ok: bool,
9780 }
9781 #[no_mangle]
9782 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
9783 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
9784         CResult_ChannelInfoDecodeErrorZ {
9785                 contents: CResult_ChannelInfoDecodeErrorZPtr {
9786                         result: Box::into_raw(Box::new(o)),
9787                 },
9788                 result_ok: true,
9789         }
9790 }
9791 #[no_mangle]
9792 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
9793 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
9794         CResult_ChannelInfoDecodeErrorZ {
9795                 contents: CResult_ChannelInfoDecodeErrorZPtr {
9796                         err: Box::into_raw(Box::new(e)),
9797                 },
9798                 result_ok: false,
9799         }
9800 }
9801 /// Checks if the given object is currently in the success state
9802 #[no_mangle]
9803 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
9804         o.result_ok
9805 }
9806 #[no_mangle]
9807 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
9808 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
9809 impl Drop for CResult_ChannelInfoDecodeErrorZ {
9810         fn drop(&mut self) {
9811                 if self.result_ok {
9812                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9813                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9814                         }
9815                 } else {
9816                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9817                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9818                         }
9819                 }
9820         }
9821 }
9822 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
9823         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9824                 let contents = if o.result_ok {
9825                         let result = unsafe { o.contents.result };
9826                         unsafe { o.contents.result = std::ptr::null_mut() };
9827                         CResult_ChannelInfoDecodeErrorZPtr { result }
9828                 } else {
9829                         let err = unsafe { o.contents.err };
9830                         unsafe { o.contents.err = std::ptr::null_mut(); }
9831                         CResult_ChannelInfoDecodeErrorZPtr { err }
9832                 };
9833                 Self {
9834                         contents,
9835                         result_ok: o.result_ok,
9836                 }
9837         }
9838 }
9839 impl Clone for CResult_ChannelInfoDecodeErrorZ {
9840         fn clone(&self) -> Self {
9841                 if self.result_ok {
9842                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
9843                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
9844                         } }
9845                 } else {
9846                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
9847                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9848                         } }
9849                 }
9850         }
9851 }
9852 #[no_mangle]
9853 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
9854 /// but with all dynamically-allocated buffers duplicated in new buffers.
9855 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
9856 #[repr(C)]
9857 /// The contents of CResult_RoutingFeesDecodeErrorZ
9858 pub union CResult_RoutingFeesDecodeErrorZPtr {
9859         /// A pointer to the contents in the success state.
9860         /// Reading from this pointer when `result_ok` is not set is undefined.
9861         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
9862         /// A pointer to the contents in the error state.
9863         /// Reading from this pointer when `result_ok` is set is undefined.
9864         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9865 }
9866 #[repr(C)]
9867 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
9868 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
9869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9870 pub struct CResult_RoutingFeesDecodeErrorZ {
9871         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
9872         /// `err` or `result` depending on the state of `result_ok`.
9873         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
9874         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
9875         pub result_ok: bool,
9876 }
9877 #[no_mangle]
9878 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
9879 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
9880         CResult_RoutingFeesDecodeErrorZ {
9881                 contents: CResult_RoutingFeesDecodeErrorZPtr {
9882                         result: Box::into_raw(Box::new(o)),
9883                 },
9884                 result_ok: true,
9885         }
9886 }
9887 #[no_mangle]
9888 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
9889 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
9890         CResult_RoutingFeesDecodeErrorZ {
9891                 contents: CResult_RoutingFeesDecodeErrorZPtr {
9892                         err: Box::into_raw(Box::new(e)),
9893                 },
9894                 result_ok: false,
9895         }
9896 }
9897 /// Checks if the given object is currently in the success state
9898 #[no_mangle]
9899 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
9900         o.result_ok
9901 }
9902 #[no_mangle]
9903 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
9904 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
9905 impl Drop for CResult_RoutingFeesDecodeErrorZ {
9906         fn drop(&mut self) {
9907                 if self.result_ok {
9908                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9909                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9910                         }
9911                 } else {
9912                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9913                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9914                         }
9915                 }
9916         }
9917 }
9918 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
9919         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
9920                 let contents = if o.result_ok {
9921                         let result = unsafe { o.contents.result };
9922                         unsafe { o.contents.result = std::ptr::null_mut() };
9923                         CResult_RoutingFeesDecodeErrorZPtr { result }
9924                 } else {
9925                         let err = unsafe { o.contents.err };
9926                         unsafe { o.contents.err = std::ptr::null_mut(); }
9927                         CResult_RoutingFeesDecodeErrorZPtr { err }
9928                 };
9929                 Self {
9930                         contents,
9931                         result_ok: o.result_ok,
9932                 }
9933         }
9934 }
9935 impl Clone for CResult_RoutingFeesDecodeErrorZ {
9936         fn clone(&self) -> Self {
9937                 if self.result_ok {
9938                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
9939                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
9940                         } }
9941                 } else {
9942                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
9943                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9944                         } }
9945                 }
9946         }
9947 }
9948 #[no_mangle]
9949 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
9950 /// but with all dynamically-allocated buffers duplicated in new buffers.
9951 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
9952 #[repr(C)]
9953 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
9954 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9955         /// A pointer to the contents in the success state.
9956         /// Reading from this pointer when `result_ok` is not set is undefined.
9957         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
9958         /// A pointer to the contents in the error state.
9959         /// Reading from this pointer when `result_ok` is set is undefined.
9960         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9961 }
9962 #[repr(C)]
9963 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
9964 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9966 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
9967         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
9968         /// `err` or `result` depending on the state of `result_ok`.
9969         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
9970         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
9971         pub result_ok: bool,
9972 }
9973 #[no_mangle]
9974 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
9975 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9976         CResult_NodeAnnouncementInfoDecodeErrorZ {
9977                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9978                         result: Box::into_raw(Box::new(o)),
9979                 },
9980                 result_ok: true,
9981         }
9982 }
9983 #[no_mangle]
9984 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
9985 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
9986         CResult_NodeAnnouncementInfoDecodeErrorZ {
9987                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
9988                         err: Box::into_raw(Box::new(e)),
9989                 },
9990                 result_ok: false,
9991         }
9992 }
9993 /// Checks if the given object is currently in the success state
9994 #[no_mangle]
9995 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
9996         o.result_ok
9997 }
9998 #[no_mangle]
9999 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10000 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
10001 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
10002         fn drop(&mut self) {
10003                 if self.result_ok {
10004                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10005                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10006                         }
10007                 } else {
10008                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10009                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10010                         }
10011                 }
10012         }
10013 }
10014 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
10015         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10016                 let contents = if o.result_ok {
10017                         let result = unsafe { o.contents.result };
10018                         unsafe { o.contents.result = std::ptr::null_mut() };
10019                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
10020                 } else {
10021                         let err = unsafe { o.contents.err };
10022                         unsafe { o.contents.err = std::ptr::null_mut(); }
10023                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
10024                 };
10025                 Self {
10026                         contents,
10027                         result_ok: o.result_ok,
10028                 }
10029         }
10030 }
10031 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
10032         fn clone(&self) -> Self {
10033                 if self.result_ok {
10034                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10035                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
10036                         } }
10037                 } else {
10038                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10039                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10040                         } }
10041                 }
10042         }
10043 }
10044 #[no_mangle]
10045 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10046 /// but with all dynamically-allocated buffers duplicated in new buffers.
10047 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
10048 #[repr(C)]
10049 /// A dynamically-allocated array of u64s of arbitrary size.
10050 /// This corresponds to std::vector in C++
10051 pub struct CVec_u64Z {
10052         /// The elements in the array.
10053         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10054         pub data: *mut u64,
10055         /// The number of elements pointed to by `data`.
10056         pub datalen: usize
10057 }
10058 impl CVec_u64Z {
10059         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
10060                 if self.datalen == 0 { return Vec::new(); }
10061                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10062                 self.data = std::ptr::null_mut();
10063                 self.datalen = 0;
10064                 ret
10065         }
10066         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
10067                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10068         }
10069 }
10070 impl From<Vec<u64>> for CVec_u64Z {
10071         fn from(v: Vec<u64>) -> Self {
10072                 let datalen = v.len();
10073                 let data = Box::into_raw(v.into_boxed_slice());
10074                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10075         }
10076 }
10077 #[no_mangle]
10078 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10079 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
10080 impl Drop for CVec_u64Z {
10081         fn drop(&mut self) {
10082                 if self.datalen == 0 { return; }
10083                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10084         }
10085 }
10086 impl Clone for CVec_u64Z {
10087         fn clone(&self) -> Self {
10088                 let mut res = Vec::new();
10089                 if self.datalen == 0 { return Self::from(res); }
10090                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10091                 Self::from(res)
10092         }
10093 }
10094 #[repr(C)]
10095 /// The contents of CResult_NodeInfoDecodeErrorZ
10096 pub union CResult_NodeInfoDecodeErrorZPtr {
10097         /// A pointer to the contents in the success state.
10098         /// Reading from this pointer when `result_ok` is not set is undefined.
10099         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
10100         /// A pointer to the contents in the error state.
10101         /// Reading from this pointer when `result_ok` is set is undefined.
10102         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10103 }
10104 #[repr(C)]
10105 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
10106 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10108 pub struct CResult_NodeInfoDecodeErrorZ {
10109         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
10110         /// `err` or `result` depending on the state of `result_ok`.
10111         pub contents: CResult_NodeInfoDecodeErrorZPtr,
10112         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
10113         pub result_ok: bool,
10114 }
10115 #[no_mangle]
10116 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10117 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
10118         CResult_NodeInfoDecodeErrorZ {
10119                 contents: CResult_NodeInfoDecodeErrorZPtr {
10120                         result: Box::into_raw(Box::new(o)),
10121                 },
10122                 result_ok: true,
10123         }
10124 }
10125 #[no_mangle]
10126 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10127 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
10128         CResult_NodeInfoDecodeErrorZ {
10129                 contents: CResult_NodeInfoDecodeErrorZPtr {
10130                         err: Box::into_raw(Box::new(e)),
10131                 },
10132                 result_ok: false,
10133         }
10134 }
10135 /// Checks if the given object is currently in the success state
10136 #[no_mangle]
10137 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
10138         o.result_ok
10139 }
10140 #[no_mangle]
10141 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10142 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
10143 impl Drop for CResult_NodeInfoDecodeErrorZ {
10144         fn drop(&mut self) {
10145                 if self.result_ok {
10146                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10147                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10148                         }
10149                 } else {
10150                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10151                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10152                         }
10153                 }
10154         }
10155 }
10156 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
10157         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10158                 let contents = if o.result_ok {
10159                         let result = unsafe { o.contents.result };
10160                         unsafe { o.contents.result = std::ptr::null_mut() };
10161                         CResult_NodeInfoDecodeErrorZPtr { result }
10162                 } else {
10163                         let err = unsafe { o.contents.err };
10164                         unsafe { o.contents.err = std::ptr::null_mut(); }
10165                         CResult_NodeInfoDecodeErrorZPtr { err }
10166                 };
10167                 Self {
10168                         contents,
10169                         result_ok: o.result_ok,
10170                 }
10171         }
10172 }
10173 impl Clone for CResult_NodeInfoDecodeErrorZ {
10174         fn clone(&self) -> Self {
10175                 if self.result_ok {
10176                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
10177                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
10178                         } }
10179                 } else {
10180                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
10181                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10182                         } }
10183                 }
10184         }
10185 }
10186 #[no_mangle]
10187 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10188 /// but with all dynamically-allocated buffers duplicated in new buffers.
10189 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
10190 #[repr(C)]
10191 /// The contents of CResult_NetworkGraphDecodeErrorZ
10192 pub union CResult_NetworkGraphDecodeErrorZPtr {
10193         /// A pointer to the contents in the success state.
10194         /// Reading from this pointer when `result_ok` is not set is undefined.
10195         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
10196         /// A pointer to the contents in the error state.
10197         /// Reading from this pointer when `result_ok` is set is undefined.
10198         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10199 }
10200 #[repr(C)]
10201 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
10202 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
10203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10204 pub struct CResult_NetworkGraphDecodeErrorZ {
10205         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
10206         /// `err` or `result` depending on the state of `result_ok`.
10207         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
10208         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
10209         pub result_ok: bool,
10210 }
10211 #[no_mangle]
10212 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10213 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
10214         CResult_NetworkGraphDecodeErrorZ {
10215                 contents: CResult_NetworkGraphDecodeErrorZPtr {
10216                         result: Box::into_raw(Box::new(o)),
10217                 },
10218                 result_ok: true,
10219         }
10220 }
10221 #[no_mangle]
10222 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10223 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
10224         CResult_NetworkGraphDecodeErrorZ {
10225                 contents: CResult_NetworkGraphDecodeErrorZPtr {
10226                         err: Box::into_raw(Box::new(e)),
10227                 },
10228                 result_ok: false,
10229         }
10230 }
10231 /// Checks if the given object is currently in the success state
10232 #[no_mangle]
10233 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
10234         o.result_ok
10235 }
10236 #[no_mangle]
10237 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10238 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
10239 impl Drop for CResult_NetworkGraphDecodeErrorZ {
10240         fn drop(&mut self) {
10241                 if self.result_ok {
10242                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10243                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10244                         }
10245                 } else {
10246                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10247                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10248                         }
10249                 }
10250         }
10251 }
10252 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
10253         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
10254                 let contents = if o.result_ok {
10255                         let result = unsafe { o.contents.result };
10256                         unsafe { o.contents.result = std::ptr::null_mut() };
10257                         CResult_NetworkGraphDecodeErrorZPtr { result }
10258                 } else {
10259                         let err = unsafe { o.contents.err };
10260                         unsafe { o.contents.err = std::ptr::null_mut(); }
10261                         CResult_NetworkGraphDecodeErrorZPtr { err }
10262                 };
10263                 Self {
10264                         contents,
10265                         result_ok: o.result_ok,
10266                 }
10267         }
10268 }
10269 impl Clone for CResult_NetworkGraphDecodeErrorZ {
10270         fn clone(&self) -> Self {
10271                 if self.result_ok {
10272                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
10273                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
10274                         } }
10275                 } else {
10276                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
10277                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10278                         } }
10279                 }
10280         }
10281 }
10282 #[no_mangle]
10283 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10284 /// but with all dynamically-allocated buffers duplicated in new buffers.
10285 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
10286 #[repr(C)]
10287 #[derive(Clone)]
10288 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
10289 pub enum COption_CVec_NetAddressZZ {
10290         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
10291         Some(crate::c_types::derived::CVec_NetAddressZ),
10292         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
10293         None
10294 }
10295 impl COption_CVec_NetAddressZZ {
10296         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10297                 if let Self::Some(_) = self { true } else { false }
10298         }
10299         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10300                 !self.is_some()
10301         }
10302         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
10303                 if let Self::Some(v) = self { v } else { unreachable!() }
10304         }
10305 }
10306 #[no_mangle]
10307 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
10308 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
10309         COption_CVec_NetAddressZZ::Some(o)
10310 }
10311 #[no_mangle]
10312 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
10313 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
10314         COption_CVec_NetAddressZZ::None
10315 }
10316 #[no_mangle]
10317 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
10318 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
10319 #[no_mangle]
10320 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
10321 /// but with all dynamically-allocated buffers duplicated in new buffers.
10322 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
10323 #[repr(C)]
10324 /// The contents of CResult_NetAddressDecodeErrorZ
10325 pub union CResult_NetAddressDecodeErrorZPtr {
10326         /// A pointer to the contents in the success state.
10327         /// Reading from this pointer when `result_ok` is not set is undefined.
10328         pub result: *mut crate::lightning::ln::msgs::NetAddress,
10329         /// A pointer to the contents in the error state.
10330         /// Reading from this pointer when `result_ok` is set is undefined.
10331         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10332 }
10333 #[repr(C)]
10334 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10335 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10336 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10337 pub struct CResult_NetAddressDecodeErrorZ {
10338         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10339         /// `err` or `result` depending on the state of `result_ok`.
10340         pub contents: CResult_NetAddressDecodeErrorZPtr,
10341         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10342         pub result_ok: bool,
10343 }
10344 #[no_mangle]
10345 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10346 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
10347         CResult_NetAddressDecodeErrorZ {
10348                 contents: CResult_NetAddressDecodeErrorZPtr {
10349                         result: Box::into_raw(Box::new(o)),
10350                 },
10351                 result_ok: true,
10352         }
10353 }
10354 #[no_mangle]
10355 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10356 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
10357         CResult_NetAddressDecodeErrorZ {
10358                 contents: CResult_NetAddressDecodeErrorZPtr {
10359                         err: Box::into_raw(Box::new(e)),
10360                 },
10361                 result_ok: false,
10362         }
10363 }
10364 /// Checks if the given object is currently in the success state
10365 #[no_mangle]
10366 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
10367         o.result_ok
10368 }
10369 #[no_mangle]
10370 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10371 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
10372 impl Drop for CResult_NetAddressDecodeErrorZ {
10373         fn drop(&mut self) {
10374                 if self.result_ok {
10375                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10376                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10377                         }
10378                 } else {
10379                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10380                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10381                         }
10382                 }
10383         }
10384 }
10385 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
10386         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
10387                 let contents = if o.result_ok {
10388                         let result = unsafe { o.contents.result };
10389                         unsafe { o.contents.result = std::ptr::null_mut() };
10390                         CResult_NetAddressDecodeErrorZPtr { result }
10391                 } else {
10392                         let err = unsafe { o.contents.err };
10393                         unsafe { o.contents.err = std::ptr::null_mut(); }
10394                         CResult_NetAddressDecodeErrorZPtr { err }
10395                 };
10396                 Self {
10397                         contents,
10398                         result_ok: o.result_ok,
10399                 }
10400         }
10401 }
10402 impl Clone for CResult_NetAddressDecodeErrorZ {
10403         fn clone(&self) -> Self {
10404                 if self.result_ok {
10405                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
10406                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
10407                         } }
10408                 } else {
10409                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
10410                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10411                         } }
10412                 }
10413         }
10414 }
10415 #[no_mangle]
10416 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10417 /// but with all dynamically-allocated buffers duplicated in new buffers.
10418 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
10419 #[repr(C)]
10420 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10421 /// This corresponds to std::vector in C++
10422 pub struct CVec_UpdateAddHTLCZ {
10423         /// The elements in the array.
10424         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10425         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10426         /// The number of elements pointed to by `data`.
10427         pub datalen: usize
10428 }
10429 impl CVec_UpdateAddHTLCZ {
10430         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
10431                 if self.datalen == 0 { return Vec::new(); }
10432                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10433                 self.data = std::ptr::null_mut();
10434                 self.datalen = 0;
10435                 ret
10436         }
10437         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
10438                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10439         }
10440 }
10441 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
10442         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
10443                 let datalen = v.len();
10444                 let data = Box::into_raw(v.into_boxed_slice());
10445                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10446         }
10447 }
10448 #[no_mangle]
10449 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10450 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
10451 impl Drop for CVec_UpdateAddHTLCZ {
10452         fn drop(&mut self) {
10453                 if self.datalen == 0 { return; }
10454                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10455         }
10456 }
10457 impl Clone for CVec_UpdateAddHTLCZ {
10458         fn clone(&self) -> Self {
10459                 let mut res = Vec::new();
10460                 if self.datalen == 0 { return Self::from(res); }
10461                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10462                 Self::from(res)
10463         }
10464 }
10465 #[repr(C)]
10466 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10467 /// This corresponds to std::vector in C++
10468 pub struct CVec_UpdateFulfillHTLCZ {
10469         /// The elements in the array.
10470         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10471         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10472         /// The number of elements pointed to by `data`.
10473         pub datalen: usize
10474 }
10475 impl CVec_UpdateFulfillHTLCZ {
10476         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
10477                 if self.datalen == 0 { return Vec::new(); }
10478                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10479                 self.data = std::ptr::null_mut();
10480                 self.datalen = 0;
10481                 ret
10482         }
10483         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
10484                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10485         }
10486 }
10487 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
10488         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
10489                 let datalen = v.len();
10490                 let data = Box::into_raw(v.into_boxed_slice());
10491                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10492         }
10493 }
10494 #[no_mangle]
10495 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10496 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
10497 impl Drop for CVec_UpdateFulfillHTLCZ {
10498         fn drop(&mut self) {
10499                 if self.datalen == 0 { return; }
10500                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10501         }
10502 }
10503 impl Clone for CVec_UpdateFulfillHTLCZ {
10504         fn clone(&self) -> Self {
10505                 let mut res = Vec::new();
10506                 if self.datalen == 0 { return Self::from(res); }
10507                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10508                 Self::from(res)
10509         }
10510 }
10511 #[repr(C)]
10512 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10513 /// This corresponds to std::vector in C++
10514 pub struct CVec_UpdateFailHTLCZ {
10515         /// The elements in the array.
10516         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10517         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10518         /// The number of elements pointed to by `data`.
10519         pub datalen: usize
10520 }
10521 impl CVec_UpdateFailHTLCZ {
10522         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
10523                 if self.datalen == 0 { return Vec::new(); }
10524                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10525                 self.data = std::ptr::null_mut();
10526                 self.datalen = 0;
10527                 ret
10528         }
10529         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
10530                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10531         }
10532 }
10533 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
10534         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
10535                 let datalen = v.len();
10536                 let data = Box::into_raw(v.into_boxed_slice());
10537                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10538         }
10539 }
10540 #[no_mangle]
10541 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10542 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
10543 impl Drop for CVec_UpdateFailHTLCZ {
10544         fn drop(&mut self) {
10545                 if self.datalen == 0 { return; }
10546                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10547         }
10548 }
10549 impl Clone for CVec_UpdateFailHTLCZ {
10550         fn clone(&self) -> Self {
10551                 let mut res = Vec::new();
10552                 if self.datalen == 0 { return Self::from(res); }
10553                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10554                 Self::from(res)
10555         }
10556 }
10557 #[repr(C)]
10558 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10559 /// This corresponds to std::vector in C++
10560 pub struct CVec_UpdateFailMalformedHTLCZ {
10561         /// The elements in the array.
10562         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10563         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10564         /// The number of elements pointed to by `data`.
10565         pub datalen: usize
10566 }
10567 impl CVec_UpdateFailMalformedHTLCZ {
10568         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
10569                 if self.datalen == 0 { return Vec::new(); }
10570                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10571                 self.data = std::ptr::null_mut();
10572                 self.datalen = 0;
10573                 ret
10574         }
10575         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
10576                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10577         }
10578 }
10579 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
10580         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
10581                 let datalen = v.len();
10582                 let data = Box::into_raw(v.into_boxed_slice());
10583                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10584         }
10585 }
10586 #[no_mangle]
10587 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10588 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
10589 impl Drop for CVec_UpdateFailMalformedHTLCZ {
10590         fn drop(&mut self) {
10591                 if self.datalen == 0 { return; }
10592                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10593         }
10594 }
10595 impl Clone for CVec_UpdateFailMalformedHTLCZ {
10596         fn clone(&self) -> Self {
10597                 let mut res = Vec::new();
10598                 if self.datalen == 0 { return Self::from(res); }
10599                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10600                 Self::from(res)
10601         }
10602 }
10603 #[repr(C)]
10604 /// The contents of CResult_AcceptChannelDecodeErrorZ
10605 pub union CResult_AcceptChannelDecodeErrorZPtr {
10606         /// A pointer to the contents in the success state.
10607         /// Reading from this pointer when `result_ok` is not set is undefined.
10608         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
10609         /// A pointer to the contents in the error state.
10610         /// Reading from this pointer when `result_ok` is set is undefined.
10611         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10612 }
10613 #[repr(C)]
10614 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10617 pub struct CResult_AcceptChannelDecodeErrorZ {
10618         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
10619         /// `err` or `result` depending on the state of `result_ok`.
10620         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
10621         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
10622         pub result_ok: bool,
10623 }
10624 #[no_mangle]
10625 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
10627         CResult_AcceptChannelDecodeErrorZ {
10628                 contents: CResult_AcceptChannelDecodeErrorZPtr {
10629                         result: Box::into_raw(Box::new(o)),
10630                 },
10631                 result_ok: true,
10632         }
10633 }
10634 #[no_mangle]
10635 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
10637         CResult_AcceptChannelDecodeErrorZ {
10638                 contents: CResult_AcceptChannelDecodeErrorZPtr {
10639                         err: Box::into_raw(Box::new(e)),
10640                 },
10641                 result_ok: false,
10642         }
10643 }
10644 /// Checks if the given object is currently in the success state
10645 #[no_mangle]
10646 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
10647         o.result_ok
10648 }
10649 #[no_mangle]
10650 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10651 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
10652 impl Drop for CResult_AcceptChannelDecodeErrorZ {
10653         fn drop(&mut self) {
10654                 if self.result_ok {
10655                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10656                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10657                         }
10658                 } else {
10659                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10660                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10661                         }
10662                 }
10663         }
10664 }
10665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
10666         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
10667                 let contents = if o.result_ok {
10668                         let result = unsafe { o.contents.result };
10669                         unsafe { o.contents.result = std::ptr::null_mut() };
10670                         CResult_AcceptChannelDecodeErrorZPtr { result }
10671                 } else {
10672                         let err = unsafe { o.contents.err };
10673                         unsafe { o.contents.err = std::ptr::null_mut(); }
10674                         CResult_AcceptChannelDecodeErrorZPtr { err }
10675                 };
10676                 Self {
10677                         contents,
10678                         result_ok: o.result_ok,
10679                 }
10680         }
10681 }
10682 impl Clone for CResult_AcceptChannelDecodeErrorZ {
10683         fn clone(&self) -> Self {
10684                 if self.result_ok {
10685                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
10686                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
10687                         } }
10688                 } else {
10689                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
10690                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10691                         } }
10692                 }
10693         }
10694 }
10695 #[no_mangle]
10696 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10697 /// but with all dynamically-allocated buffers duplicated in new buffers.
10698 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
10699 #[repr(C)]
10700 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
10701 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
10702         /// A pointer to the contents in the success state.
10703         /// Reading from this pointer when `result_ok` is not set is undefined.
10704         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
10705         /// A pointer to the contents in the error state.
10706         /// Reading from this pointer when `result_ok` is set is undefined.
10707         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10708 }
10709 #[repr(C)]
10710 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
10711 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
10712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10713 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
10714         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
10715         /// `err` or `result` depending on the state of `result_ok`.
10716         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
10717         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
10718         pub result_ok: bool,
10719 }
10720 #[no_mangle]
10721 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10722 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
10723         CResult_AnnouncementSignaturesDecodeErrorZ {
10724                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10725                         result: Box::into_raw(Box::new(o)),
10726                 },
10727                 result_ok: true,
10728         }
10729 }
10730 #[no_mangle]
10731 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10732 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
10733         CResult_AnnouncementSignaturesDecodeErrorZ {
10734                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10735                         err: Box::into_raw(Box::new(e)),
10736                 },
10737                 result_ok: false,
10738         }
10739 }
10740 /// Checks if the given object is currently in the success state
10741 #[no_mangle]
10742 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
10743         o.result_ok
10744 }
10745 #[no_mangle]
10746 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10747 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
10748 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
10749         fn drop(&mut self) {
10750                 if self.result_ok {
10751                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10752                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10753                         }
10754                 } else {
10755                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10756                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10757                         }
10758                 }
10759         }
10760 }
10761 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
10762         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
10763                 let contents = if o.result_ok {
10764                         let result = unsafe { o.contents.result };
10765                         unsafe { o.contents.result = std::ptr::null_mut() };
10766                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
10767                 } else {
10768                         let err = unsafe { o.contents.err };
10769                         unsafe { o.contents.err = std::ptr::null_mut(); }
10770                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
10771                 };
10772                 Self {
10773                         contents,
10774                         result_ok: o.result_ok,
10775                 }
10776         }
10777 }
10778 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
10779         fn clone(&self) -> Self {
10780                 if self.result_ok {
10781                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10782                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
10783                         } }
10784                 } else {
10785                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
10786                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10787                         } }
10788                 }
10789         }
10790 }
10791 #[no_mangle]
10792 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10793 /// but with all dynamically-allocated buffers duplicated in new buffers.
10794 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
10795 #[repr(C)]
10796 /// The contents of CResult_ChannelReestablishDecodeErrorZ
10797 pub union CResult_ChannelReestablishDecodeErrorZPtr {
10798         /// A pointer to the contents in the success state.
10799         /// Reading from this pointer when `result_ok` is not set is undefined.
10800         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
10801         /// A pointer to the contents in the error state.
10802         /// Reading from this pointer when `result_ok` is set is undefined.
10803         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10804 }
10805 #[repr(C)]
10806 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
10807 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
10808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10809 pub struct CResult_ChannelReestablishDecodeErrorZ {
10810         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
10811         /// `err` or `result` depending on the state of `result_ok`.
10812         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
10813         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
10814         pub result_ok: bool,
10815 }
10816 #[no_mangle]
10817 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10818 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
10819         CResult_ChannelReestablishDecodeErrorZ {
10820                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
10821                         result: Box::into_raw(Box::new(o)),
10822                 },
10823                 result_ok: true,
10824         }
10825 }
10826 #[no_mangle]
10827 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10828 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
10829         CResult_ChannelReestablishDecodeErrorZ {
10830                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
10831                         err: Box::into_raw(Box::new(e)),
10832                 },
10833                 result_ok: false,
10834         }
10835 }
10836 /// Checks if the given object is currently in the success state
10837 #[no_mangle]
10838 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
10839         o.result_ok
10840 }
10841 #[no_mangle]
10842 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10843 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
10844 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
10845         fn drop(&mut self) {
10846                 if self.result_ok {
10847                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10848                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10849                         }
10850                 } else {
10851                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10852                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10853                         }
10854                 }
10855         }
10856 }
10857 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
10858         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
10859                 let contents = if o.result_ok {
10860                         let result = unsafe { o.contents.result };
10861                         unsafe { o.contents.result = std::ptr::null_mut() };
10862                         CResult_ChannelReestablishDecodeErrorZPtr { result }
10863                 } else {
10864                         let err = unsafe { o.contents.err };
10865                         unsafe { o.contents.err = std::ptr::null_mut(); }
10866                         CResult_ChannelReestablishDecodeErrorZPtr { err }
10867                 };
10868                 Self {
10869                         contents,
10870                         result_ok: o.result_ok,
10871                 }
10872         }
10873 }
10874 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
10875         fn clone(&self) -> Self {
10876                 if self.result_ok {
10877                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
10878                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
10879                         } }
10880                 } else {
10881                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
10882                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10883                         } }
10884                 }
10885         }
10886 }
10887 #[no_mangle]
10888 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10889 /// but with all dynamically-allocated buffers duplicated in new buffers.
10890 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
10891 #[repr(C)]
10892 /// The contents of CResult_ClosingSignedDecodeErrorZ
10893 pub union CResult_ClosingSignedDecodeErrorZPtr {
10894         /// A pointer to the contents in the success state.
10895         /// Reading from this pointer when `result_ok` is not set is undefined.
10896         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
10897         /// A pointer to the contents in the error state.
10898         /// Reading from this pointer when `result_ok` is set is undefined.
10899         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10900 }
10901 #[repr(C)]
10902 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
10903 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10904 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10905 pub struct CResult_ClosingSignedDecodeErrorZ {
10906         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
10907         /// `err` or `result` depending on the state of `result_ok`.
10908         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
10909         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
10910         pub result_ok: bool,
10911 }
10912 #[no_mangle]
10913 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10914 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
10915         CResult_ClosingSignedDecodeErrorZ {
10916                 contents: CResult_ClosingSignedDecodeErrorZPtr {
10917                         result: Box::into_raw(Box::new(o)),
10918                 },
10919                 result_ok: true,
10920         }
10921 }
10922 #[no_mangle]
10923 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10924 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
10925         CResult_ClosingSignedDecodeErrorZ {
10926                 contents: CResult_ClosingSignedDecodeErrorZPtr {
10927                         err: Box::into_raw(Box::new(e)),
10928                 },
10929                 result_ok: false,
10930         }
10931 }
10932 /// Checks if the given object is currently in the success state
10933 #[no_mangle]
10934 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
10935         o.result_ok
10936 }
10937 #[no_mangle]
10938 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10939 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
10940 impl Drop for CResult_ClosingSignedDecodeErrorZ {
10941         fn drop(&mut self) {
10942                 if self.result_ok {
10943                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10944                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10945                         }
10946                 } else {
10947                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10948                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10949                         }
10950                 }
10951         }
10952 }
10953 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
10954         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
10955                 let contents = if o.result_ok {
10956                         let result = unsafe { o.contents.result };
10957                         unsafe { o.contents.result = std::ptr::null_mut() };
10958                         CResult_ClosingSignedDecodeErrorZPtr { result }
10959                 } else {
10960                         let err = unsafe { o.contents.err };
10961                         unsafe { o.contents.err = std::ptr::null_mut(); }
10962                         CResult_ClosingSignedDecodeErrorZPtr { err }
10963                 };
10964                 Self {
10965                         contents,
10966                         result_ok: o.result_ok,
10967                 }
10968         }
10969 }
10970 impl Clone for CResult_ClosingSignedDecodeErrorZ {
10971         fn clone(&self) -> Self {
10972                 if self.result_ok {
10973                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
10974                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
10975                         } }
10976                 } else {
10977                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
10978                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10979                         } }
10980                 }
10981         }
10982 }
10983 #[no_mangle]
10984 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10985 /// but with all dynamically-allocated buffers duplicated in new buffers.
10986 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
10987 #[repr(C)]
10988 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
10989 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10990         /// A pointer to the contents in the success state.
10991         /// Reading from this pointer when `result_ok` is not set is undefined.
10992         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
10993         /// A pointer to the contents in the error state.
10994         /// Reading from this pointer when `result_ok` is set is undefined.
10995         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10996 }
10997 #[repr(C)]
10998 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
10999 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11001 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
11002         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11003         /// `err` or `result` depending on the state of `result_ok`.
11004         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
11005         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11006         pub result_ok: bool,
11007 }
11008 #[no_mangle]
11009 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
11010 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11011         CResult_ClosingSignedFeeRangeDecodeErrorZ {
11012                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11013                         result: Box::into_raw(Box::new(o)),
11014                 },
11015                 result_ok: true,
11016         }
11017 }
11018 #[no_mangle]
11019 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
11020 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11021         CResult_ClosingSignedFeeRangeDecodeErrorZ {
11022                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11023                         err: Box::into_raw(Box::new(e)),
11024                 },
11025                 result_ok: false,
11026         }
11027 }
11028 /// Checks if the given object is currently in the success state
11029 #[no_mangle]
11030 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
11031         o.result_ok
11032 }
11033 #[no_mangle]
11034 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
11035 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
11036 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11037         fn drop(&mut self) {
11038                 if self.result_ok {
11039                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11040                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11041                         }
11042                 } else {
11043                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11044                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11045                         }
11046                 }
11047         }
11048 }
11049 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11050         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11051                 let contents = if o.result_ok {
11052                         let result = unsafe { o.contents.result };
11053                         unsafe { o.contents.result = std::ptr::null_mut() };
11054                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
11055                 } else {
11056                         let err = unsafe { o.contents.err };
11057                         unsafe { o.contents.err = std::ptr::null_mut(); }
11058                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
11059                 };
11060                 Self {
11061                         contents,
11062                         result_ok: o.result_ok,
11063                 }
11064         }
11065 }
11066 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11067         fn clone(&self) -> Self {
11068                 if self.result_ok {
11069                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11070                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
11071                         } }
11072                 } else {
11073                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11074                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11075                         } }
11076                 }
11077         }
11078 }
11079 #[no_mangle]
11080 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
11081 /// but with all dynamically-allocated buffers duplicated in new buffers.
11082 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
11083 #[repr(C)]
11084 /// The contents of CResult_CommitmentSignedDecodeErrorZ
11085 pub union CResult_CommitmentSignedDecodeErrorZPtr {
11086         /// A pointer to the contents in the success state.
11087         /// Reading from this pointer when `result_ok` is not set is undefined.
11088         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
11089         /// A pointer to the contents in the error state.
11090         /// Reading from this pointer when `result_ok` is set is undefined.
11091         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11092 }
11093 #[repr(C)]
11094 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11095 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11096 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11097 pub struct CResult_CommitmentSignedDecodeErrorZ {
11098         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11099         /// `err` or `result` depending on the state of `result_ok`.
11100         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
11101         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11102         pub result_ok: bool,
11103 }
11104 #[no_mangle]
11105 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11106 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
11107         CResult_CommitmentSignedDecodeErrorZ {
11108                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11109                         result: Box::into_raw(Box::new(o)),
11110                 },
11111                 result_ok: true,
11112         }
11113 }
11114 #[no_mangle]
11115 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11116 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
11117         CResult_CommitmentSignedDecodeErrorZ {
11118                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11119                         err: Box::into_raw(Box::new(e)),
11120                 },
11121                 result_ok: false,
11122         }
11123 }
11124 /// Checks if the given object is currently in the success state
11125 #[no_mangle]
11126 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
11127         o.result_ok
11128 }
11129 #[no_mangle]
11130 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11131 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
11132 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
11133         fn drop(&mut self) {
11134                 if self.result_ok {
11135                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11136                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11137                         }
11138                 } else {
11139                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11140                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11141                         }
11142                 }
11143         }
11144 }
11145 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
11146         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11147                 let contents = if o.result_ok {
11148                         let result = unsafe { o.contents.result };
11149                         unsafe { o.contents.result = std::ptr::null_mut() };
11150                         CResult_CommitmentSignedDecodeErrorZPtr { result }
11151                 } else {
11152                         let err = unsafe { o.contents.err };
11153                         unsafe { o.contents.err = std::ptr::null_mut(); }
11154                         CResult_CommitmentSignedDecodeErrorZPtr { err }
11155                 };
11156                 Self {
11157                         contents,
11158                         result_ok: o.result_ok,
11159                 }
11160         }
11161 }
11162 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
11163         fn clone(&self) -> Self {
11164                 if self.result_ok {
11165                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11166                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
11167                         } }
11168                 } else {
11169                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11170                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11171                         } }
11172                 }
11173         }
11174 }
11175 #[no_mangle]
11176 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11177 /// but with all dynamically-allocated buffers duplicated in new buffers.
11178 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
11179 #[repr(C)]
11180 /// The contents of CResult_FundingCreatedDecodeErrorZ
11181 pub union CResult_FundingCreatedDecodeErrorZPtr {
11182         /// A pointer to the contents in the success state.
11183         /// Reading from this pointer when `result_ok` is not set is undefined.
11184         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
11185         /// A pointer to the contents in the error state.
11186         /// Reading from this pointer when `result_ok` is set is undefined.
11187         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11188 }
11189 #[repr(C)]
11190 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11191 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11192 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11193 pub struct CResult_FundingCreatedDecodeErrorZ {
11194         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11195         /// `err` or `result` depending on the state of `result_ok`.
11196         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
11197         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11198         pub result_ok: bool,
11199 }
11200 #[no_mangle]
11201 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11202 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
11203         CResult_FundingCreatedDecodeErrorZ {
11204                 contents: CResult_FundingCreatedDecodeErrorZPtr {
11205                         result: Box::into_raw(Box::new(o)),
11206                 },
11207                 result_ok: true,
11208         }
11209 }
11210 #[no_mangle]
11211 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11212 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
11213         CResult_FundingCreatedDecodeErrorZ {
11214                 contents: CResult_FundingCreatedDecodeErrorZPtr {
11215                         err: Box::into_raw(Box::new(e)),
11216                 },
11217                 result_ok: false,
11218         }
11219 }
11220 /// Checks if the given object is currently in the success state
11221 #[no_mangle]
11222 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
11223         o.result_ok
11224 }
11225 #[no_mangle]
11226 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11227 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
11228 impl Drop for CResult_FundingCreatedDecodeErrorZ {
11229         fn drop(&mut self) {
11230                 if self.result_ok {
11231                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11232                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11233                         }
11234                 } else {
11235                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11236                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11237                         }
11238                 }
11239         }
11240 }
11241 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
11242         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
11243                 let contents = if o.result_ok {
11244                         let result = unsafe { o.contents.result };
11245                         unsafe { o.contents.result = std::ptr::null_mut() };
11246                         CResult_FundingCreatedDecodeErrorZPtr { result }
11247                 } else {
11248                         let err = unsafe { o.contents.err };
11249                         unsafe { o.contents.err = std::ptr::null_mut(); }
11250                         CResult_FundingCreatedDecodeErrorZPtr { err }
11251                 };
11252                 Self {
11253                         contents,
11254                         result_ok: o.result_ok,
11255                 }
11256         }
11257 }
11258 impl Clone for CResult_FundingCreatedDecodeErrorZ {
11259         fn clone(&self) -> Self {
11260                 if self.result_ok {
11261                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
11262                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
11263                         } }
11264                 } else {
11265                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
11266                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11267                         } }
11268                 }
11269         }
11270 }
11271 #[no_mangle]
11272 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11273 /// but with all dynamically-allocated buffers duplicated in new buffers.
11274 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
11275 #[repr(C)]
11276 /// The contents of CResult_FundingSignedDecodeErrorZ
11277 pub union CResult_FundingSignedDecodeErrorZPtr {
11278         /// A pointer to the contents in the success state.
11279         /// Reading from this pointer when `result_ok` is not set is undefined.
11280         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
11281         /// A pointer to the contents in the error state.
11282         /// Reading from this pointer when `result_ok` is set is undefined.
11283         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11284 }
11285 #[repr(C)]
11286 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11287 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11289 pub struct CResult_FundingSignedDecodeErrorZ {
11290         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11291         /// `err` or `result` depending on the state of `result_ok`.
11292         pub contents: CResult_FundingSignedDecodeErrorZPtr,
11293         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11294         pub result_ok: bool,
11295 }
11296 #[no_mangle]
11297 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11298 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
11299         CResult_FundingSignedDecodeErrorZ {
11300                 contents: CResult_FundingSignedDecodeErrorZPtr {
11301                         result: Box::into_raw(Box::new(o)),
11302                 },
11303                 result_ok: true,
11304         }
11305 }
11306 #[no_mangle]
11307 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11308 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
11309         CResult_FundingSignedDecodeErrorZ {
11310                 contents: CResult_FundingSignedDecodeErrorZPtr {
11311                         err: Box::into_raw(Box::new(e)),
11312                 },
11313                 result_ok: false,
11314         }
11315 }
11316 /// Checks if the given object is currently in the success state
11317 #[no_mangle]
11318 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
11319         o.result_ok
11320 }
11321 #[no_mangle]
11322 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11323 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
11324 impl Drop for CResult_FundingSignedDecodeErrorZ {
11325         fn drop(&mut self) {
11326                 if self.result_ok {
11327                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11328                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11329                         }
11330                 } else {
11331                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11332                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11333                         }
11334                 }
11335         }
11336 }
11337 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
11338         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11339                 let contents = if o.result_ok {
11340                         let result = unsafe { o.contents.result };
11341                         unsafe { o.contents.result = std::ptr::null_mut() };
11342                         CResult_FundingSignedDecodeErrorZPtr { result }
11343                 } else {
11344                         let err = unsafe { o.contents.err };
11345                         unsafe { o.contents.err = std::ptr::null_mut(); }
11346                         CResult_FundingSignedDecodeErrorZPtr { err }
11347                 };
11348                 Self {
11349                         contents,
11350                         result_ok: o.result_ok,
11351                 }
11352         }
11353 }
11354 impl Clone for CResult_FundingSignedDecodeErrorZ {
11355         fn clone(&self) -> Self {
11356                 if self.result_ok {
11357                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
11358                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
11359                         } }
11360                 } else {
11361                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
11362                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11363                         } }
11364                 }
11365         }
11366 }
11367 #[no_mangle]
11368 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11369 /// but with all dynamically-allocated buffers duplicated in new buffers.
11370 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
11371 #[repr(C)]
11372 /// The contents of CResult_FundingLockedDecodeErrorZ
11373 pub union CResult_FundingLockedDecodeErrorZPtr {
11374         /// A pointer to the contents in the success state.
11375         /// Reading from this pointer when `result_ok` is not set is undefined.
11376         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
11377         /// A pointer to the contents in the error state.
11378         /// Reading from this pointer when `result_ok` is set is undefined.
11379         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11380 }
11381 #[repr(C)]
11382 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
11383 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
11384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11385 pub struct CResult_FundingLockedDecodeErrorZ {
11386         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
11387         /// `err` or `result` depending on the state of `result_ok`.
11388         pub contents: CResult_FundingLockedDecodeErrorZPtr,
11389         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
11390         pub result_ok: bool,
11391 }
11392 #[no_mangle]
11393 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11394 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
11395         CResult_FundingLockedDecodeErrorZ {
11396                 contents: CResult_FundingLockedDecodeErrorZPtr {
11397                         result: Box::into_raw(Box::new(o)),
11398                 },
11399                 result_ok: true,
11400         }
11401 }
11402 #[no_mangle]
11403 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11404 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
11405         CResult_FundingLockedDecodeErrorZ {
11406                 contents: CResult_FundingLockedDecodeErrorZPtr {
11407                         err: Box::into_raw(Box::new(e)),
11408                 },
11409                 result_ok: false,
11410         }
11411 }
11412 /// Checks if the given object is currently in the success state
11413 #[no_mangle]
11414 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
11415         o.result_ok
11416 }
11417 #[no_mangle]
11418 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11419 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
11420 impl Drop for CResult_FundingLockedDecodeErrorZ {
11421         fn drop(&mut self) {
11422                 if self.result_ok {
11423                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11424                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11425                         }
11426                 } else {
11427                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11428                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11429                         }
11430                 }
11431         }
11432 }
11433 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
11434         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
11435                 let contents = if o.result_ok {
11436                         let result = unsafe { o.contents.result };
11437                         unsafe { o.contents.result = std::ptr::null_mut() };
11438                         CResult_FundingLockedDecodeErrorZPtr { result }
11439                 } else {
11440                         let err = unsafe { o.contents.err };
11441                         unsafe { o.contents.err = std::ptr::null_mut(); }
11442                         CResult_FundingLockedDecodeErrorZPtr { err }
11443                 };
11444                 Self {
11445                         contents,
11446                         result_ok: o.result_ok,
11447                 }
11448         }
11449 }
11450 impl Clone for CResult_FundingLockedDecodeErrorZ {
11451         fn clone(&self) -> Self {
11452                 if self.result_ok {
11453                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
11454                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
11455                         } }
11456                 } else {
11457                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
11458                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11459                         } }
11460                 }
11461         }
11462 }
11463 #[no_mangle]
11464 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11465 /// but with all dynamically-allocated buffers duplicated in new buffers.
11466 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
11467 #[repr(C)]
11468 /// The contents of CResult_InitDecodeErrorZ
11469 pub union CResult_InitDecodeErrorZPtr {
11470         /// A pointer to the contents in the success state.
11471         /// Reading from this pointer when `result_ok` is not set is undefined.
11472         pub result: *mut crate::lightning::ln::msgs::Init,
11473         /// A pointer to the contents in the error state.
11474         /// Reading from this pointer when `result_ok` is set is undefined.
11475         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11476 }
11477 #[repr(C)]
11478 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11479 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11480 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11481 pub struct CResult_InitDecodeErrorZ {
11482         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
11483         /// `err` or `result` depending on the state of `result_ok`.
11484         pub contents: CResult_InitDecodeErrorZPtr,
11485         /// Whether this CResult_InitDecodeErrorZ represents a success state.
11486         pub result_ok: bool,
11487 }
11488 #[no_mangle]
11489 /// Creates a new CResult_InitDecodeErrorZ in the success state.
11490 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
11491         CResult_InitDecodeErrorZ {
11492                 contents: CResult_InitDecodeErrorZPtr {
11493                         result: Box::into_raw(Box::new(o)),
11494                 },
11495                 result_ok: true,
11496         }
11497 }
11498 #[no_mangle]
11499 /// Creates a new CResult_InitDecodeErrorZ in the error state.
11500 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
11501         CResult_InitDecodeErrorZ {
11502                 contents: CResult_InitDecodeErrorZPtr {
11503                         err: Box::into_raw(Box::new(e)),
11504                 },
11505                 result_ok: false,
11506         }
11507 }
11508 /// Checks if the given object is currently in the success state
11509 #[no_mangle]
11510 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
11511         o.result_ok
11512 }
11513 #[no_mangle]
11514 /// Frees any resources used by the CResult_InitDecodeErrorZ.
11515 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
11516 impl Drop for CResult_InitDecodeErrorZ {
11517         fn drop(&mut self) {
11518                 if self.result_ok {
11519                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11520                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11521                         }
11522                 } else {
11523                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11524                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11525                         }
11526                 }
11527         }
11528 }
11529 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
11530         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
11531                 let contents = if o.result_ok {
11532                         let result = unsafe { o.contents.result };
11533                         unsafe { o.contents.result = std::ptr::null_mut() };
11534                         CResult_InitDecodeErrorZPtr { result }
11535                 } else {
11536                         let err = unsafe { o.contents.err };
11537                         unsafe { o.contents.err = std::ptr::null_mut(); }
11538                         CResult_InitDecodeErrorZPtr { err }
11539                 };
11540                 Self {
11541                         contents,
11542                         result_ok: o.result_ok,
11543                 }
11544         }
11545 }
11546 impl Clone for CResult_InitDecodeErrorZ {
11547         fn clone(&self) -> Self {
11548                 if self.result_ok {
11549                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
11550                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
11551                         } }
11552                 } else {
11553                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
11554                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11555                         } }
11556                 }
11557         }
11558 }
11559 #[no_mangle]
11560 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11561 /// but with all dynamically-allocated buffers duplicated in new buffers.
11562 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
11563 #[repr(C)]
11564 /// The contents of CResult_OpenChannelDecodeErrorZ
11565 pub union CResult_OpenChannelDecodeErrorZPtr {
11566         /// A pointer to the contents in the success state.
11567         /// Reading from this pointer when `result_ok` is not set is undefined.
11568         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
11569         /// A pointer to the contents in the error state.
11570         /// Reading from this pointer when `result_ok` is set is undefined.
11571         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11572 }
11573 #[repr(C)]
11574 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11575 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11576 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11577 pub struct CResult_OpenChannelDecodeErrorZ {
11578         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11579         /// `err` or `result` depending on the state of `result_ok`.
11580         pub contents: CResult_OpenChannelDecodeErrorZPtr,
11581         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
11582         pub result_ok: bool,
11583 }
11584 #[no_mangle]
11585 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11586 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
11587         CResult_OpenChannelDecodeErrorZ {
11588                 contents: CResult_OpenChannelDecodeErrorZPtr {
11589                         result: Box::into_raw(Box::new(o)),
11590                 },
11591                 result_ok: true,
11592         }
11593 }
11594 #[no_mangle]
11595 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
11596 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
11597         CResult_OpenChannelDecodeErrorZ {
11598                 contents: CResult_OpenChannelDecodeErrorZPtr {
11599                         err: Box::into_raw(Box::new(e)),
11600                 },
11601                 result_ok: false,
11602         }
11603 }
11604 /// Checks if the given object is currently in the success state
11605 #[no_mangle]
11606 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
11607         o.result_ok
11608 }
11609 #[no_mangle]
11610 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
11611 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
11612 impl Drop for CResult_OpenChannelDecodeErrorZ {
11613         fn drop(&mut self) {
11614                 if self.result_ok {
11615                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11616                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11617                         }
11618                 } else {
11619                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11620                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11621                         }
11622                 }
11623         }
11624 }
11625 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
11626         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11627                 let contents = if o.result_ok {
11628                         let result = unsafe { o.contents.result };
11629                         unsafe { o.contents.result = std::ptr::null_mut() };
11630                         CResult_OpenChannelDecodeErrorZPtr { result }
11631                 } else {
11632                         let err = unsafe { o.contents.err };
11633                         unsafe { o.contents.err = std::ptr::null_mut(); }
11634                         CResult_OpenChannelDecodeErrorZPtr { err }
11635                 };
11636                 Self {
11637                         contents,
11638                         result_ok: o.result_ok,
11639                 }
11640         }
11641 }
11642 impl Clone for CResult_OpenChannelDecodeErrorZ {
11643         fn clone(&self) -> Self {
11644                 if self.result_ok {
11645                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
11646                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
11647                         } }
11648                 } else {
11649                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
11650                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11651                         } }
11652                 }
11653         }
11654 }
11655 #[no_mangle]
11656 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
11657 /// but with all dynamically-allocated buffers duplicated in new buffers.
11658 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
11659 #[repr(C)]
11660 /// The contents of CResult_RevokeAndACKDecodeErrorZ
11661 pub union CResult_RevokeAndACKDecodeErrorZPtr {
11662         /// A pointer to the contents in the success state.
11663         /// Reading from this pointer when `result_ok` is not set is undefined.
11664         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
11665         /// A pointer to the contents in the error state.
11666         /// Reading from this pointer when `result_ok` is set is undefined.
11667         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11668 }
11669 #[repr(C)]
11670 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
11671 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
11672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11673 pub struct CResult_RevokeAndACKDecodeErrorZ {
11674         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
11675         /// `err` or `result` depending on the state of `result_ok`.
11676         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
11677         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
11678         pub result_ok: bool,
11679 }
11680 #[no_mangle]
11681 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
11682 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
11683         CResult_RevokeAndACKDecodeErrorZ {
11684                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
11685                         result: Box::into_raw(Box::new(o)),
11686                 },
11687                 result_ok: true,
11688         }
11689 }
11690 #[no_mangle]
11691 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
11692 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
11693         CResult_RevokeAndACKDecodeErrorZ {
11694                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
11695                         err: Box::into_raw(Box::new(e)),
11696                 },
11697                 result_ok: false,
11698         }
11699 }
11700 /// Checks if the given object is currently in the success state
11701 #[no_mangle]
11702 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
11703         o.result_ok
11704 }
11705 #[no_mangle]
11706 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
11707 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
11708 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
11709         fn drop(&mut self) {
11710                 if self.result_ok {
11711                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11712                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11713                         }
11714                 } else {
11715                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11716                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11717                         }
11718                 }
11719         }
11720 }
11721 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
11722         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
11723                 let contents = if o.result_ok {
11724                         let result = unsafe { o.contents.result };
11725                         unsafe { o.contents.result = std::ptr::null_mut() };
11726                         CResult_RevokeAndACKDecodeErrorZPtr { result }
11727                 } else {
11728                         let err = unsafe { o.contents.err };
11729                         unsafe { o.contents.err = std::ptr::null_mut(); }
11730                         CResult_RevokeAndACKDecodeErrorZPtr { err }
11731                 };
11732                 Self {
11733                         contents,
11734                         result_ok: o.result_ok,
11735                 }
11736         }
11737 }
11738 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
11739         fn clone(&self) -> Self {
11740                 if self.result_ok {
11741                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
11742                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
11743                         } }
11744                 } else {
11745                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
11746                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11747                         } }
11748                 }
11749         }
11750 }
11751 #[no_mangle]
11752 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
11753 /// but with all dynamically-allocated buffers duplicated in new buffers.
11754 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
11755 #[repr(C)]
11756 /// The contents of CResult_ShutdownDecodeErrorZ
11757 pub union CResult_ShutdownDecodeErrorZPtr {
11758         /// A pointer to the contents in the success state.
11759         /// Reading from this pointer when `result_ok` is not set is undefined.
11760         pub result: *mut crate::lightning::ln::msgs::Shutdown,
11761         /// A pointer to the contents in the error state.
11762         /// Reading from this pointer when `result_ok` is set is undefined.
11763         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11764 }
11765 #[repr(C)]
11766 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
11767 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
11768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11769 pub struct CResult_ShutdownDecodeErrorZ {
11770         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
11771         /// `err` or `result` depending on the state of `result_ok`.
11772         pub contents: CResult_ShutdownDecodeErrorZPtr,
11773         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
11774         pub result_ok: bool,
11775 }
11776 #[no_mangle]
11777 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
11778 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
11779         CResult_ShutdownDecodeErrorZ {
11780                 contents: CResult_ShutdownDecodeErrorZPtr {
11781                         result: Box::into_raw(Box::new(o)),
11782                 },
11783                 result_ok: true,
11784         }
11785 }
11786 #[no_mangle]
11787 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
11788 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
11789         CResult_ShutdownDecodeErrorZ {
11790                 contents: CResult_ShutdownDecodeErrorZPtr {
11791                         err: Box::into_raw(Box::new(e)),
11792                 },
11793                 result_ok: false,
11794         }
11795 }
11796 /// Checks if the given object is currently in the success state
11797 #[no_mangle]
11798 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
11799         o.result_ok
11800 }
11801 #[no_mangle]
11802 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
11803 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
11804 impl Drop for CResult_ShutdownDecodeErrorZ {
11805         fn drop(&mut self) {
11806                 if self.result_ok {
11807                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11808                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11809                         }
11810                 } else {
11811                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11812                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11813                         }
11814                 }
11815         }
11816 }
11817 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
11818         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
11819                 let contents = if o.result_ok {
11820                         let result = unsafe { o.contents.result };
11821                         unsafe { o.contents.result = std::ptr::null_mut() };
11822                         CResult_ShutdownDecodeErrorZPtr { result }
11823                 } else {
11824                         let err = unsafe { o.contents.err };
11825                         unsafe { o.contents.err = std::ptr::null_mut(); }
11826                         CResult_ShutdownDecodeErrorZPtr { err }
11827                 };
11828                 Self {
11829                         contents,
11830                         result_ok: o.result_ok,
11831                 }
11832         }
11833 }
11834 impl Clone for CResult_ShutdownDecodeErrorZ {
11835         fn clone(&self) -> Self {
11836                 if self.result_ok {
11837                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
11838                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
11839                         } }
11840                 } else {
11841                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
11842                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11843                         } }
11844                 }
11845         }
11846 }
11847 #[no_mangle]
11848 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
11849 /// but with all dynamically-allocated buffers duplicated in new buffers.
11850 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
11851 #[repr(C)]
11852 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
11853 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
11854         /// A pointer to the contents in the success state.
11855         /// Reading from this pointer when `result_ok` is not set is undefined.
11856         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11857         /// A pointer to the contents in the error state.
11858         /// Reading from this pointer when `result_ok` is set is undefined.
11859         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11860 }
11861 #[repr(C)]
11862 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
11863 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11865 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
11866         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
11867         /// `err` or `result` depending on the state of `result_ok`.
11868         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
11869         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
11870         pub result_ok: bool,
11871 }
11872 #[no_mangle]
11873 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
11874 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
11875         CResult_UpdateFailHTLCDecodeErrorZ {
11876                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11877                         result: Box::into_raw(Box::new(o)),
11878                 },
11879                 result_ok: true,
11880         }
11881 }
11882 #[no_mangle]
11883 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
11884 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
11885         CResult_UpdateFailHTLCDecodeErrorZ {
11886                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11887                         err: Box::into_raw(Box::new(e)),
11888                 },
11889                 result_ok: false,
11890         }
11891 }
11892 /// Checks if the given object is currently in the success state
11893 #[no_mangle]
11894 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
11895         o.result_ok
11896 }
11897 #[no_mangle]
11898 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
11899 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
11900 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
11901         fn drop(&mut self) {
11902                 if self.result_ok {
11903                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11904                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11905                         }
11906                 } else {
11907                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11908                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11909                         }
11910                 }
11911         }
11912 }
11913 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
11914         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
11915                 let contents = if o.result_ok {
11916                         let result = unsafe { o.contents.result };
11917                         unsafe { o.contents.result = std::ptr::null_mut() };
11918                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
11919                 } else {
11920                         let err = unsafe { o.contents.err };
11921                         unsafe { o.contents.err = std::ptr::null_mut(); }
11922                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
11923                 };
11924                 Self {
11925                         contents,
11926                         result_ok: o.result_ok,
11927                 }
11928         }
11929 }
11930 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
11931         fn clone(&self) -> Self {
11932                 if self.result_ok {
11933                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11934                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
11935                         } }
11936                 } else {
11937                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
11938                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11939                         } }
11940                 }
11941         }
11942 }
11943 #[no_mangle]
11944 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
11945 /// but with all dynamically-allocated buffers duplicated in new buffers.
11946 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
11947 #[repr(C)]
11948 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
11949 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11950         /// A pointer to the contents in the success state.
11951         /// Reading from this pointer when `result_ok` is not set is undefined.
11952         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11953         /// A pointer to the contents in the error state.
11954         /// Reading from this pointer when `result_ok` is set is undefined.
11955         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11956 }
11957 #[repr(C)]
11958 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
11959 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11960 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11961 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11962         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
11963         /// `err` or `result` depending on the state of `result_ok`.
11964         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
11965         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
11966         pub result_ok: bool,
11967 }
11968 #[no_mangle]
11969 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
11970 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11971         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11972                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11973                         result: Box::into_raw(Box::new(o)),
11974                 },
11975                 result_ok: true,
11976         }
11977 }
11978 #[no_mangle]
11979 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11980 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11981         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11982                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11983                         err: Box::into_raw(Box::new(e)),
11984                 },
11985                 result_ok: false,
11986         }
11987 }
11988 /// Checks if the given object is currently in the success state
11989 #[no_mangle]
11990 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
11991         o.result_ok
11992 }
11993 #[no_mangle]
11994 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11995 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
11996 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
11997         fn drop(&mut self) {
11998                 if self.result_ok {
11999                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12000                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12001                         }
12002                 } else {
12003                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12004                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12005                         }
12006                 }
12007         }
12008 }
12009 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12010         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12011                 let contents = if o.result_ok {
12012                         let result = unsafe { o.contents.result };
12013                         unsafe { o.contents.result = std::ptr::null_mut() };
12014                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
12015                 } else {
12016                         let err = unsafe { o.contents.err };
12017                         unsafe { o.contents.err = std::ptr::null_mut(); }
12018                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
12019                 };
12020                 Self {
12021                         contents,
12022                         result_ok: o.result_ok,
12023                 }
12024         }
12025 }
12026 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12027         fn clone(&self) -> Self {
12028                 if self.result_ok {
12029                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12030                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
12031                         } }
12032                 } else {
12033                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12034                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12035                         } }
12036                 }
12037         }
12038 }
12039 #[no_mangle]
12040 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12041 /// but with all dynamically-allocated buffers duplicated in new buffers.
12042 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
12043 #[repr(C)]
12044 /// The contents of CResult_UpdateFeeDecodeErrorZ
12045 pub union CResult_UpdateFeeDecodeErrorZPtr {
12046         /// A pointer to the contents in the success state.
12047         /// Reading from this pointer when `result_ok` is not set is undefined.
12048         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
12049         /// A pointer to the contents in the error state.
12050         /// Reading from this pointer when `result_ok` is set is undefined.
12051         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12052 }
12053 #[repr(C)]
12054 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12055 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
12056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12057 pub struct CResult_UpdateFeeDecodeErrorZ {
12058         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12059         /// `err` or `result` depending on the state of `result_ok`.
12060         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
12061         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12062         pub result_ok: bool,
12063 }
12064 #[no_mangle]
12065 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12066 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
12067         CResult_UpdateFeeDecodeErrorZ {
12068                 contents: CResult_UpdateFeeDecodeErrorZPtr {
12069                         result: Box::into_raw(Box::new(o)),
12070                 },
12071                 result_ok: true,
12072         }
12073 }
12074 #[no_mangle]
12075 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12076 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
12077         CResult_UpdateFeeDecodeErrorZ {
12078                 contents: CResult_UpdateFeeDecodeErrorZPtr {
12079                         err: Box::into_raw(Box::new(e)),
12080                 },
12081                 result_ok: false,
12082         }
12083 }
12084 /// Checks if the given object is currently in the success state
12085 #[no_mangle]
12086 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
12087         o.result_ok
12088 }
12089 #[no_mangle]
12090 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12091 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
12092 impl Drop for CResult_UpdateFeeDecodeErrorZ {
12093         fn drop(&mut self) {
12094                 if self.result_ok {
12095                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12096                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12097                         }
12098                 } else {
12099                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12100                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12101                         }
12102                 }
12103         }
12104 }
12105 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
12106         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
12107                 let contents = if o.result_ok {
12108                         let result = unsafe { o.contents.result };
12109                         unsafe { o.contents.result = std::ptr::null_mut() };
12110                         CResult_UpdateFeeDecodeErrorZPtr { result }
12111                 } else {
12112                         let err = unsafe { o.contents.err };
12113                         unsafe { o.contents.err = std::ptr::null_mut(); }
12114                         CResult_UpdateFeeDecodeErrorZPtr { err }
12115                 };
12116                 Self {
12117                         contents,
12118                         result_ok: o.result_ok,
12119                 }
12120         }
12121 }
12122 impl Clone for CResult_UpdateFeeDecodeErrorZ {
12123         fn clone(&self) -> Self {
12124                 if self.result_ok {
12125                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
12126                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
12127                         } }
12128                 } else {
12129                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
12130                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12131                         } }
12132                 }
12133         }
12134 }
12135 #[no_mangle]
12136 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12137 /// but with all dynamically-allocated buffers duplicated in new buffers.
12138 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
12139 #[repr(C)]
12140 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12141 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12142         /// A pointer to the contents in the success state.
12143         /// Reading from this pointer when `result_ok` is not set is undefined.
12144         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12145         /// A pointer to the contents in the error state.
12146         /// Reading from this pointer when `result_ok` is set is undefined.
12147         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12148 }
12149 #[repr(C)]
12150 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12151 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12153 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
12154         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12155         /// `err` or `result` depending on the state of `result_ok`.
12156         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
12157         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12158         pub result_ok: bool,
12159 }
12160 #[no_mangle]
12161 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12162 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12163         CResult_UpdateFulfillHTLCDecodeErrorZ {
12164                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12165                         result: Box::into_raw(Box::new(o)),
12166                 },
12167                 result_ok: true,
12168         }
12169 }
12170 #[no_mangle]
12171 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12172 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12173         CResult_UpdateFulfillHTLCDecodeErrorZ {
12174                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12175                         err: Box::into_raw(Box::new(e)),
12176                 },
12177                 result_ok: false,
12178         }
12179 }
12180 /// Checks if the given object is currently in the success state
12181 #[no_mangle]
12182 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
12183         o.result_ok
12184 }
12185 #[no_mangle]
12186 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12187 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
12188 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
12189         fn drop(&mut self) {
12190                 if self.result_ok {
12191                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12192                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12193                         }
12194                 } else {
12195                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12196                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12197                         }
12198                 }
12199         }
12200 }
12201 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
12202         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12203                 let contents = if o.result_ok {
12204                         let result = unsafe { o.contents.result };
12205                         unsafe { o.contents.result = std::ptr::null_mut() };
12206                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
12207                 } else {
12208                         let err = unsafe { o.contents.err };
12209                         unsafe { o.contents.err = std::ptr::null_mut(); }
12210                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
12211                 };
12212                 Self {
12213                         contents,
12214                         result_ok: o.result_ok,
12215                 }
12216         }
12217 }
12218 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
12219         fn clone(&self) -> Self {
12220                 if self.result_ok {
12221                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12222                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
12223                         } }
12224                 } else {
12225                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12226                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12227                         } }
12228                 }
12229         }
12230 }
12231 #[no_mangle]
12232 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12233 /// but with all dynamically-allocated buffers duplicated in new buffers.
12234 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
12235 #[repr(C)]
12236 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
12237 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
12238         /// A pointer to the contents in the success state.
12239         /// Reading from this pointer when `result_ok` is not set is undefined.
12240         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12241         /// A pointer to the contents in the error state.
12242         /// Reading from this pointer when `result_ok` is set is undefined.
12243         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12244 }
12245 #[repr(C)]
12246 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12247 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12249 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
12250         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12251         /// `err` or `result` depending on the state of `result_ok`.
12252         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
12253         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12254         pub result_ok: bool,
12255 }
12256 #[no_mangle]
12257 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12258 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
12259         CResult_UpdateAddHTLCDecodeErrorZ {
12260                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12261                         result: Box::into_raw(Box::new(o)),
12262                 },
12263                 result_ok: true,
12264         }
12265 }
12266 #[no_mangle]
12267 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12268 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
12269         CResult_UpdateAddHTLCDecodeErrorZ {
12270                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12271                         err: Box::into_raw(Box::new(e)),
12272                 },
12273                 result_ok: false,
12274         }
12275 }
12276 /// Checks if the given object is currently in the success state
12277 #[no_mangle]
12278 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
12279         o.result_ok
12280 }
12281 #[no_mangle]
12282 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12283 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
12284 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
12285         fn drop(&mut self) {
12286                 if self.result_ok {
12287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12289                         }
12290                 } else {
12291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12293                         }
12294                 }
12295         }
12296 }
12297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
12298         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12299                 let contents = if o.result_ok {
12300                         let result = unsafe { o.contents.result };
12301                         unsafe { o.contents.result = std::ptr::null_mut() };
12302                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
12303                 } else {
12304                         let err = unsafe { o.contents.err };
12305                         unsafe { o.contents.err = std::ptr::null_mut(); }
12306                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
12307                 };
12308                 Self {
12309                         contents,
12310                         result_ok: o.result_ok,
12311                 }
12312         }
12313 }
12314 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
12315         fn clone(&self) -> Self {
12316                 if self.result_ok {
12317                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12318                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
12319                         } }
12320                 } else {
12321                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12322                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12323                         } }
12324                 }
12325         }
12326 }
12327 #[no_mangle]
12328 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12329 /// but with all dynamically-allocated buffers duplicated in new buffers.
12330 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
12331 #[repr(C)]
12332 /// The contents of CResult_PingDecodeErrorZ
12333 pub union CResult_PingDecodeErrorZPtr {
12334         /// A pointer to the contents in the success state.
12335         /// Reading from this pointer when `result_ok` is not set is undefined.
12336         pub result: *mut crate::lightning::ln::msgs::Ping,
12337         /// A pointer to the contents in the error state.
12338         /// Reading from this pointer when `result_ok` is set is undefined.
12339         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12340 }
12341 #[repr(C)]
12342 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12343 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12345 pub struct CResult_PingDecodeErrorZ {
12346         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
12347         /// `err` or `result` depending on the state of `result_ok`.
12348         pub contents: CResult_PingDecodeErrorZPtr,
12349         /// Whether this CResult_PingDecodeErrorZ represents a success state.
12350         pub result_ok: bool,
12351 }
12352 #[no_mangle]
12353 /// Creates a new CResult_PingDecodeErrorZ in the success state.
12354 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
12355         CResult_PingDecodeErrorZ {
12356                 contents: CResult_PingDecodeErrorZPtr {
12357                         result: Box::into_raw(Box::new(o)),
12358                 },
12359                 result_ok: true,
12360         }
12361 }
12362 #[no_mangle]
12363 /// Creates a new CResult_PingDecodeErrorZ in the error state.
12364 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
12365         CResult_PingDecodeErrorZ {
12366                 contents: CResult_PingDecodeErrorZPtr {
12367                         err: Box::into_raw(Box::new(e)),
12368                 },
12369                 result_ok: false,
12370         }
12371 }
12372 /// Checks if the given object is currently in the success state
12373 #[no_mangle]
12374 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
12375         o.result_ok
12376 }
12377 #[no_mangle]
12378 /// Frees any resources used by the CResult_PingDecodeErrorZ.
12379 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
12380 impl Drop for CResult_PingDecodeErrorZ {
12381         fn drop(&mut self) {
12382                 if self.result_ok {
12383                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12384                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12385                         }
12386                 } else {
12387                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12388                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12389                         }
12390                 }
12391         }
12392 }
12393 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
12394         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
12395                 let contents = if o.result_ok {
12396                         let result = unsafe { o.contents.result };
12397                         unsafe { o.contents.result = std::ptr::null_mut() };
12398                         CResult_PingDecodeErrorZPtr { result }
12399                 } else {
12400                         let err = unsafe { o.contents.err };
12401                         unsafe { o.contents.err = std::ptr::null_mut(); }
12402                         CResult_PingDecodeErrorZPtr { err }
12403                 };
12404                 Self {
12405                         contents,
12406                         result_ok: o.result_ok,
12407                 }
12408         }
12409 }
12410 impl Clone for CResult_PingDecodeErrorZ {
12411         fn clone(&self) -> Self {
12412                 if self.result_ok {
12413                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
12414                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
12415                         } }
12416                 } else {
12417                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
12418                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12419                         } }
12420                 }
12421         }
12422 }
12423 #[no_mangle]
12424 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12425 /// but with all dynamically-allocated buffers duplicated in new buffers.
12426 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
12427 #[repr(C)]
12428 /// The contents of CResult_PongDecodeErrorZ
12429 pub union CResult_PongDecodeErrorZPtr {
12430         /// A pointer to the contents in the success state.
12431         /// Reading from this pointer when `result_ok` is not set is undefined.
12432         pub result: *mut crate::lightning::ln::msgs::Pong,
12433         /// A pointer to the contents in the error state.
12434         /// Reading from this pointer when `result_ok` is set is undefined.
12435         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12436 }
12437 #[repr(C)]
12438 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12439 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12441 pub struct CResult_PongDecodeErrorZ {
12442         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
12443         /// `err` or `result` depending on the state of `result_ok`.
12444         pub contents: CResult_PongDecodeErrorZPtr,
12445         /// Whether this CResult_PongDecodeErrorZ represents a success state.
12446         pub result_ok: bool,
12447 }
12448 #[no_mangle]
12449 /// Creates a new CResult_PongDecodeErrorZ in the success state.
12450 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
12451         CResult_PongDecodeErrorZ {
12452                 contents: CResult_PongDecodeErrorZPtr {
12453                         result: Box::into_raw(Box::new(o)),
12454                 },
12455                 result_ok: true,
12456         }
12457 }
12458 #[no_mangle]
12459 /// Creates a new CResult_PongDecodeErrorZ in the error state.
12460 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
12461         CResult_PongDecodeErrorZ {
12462                 contents: CResult_PongDecodeErrorZPtr {
12463                         err: Box::into_raw(Box::new(e)),
12464                 },
12465                 result_ok: false,
12466         }
12467 }
12468 /// Checks if the given object is currently in the success state
12469 #[no_mangle]
12470 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
12471         o.result_ok
12472 }
12473 #[no_mangle]
12474 /// Frees any resources used by the CResult_PongDecodeErrorZ.
12475 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
12476 impl Drop for CResult_PongDecodeErrorZ {
12477         fn drop(&mut self) {
12478                 if self.result_ok {
12479                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12480                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12481                         }
12482                 } else {
12483                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12484                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12485                         }
12486                 }
12487         }
12488 }
12489 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
12490         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
12491                 let contents = if o.result_ok {
12492                         let result = unsafe { o.contents.result };
12493                         unsafe { o.contents.result = std::ptr::null_mut() };
12494                         CResult_PongDecodeErrorZPtr { result }
12495                 } else {
12496                         let err = unsafe { o.contents.err };
12497                         unsafe { o.contents.err = std::ptr::null_mut(); }
12498                         CResult_PongDecodeErrorZPtr { err }
12499                 };
12500                 Self {
12501                         contents,
12502                         result_ok: o.result_ok,
12503                 }
12504         }
12505 }
12506 impl Clone for CResult_PongDecodeErrorZ {
12507         fn clone(&self) -> Self {
12508                 if self.result_ok {
12509                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
12510                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
12511                         } }
12512                 } else {
12513                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
12514                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12515                         } }
12516                 }
12517         }
12518 }
12519 #[no_mangle]
12520 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
12521 /// but with all dynamically-allocated buffers duplicated in new buffers.
12522 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
12523 #[repr(C)]
12524 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12525 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12526         /// A pointer to the contents in the success state.
12527         /// Reading from this pointer when `result_ok` is not set is undefined.
12528         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
12529         /// A pointer to the contents in the error state.
12530         /// Reading from this pointer when `result_ok` is set is undefined.
12531         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12532 }
12533 #[repr(C)]
12534 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12535 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12537 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12538         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12539         /// `err` or `result` depending on the state of `result_ok`.
12540         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
12541         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12542         pub result_ok: bool,
12543 }
12544 #[no_mangle]
12545 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
12546 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12547         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12548                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12549                         result: Box::into_raw(Box::new(o)),
12550                 },
12551                 result_ok: true,
12552         }
12553 }
12554 #[no_mangle]
12555 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
12556 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12557         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12558                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12559                         err: Box::into_raw(Box::new(e)),
12560                 },
12561                 result_ok: false,
12562         }
12563 }
12564 /// Checks if the given object is currently in the success state
12565 #[no_mangle]
12566 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
12567         o.result_ok
12568 }
12569 #[no_mangle]
12570 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
12571 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
12572 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12573         fn drop(&mut self) {
12574                 if self.result_ok {
12575                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12576                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12577                         }
12578                 } else {
12579                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12580                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12581                         }
12582                 }
12583         }
12584 }
12585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12586         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12587                 let contents = if o.result_ok {
12588                         let result = unsafe { o.contents.result };
12589                         unsafe { o.contents.result = std::ptr::null_mut() };
12590                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
12591                 } else {
12592                         let err = unsafe { o.contents.err };
12593                         unsafe { o.contents.err = std::ptr::null_mut(); }
12594                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
12595                 };
12596                 Self {
12597                         contents,
12598                         result_ok: o.result_ok,
12599                 }
12600         }
12601 }
12602 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12603         fn clone(&self) -> Self {
12604                 if self.result_ok {
12605                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12606                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
12607                         } }
12608                 } else {
12609                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12610                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12611                         } }
12612                 }
12613         }
12614 }
12615 #[no_mangle]
12616 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
12617 /// but with all dynamically-allocated buffers duplicated in new buffers.
12618 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12619 #[repr(C)]
12620 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
12621 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
12622         /// A pointer to the contents in the success state.
12623         /// Reading from this pointer when `result_ok` is not set is undefined.
12624         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
12625         /// A pointer to the contents in the error state.
12626         /// Reading from this pointer when `result_ok` is set is undefined.
12627         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12628 }
12629 #[repr(C)]
12630 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12631 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12632 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12633 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
12634         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
12635         /// `err` or `result` depending on the state of `result_ok`.
12636         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
12637         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
12638         pub result_ok: bool,
12639 }
12640 #[no_mangle]
12641 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
12642 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
12643         CResult_ChannelAnnouncementDecodeErrorZ {
12644                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12645                         result: Box::into_raw(Box::new(o)),
12646                 },
12647                 result_ok: true,
12648         }
12649 }
12650 #[no_mangle]
12651 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
12652 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
12653         CResult_ChannelAnnouncementDecodeErrorZ {
12654                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12655                         err: Box::into_raw(Box::new(e)),
12656                 },
12657                 result_ok: false,
12658         }
12659 }
12660 /// Checks if the given object is currently in the success state
12661 #[no_mangle]
12662 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
12663         o.result_ok
12664 }
12665 #[no_mangle]
12666 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
12667 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
12668 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
12669         fn drop(&mut self) {
12670                 if self.result_ok {
12671                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12672                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12673                         }
12674                 } else {
12675                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12676                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12677                         }
12678                 }
12679         }
12680 }
12681 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
12682         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12683                 let contents = if o.result_ok {
12684                         let result = unsafe { o.contents.result };
12685                         unsafe { o.contents.result = std::ptr::null_mut() };
12686                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
12687                 } else {
12688                         let err = unsafe { o.contents.err };
12689                         unsafe { o.contents.err = std::ptr::null_mut(); }
12690                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
12691                 };
12692                 Self {
12693                         contents,
12694                         result_ok: o.result_ok,
12695                 }
12696         }
12697 }
12698 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
12699         fn clone(&self) -> Self {
12700                 if self.result_ok {
12701                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12702                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
12703                         } }
12704                 } else {
12705                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
12706                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12707                         } }
12708                 }
12709         }
12710 }
12711 #[no_mangle]
12712 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
12713 /// but with all dynamically-allocated buffers duplicated in new buffers.
12714 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
12715 #[repr(C)]
12716 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
12717 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12718         /// A pointer to the contents in the success state.
12719         /// Reading from this pointer when `result_ok` is not set is undefined.
12720         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
12721         /// A pointer to the contents in the error state.
12722         /// Reading from this pointer when `result_ok` is set is undefined.
12723         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12724 }
12725 #[repr(C)]
12726 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12727 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12729 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
12730         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
12731         /// `err` or `result` depending on the state of `result_ok`.
12732         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
12733         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
12734         pub result_ok: bool,
12735 }
12736 #[no_mangle]
12737 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
12738 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
12739         CResult_UnsignedChannelUpdateDecodeErrorZ {
12740                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12741                         result: Box::into_raw(Box::new(o)),
12742                 },
12743                 result_ok: true,
12744         }
12745 }
12746 #[no_mangle]
12747 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
12748 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
12749         CResult_UnsignedChannelUpdateDecodeErrorZ {
12750                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12751                         err: Box::into_raw(Box::new(e)),
12752                 },
12753                 result_ok: false,
12754         }
12755 }
12756 /// Checks if the given object is currently in the success state
12757 #[no_mangle]
12758 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
12759         o.result_ok
12760 }
12761 #[no_mangle]
12762 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
12763 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
12764 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
12765         fn drop(&mut self) {
12766                 if self.result_ok {
12767                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12768                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12769                         }
12770                 } else {
12771                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12772                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12773                         }
12774                 }
12775         }
12776 }
12777 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
12778         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12779                 let contents = if o.result_ok {
12780                         let result = unsafe { o.contents.result };
12781                         unsafe { o.contents.result = std::ptr::null_mut() };
12782                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
12783                 } else {
12784                         let err = unsafe { o.contents.err };
12785                         unsafe { o.contents.err = std::ptr::null_mut(); }
12786                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
12787                 };
12788                 Self {
12789                         contents,
12790                         result_ok: o.result_ok,
12791                 }
12792         }
12793 }
12794 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
12795         fn clone(&self) -> Self {
12796                 if self.result_ok {
12797                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12798                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
12799                         } }
12800                 } else {
12801                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
12802                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12803                         } }
12804                 }
12805         }
12806 }
12807 #[no_mangle]
12808 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
12809 /// but with all dynamically-allocated buffers duplicated in new buffers.
12810 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
12811 #[repr(C)]
12812 /// The contents of CResult_ChannelUpdateDecodeErrorZ
12813 pub union CResult_ChannelUpdateDecodeErrorZPtr {
12814         /// A pointer to the contents in the success state.
12815         /// Reading from this pointer when `result_ok` is not set is undefined.
12816         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
12817         /// A pointer to the contents in the error state.
12818         /// Reading from this pointer when `result_ok` is set is undefined.
12819         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12820 }
12821 #[repr(C)]
12822 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12823 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12825 pub struct CResult_ChannelUpdateDecodeErrorZ {
12826         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
12827         /// `err` or `result` depending on the state of `result_ok`.
12828         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
12829         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
12830         pub result_ok: bool,
12831 }
12832 #[no_mangle]
12833 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
12834 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
12835         CResult_ChannelUpdateDecodeErrorZ {
12836                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
12837                         result: Box::into_raw(Box::new(o)),
12838                 },
12839                 result_ok: true,
12840         }
12841 }
12842 #[no_mangle]
12843 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
12844 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
12845         CResult_ChannelUpdateDecodeErrorZ {
12846                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
12847                         err: Box::into_raw(Box::new(e)),
12848                 },
12849                 result_ok: false,
12850         }
12851 }
12852 /// Checks if the given object is currently in the success state
12853 #[no_mangle]
12854 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
12855         o.result_ok
12856 }
12857 #[no_mangle]
12858 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
12859 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
12860 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
12861         fn drop(&mut self) {
12862                 if self.result_ok {
12863                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12864                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12865                         }
12866                 } else {
12867                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12868                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12869                         }
12870                 }
12871         }
12872 }
12873 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
12874         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12875                 let contents = if o.result_ok {
12876                         let result = unsafe { o.contents.result };
12877                         unsafe { o.contents.result = std::ptr::null_mut() };
12878                         CResult_ChannelUpdateDecodeErrorZPtr { result }
12879                 } else {
12880                         let err = unsafe { o.contents.err };
12881                         unsafe { o.contents.err = std::ptr::null_mut(); }
12882                         CResult_ChannelUpdateDecodeErrorZPtr { err }
12883                 };
12884                 Self {
12885                         contents,
12886                         result_ok: o.result_ok,
12887                 }
12888         }
12889 }
12890 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
12891         fn clone(&self) -> Self {
12892                 if self.result_ok {
12893                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
12894                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
12895                         } }
12896                 } else {
12897                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
12898                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12899                         } }
12900                 }
12901         }
12902 }
12903 #[no_mangle]
12904 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
12905 /// but with all dynamically-allocated buffers duplicated in new buffers.
12906 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
12907 #[repr(C)]
12908 /// The contents of CResult_ErrorMessageDecodeErrorZ
12909 pub union CResult_ErrorMessageDecodeErrorZPtr {
12910         /// A pointer to the contents in the success state.
12911         /// Reading from this pointer when `result_ok` is not set is undefined.
12912         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
12913         /// A pointer to the contents in the error state.
12914         /// Reading from this pointer when `result_ok` is set is undefined.
12915         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12916 }
12917 #[repr(C)]
12918 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
12919 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12920 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12921 pub struct CResult_ErrorMessageDecodeErrorZ {
12922         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
12923         /// `err` or `result` depending on the state of `result_ok`.
12924         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
12925         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
12926         pub result_ok: bool,
12927 }
12928 #[no_mangle]
12929 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
12930 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
12931         CResult_ErrorMessageDecodeErrorZ {
12932                 contents: CResult_ErrorMessageDecodeErrorZPtr {
12933                         result: Box::into_raw(Box::new(o)),
12934                 },
12935                 result_ok: true,
12936         }
12937 }
12938 #[no_mangle]
12939 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
12940 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
12941         CResult_ErrorMessageDecodeErrorZ {
12942                 contents: CResult_ErrorMessageDecodeErrorZPtr {
12943                         err: Box::into_raw(Box::new(e)),
12944                 },
12945                 result_ok: false,
12946         }
12947 }
12948 /// Checks if the given object is currently in the success state
12949 #[no_mangle]
12950 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
12951         o.result_ok
12952 }
12953 #[no_mangle]
12954 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
12955 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
12956 impl Drop for CResult_ErrorMessageDecodeErrorZ {
12957         fn drop(&mut self) {
12958                 if self.result_ok {
12959                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12960                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12961                         }
12962                 } else {
12963                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12964                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12965                         }
12966                 }
12967         }
12968 }
12969 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
12970         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
12971                 let contents = if o.result_ok {
12972                         let result = unsafe { o.contents.result };
12973                         unsafe { o.contents.result = std::ptr::null_mut() };
12974                         CResult_ErrorMessageDecodeErrorZPtr { result }
12975                 } else {
12976                         let err = unsafe { o.contents.err };
12977                         unsafe { o.contents.err = std::ptr::null_mut(); }
12978                         CResult_ErrorMessageDecodeErrorZPtr { err }
12979                 };
12980                 Self {
12981                         contents,
12982                         result_ok: o.result_ok,
12983                 }
12984         }
12985 }
12986 impl Clone for CResult_ErrorMessageDecodeErrorZ {
12987         fn clone(&self) -> Self {
12988                 if self.result_ok {
12989                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
12990                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
12991                         } }
12992                 } else {
12993                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
12994                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12995                         } }
12996                 }
12997         }
12998 }
12999 #[no_mangle]
13000 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13001 /// but with all dynamically-allocated buffers duplicated in new buffers.
13002 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
13003 #[repr(C)]
13004 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
13005 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13006         /// A pointer to the contents in the success state.
13007         /// Reading from this pointer when `result_ok` is not set is undefined.
13008         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
13009         /// A pointer to the contents in the error state.
13010         /// Reading from this pointer when `result_ok` is set is undefined.
13011         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13012 }
13013 #[repr(C)]
13014 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13015 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13016 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13017 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13018         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
13019         /// `err` or `result` depending on the state of `result_ok`.
13020         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
13021         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
13022         pub result_ok: bool,
13023 }
13024 #[no_mangle]
13025 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13026 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13027         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13028                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13029                         result: Box::into_raw(Box::new(o)),
13030                 },
13031                 result_ok: true,
13032         }
13033 }
13034 #[no_mangle]
13035 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13036 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13037         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13038                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13039                         err: Box::into_raw(Box::new(e)),
13040                 },
13041                 result_ok: false,
13042         }
13043 }
13044 /// Checks if the given object is currently in the success state
13045 #[no_mangle]
13046 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
13047         o.result_ok
13048 }
13049 #[no_mangle]
13050 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13051 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
13052 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13053         fn drop(&mut self) {
13054                 if self.result_ok {
13055                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13056                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13057                         }
13058                 } else {
13059                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13060                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13061                         }
13062                 }
13063         }
13064 }
13065 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13066         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13067                 let contents = if o.result_ok {
13068                         let result = unsafe { o.contents.result };
13069                         unsafe { o.contents.result = std::ptr::null_mut() };
13070                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
13071                 } else {
13072                         let err = unsafe { o.contents.err };
13073                         unsafe { o.contents.err = std::ptr::null_mut(); }
13074                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
13075                 };
13076                 Self {
13077                         contents,
13078                         result_ok: o.result_ok,
13079                 }
13080         }
13081 }
13082 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13083         fn clone(&self) -> Self {
13084                 if self.result_ok {
13085                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13086                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13087                         } }
13088                 } else {
13089                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13090                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13091                         } }
13092                 }
13093         }
13094 }
13095 #[no_mangle]
13096 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13097 /// but with all dynamically-allocated buffers duplicated in new buffers.
13098 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13099 #[repr(C)]
13100 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
13101 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
13102         /// A pointer to the contents in the success state.
13103         /// Reading from this pointer when `result_ok` is not set is undefined.
13104         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
13105         /// A pointer to the contents in the error state.
13106         /// Reading from this pointer when `result_ok` is set is undefined.
13107         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13108 }
13109 #[repr(C)]
13110 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13111 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13112 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13113 pub struct CResult_NodeAnnouncementDecodeErrorZ {
13114         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
13115         /// `err` or `result` depending on the state of `result_ok`.
13116         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
13117         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
13118         pub result_ok: bool,
13119 }
13120 #[no_mangle]
13121 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13122 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
13123         CResult_NodeAnnouncementDecodeErrorZ {
13124                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13125                         result: Box::into_raw(Box::new(o)),
13126                 },
13127                 result_ok: true,
13128         }
13129 }
13130 #[no_mangle]
13131 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13132 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
13133         CResult_NodeAnnouncementDecodeErrorZ {
13134                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13135                         err: Box::into_raw(Box::new(e)),
13136                 },
13137                 result_ok: false,
13138         }
13139 }
13140 /// Checks if the given object is currently in the success state
13141 #[no_mangle]
13142 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
13143         o.result_ok
13144 }
13145 #[no_mangle]
13146 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13147 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
13148 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
13149         fn drop(&mut self) {
13150                 if self.result_ok {
13151                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13152                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13153                         }
13154                 } else {
13155                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13156                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13157                         }
13158                 }
13159         }
13160 }
13161 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
13162         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13163                 let contents = if o.result_ok {
13164                         let result = unsafe { o.contents.result };
13165                         unsafe { o.contents.result = std::ptr::null_mut() };
13166                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
13167                 } else {
13168                         let err = unsafe { o.contents.err };
13169                         unsafe { o.contents.err = std::ptr::null_mut(); }
13170                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
13171                 };
13172                 Self {
13173                         contents,
13174                         result_ok: o.result_ok,
13175                 }
13176         }
13177 }
13178 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
13179         fn clone(&self) -> Self {
13180                 if self.result_ok {
13181                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13182                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13183                         } }
13184                 } else {
13185                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13186                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13187                         } }
13188                 }
13189         }
13190 }
13191 #[no_mangle]
13192 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13193 /// but with all dynamically-allocated buffers duplicated in new buffers.
13194 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13195 #[repr(C)]
13196 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
13197 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
13198         /// A pointer to the contents in the success state.
13199         /// Reading from this pointer when `result_ok` is not set is undefined.
13200         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
13201         /// A pointer to the contents in the error state.
13202         /// Reading from this pointer when `result_ok` is set is undefined.
13203         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13204 }
13205 #[repr(C)]
13206 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
13207 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
13208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13209 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
13210         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
13211         /// `err` or `result` depending on the state of `result_ok`.
13212         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
13213         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
13214         pub result_ok: bool,
13215 }
13216 #[no_mangle]
13217 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13218 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13219         CResult_QueryShortChannelIdsDecodeErrorZ {
13220                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13221                         result: Box::into_raw(Box::new(o)),
13222                 },
13223                 result_ok: true,
13224         }
13225 }
13226 #[no_mangle]
13227 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13228 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13229         CResult_QueryShortChannelIdsDecodeErrorZ {
13230                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13231                         err: Box::into_raw(Box::new(e)),
13232                 },
13233                 result_ok: false,
13234         }
13235 }
13236 /// Checks if the given object is currently in the success state
13237 #[no_mangle]
13238 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
13239         o.result_ok
13240 }
13241 #[no_mangle]
13242 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13243 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
13244 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
13245         fn drop(&mut self) {
13246                 if self.result_ok {
13247                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13248                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13249                         }
13250                 } else {
13251                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13252                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13253                         }
13254                 }
13255         }
13256 }
13257 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
13258         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
13259                 let contents = if o.result_ok {
13260                         let result = unsafe { o.contents.result };
13261                         unsafe { o.contents.result = std::ptr::null_mut() };
13262                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
13263                 } else {
13264                         let err = unsafe { o.contents.err };
13265                         unsafe { o.contents.err = std::ptr::null_mut(); }
13266                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
13267                 };
13268                 Self {
13269                         contents,
13270                         result_ok: o.result_ok,
13271                 }
13272         }
13273 }
13274 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
13275         fn clone(&self) -> Self {
13276                 if self.result_ok {
13277                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13278                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
13279                         } }
13280                 } else {
13281                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13282                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13283                         } }
13284                 }
13285         }
13286 }
13287 #[no_mangle]
13288 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13289 /// but with all dynamically-allocated buffers duplicated in new buffers.
13290 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
13291 #[repr(C)]
13292 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
13293 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13294         /// A pointer to the contents in the success state.
13295         /// Reading from this pointer when `result_ok` is not set is undefined.
13296         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
13297         /// A pointer to the contents in the error state.
13298         /// Reading from this pointer when `result_ok` is set is undefined.
13299         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13300 }
13301 #[repr(C)]
13302 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
13303 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
13304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13305 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13306         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
13307         /// `err` or `result` depending on the state of `result_ok`.
13308         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
13309         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
13310         pub result_ok: bool,
13311 }
13312 #[no_mangle]
13313 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13314 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13315         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13316                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13317                         result: Box::into_raw(Box::new(o)),
13318                 },
13319                 result_ok: true,
13320         }
13321 }
13322 #[no_mangle]
13323 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13324 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13325         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13326                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13327                         err: Box::into_raw(Box::new(e)),
13328                 },
13329                 result_ok: false,
13330         }
13331 }
13332 /// Checks if the given object is currently in the success state
13333 #[no_mangle]
13334 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
13335         o.result_ok
13336 }
13337 #[no_mangle]
13338 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13339 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
13340 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13341         fn drop(&mut self) {
13342                 if self.result_ok {
13343                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13344                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13345                         }
13346                 } else {
13347                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13348                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13349                         }
13350                 }
13351         }
13352 }
13353 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13354         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
13355                 let contents = if o.result_ok {
13356                         let result = unsafe { o.contents.result };
13357                         unsafe { o.contents.result = std::ptr::null_mut() };
13358                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
13359                 } else {
13360                         let err = unsafe { o.contents.err };
13361                         unsafe { o.contents.err = std::ptr::null_mut(); }
13362                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
13363                 };
13364                 Self {
13365                         contents,
13366                         result_ok: o.result_ok,
13367                 }
13368         }
13369 }
13370 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13371         fn clone(&self) -> Self {
13372                 if self.result_ok {
13373                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13374                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
13375                         } }
13376                 } else {
13377                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13378                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13379                         } }
13380                 }
13381         }
13382 }
13383 #[no_mangle]
13384 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13385 /// but with all dynamically-allocated buffers duplicated in new buffers.
13386 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
13387 #[repr(C)]
13388 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
13389 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
13390         /// A pointer to the contents in the success state.
13391         /// Reading from this pointer when `result_ok` is not set is undefined.
13392         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
13393         /// A pointer to the contents in the error state.
13394         /// Reading from this pointer when `result_ok` is set is undefined.
13395         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13396 }
13397 #[repr(C)]
13398 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
13399 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13401 pub struct CResult_QueryChannelRangeDecodeErrorZ {
13402         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
13403         /// `err` or `result` depending on the state of `result_ok`.
13404         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
13405         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
13406         pub result_ok: bool,
13407 }
13408 #[no_mangle]
13409 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13410 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
13411         CResult_QueryChannelRangeDecodeErrorZ {
13412                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13413                         result: Box::into_raw(Box::new(o)),
13414                 },
13415                 result_ok: true,
13416         }
13417 }
13418 #[no_mangle]
13419 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13420 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
13421         CResult_QueryChannelRangeDecodeErrorZ {
13422                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13423                         err: Box::into_raw(Box::new(e)),
13424                 },
13425                 result_ok: false,
13426         }
13427 }
13428 /// Checks if the given object is currently in the success state
13429 #[no_mangle]
13430 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
13431         o.result_ok
13432 }
13433 #[no_mangle]
13434 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13435 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
13436 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
13437         fn drop(&mut self) {
13438                 if self.result_ok {
13439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13441                         }
13442                 } else {
13443                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13444                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13445                         }
13446                 }
13447         }
13448 }
13449 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
13450         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13451                 let contents = if o.result_ok {
13452                         let result = unsafe { o.contents.result };
13453                         unsafe { o.contents.result = std::ptr::null_mut() };
13454                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
13455                 } else {
13456                         let err = unsafe { o.contents.err };
13457                         unsafe { o.contents.err = std::ptr::null_mut(); }
13458                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
13459                 };
13460                 Self {
13461                         contents,
13462                         result_ok: o.result_ok,
13463                 }
13464         }
13465 }
13466 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
13467         fn clone(&self) -> Self {
13468                 if self.result_ok {
13469                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13470                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
13471                         } }
13472                 } else {
13473                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13474                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13475                         } }
13476                 }
13477         }
13478 }
13479 #[no_mangle]
13480 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13481 /// but with all dynamically-allocated buffers duplicated in new buffers.
13482 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13483 #[repr(C)]
13484 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
13485 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
13486         /// A pointer to the contents in the success state.
13487         /// Reading from this pointer when `result_ok` is not set is undefined.
13488         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
13489         /// A pointer to the contents in the error state.
13490         /// Reading from this pointer when `result_ok` is set is undefined.
13491         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13492 }
13493 #[repr(C)]
13494 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
13495 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13497 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
13498         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
13499         /// `err` or `result` depending on the state of `result_ok`.
13500         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
13501         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
13502         pub result_ok: bool,
13503 }
13504 #[no_mangle]
13505 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13506 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
13507         CResult_ReplyChannelRangeDecodeErrorZ {
13508                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13509                         result: Box::into_raw(Box::new(o)),
13510                 },
13511                 result_ok: true,
13512         }
13513 }
13514 #[no_mangle]
13515 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13516 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
13517         CResult_ReplyChannelRangeDecodeErrorZ {
13518                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13519                         err: Box::into_raw(Box::new(e)),
13520                 },
13521                 result_ok: false,
13522         }
13523 }
13524 /// Checks if the given object is currently in the success state
13525 #[no_mangle]
13526 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
13527         o.result_ok
13528 }
13529 #[no_mangle]
13530 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13531 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
13532 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
13533         fn drop(&mut self) {
13534                 if self.result_ok {
13535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13537                         }
13538                 } else {
13539                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13540                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13541                         }
13542                 }
13543         }
13544 }
13545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
13546         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13547                 let contents = if o.result_ok {
13548                         let result = unsafe { o.contents.result };
13549                         unsafe { o.contents.result = std::ptr::null_mut() };
13550                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
13551                 } else {
13552                         let err = unsafe { o.contents.err };
13553                         unsafe { o.contents.err = std::ptr::null_mut(); }
13554                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
13555                 };
13556                 Self {
13557                         contents,
13558                         result_ok: o.result_ok,
13559                 }
13560         }
13561 }
13562 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
13563         fn clone(&self) -> Self {
13564                 if self.result_ok {
13565                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13566                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
13567                         } }
13568                 } else {
13569                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13570                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13571                         } }
13572                 }
13573         }
13574 }
13575 #[no_mangle]
13576 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13577 /// but with all dynamically-allocated buffers duplicated in new buffers.
13578 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13579 #[repr(C)]
13580 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
13581 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
13582         /// A pointer to the contents in the success state.
13583         /// Reading from this pointer when `result_ok` is not set is undefined.
13584         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
13585         /// A pointer to the contents in the error state.
13586         /// Reading from this pointer when `result_ok` is set is undefined.
13587         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13588 }
13589 #[repr(C)]
13590 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
13591 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
13592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13593 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
13594         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
13595         /// `err` or `result` depending on the state of `result_ok`.
13596         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
13597         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
13598         pub result_ok: bool,
13599 }
13600 #[no_mangle]
13601 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
13602 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
13603         CResult_GossipTimestampFilterDecodeErrorZ {
13604                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13605                         result: Box::into_raw(Box::new(o)),
13606                 },
13607                 result_ok: true,
13608         }
13609 }
13610 #[no_mangle]
13611 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
13612 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
13613         CResult_GossipTimestampFilterDecodeErrorZ {
13614                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13615                         err: Box::into_raw(Box::new(e)),
13616                 },
13617                 result_ok: false,
13618         }
13619 }
13620 /// Checks if the given object is currently in the success state
13621 #[no_mangle]
13622 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
13623         o.result_ok
13624 }
13625 #[no_mangle]
13626 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
13627 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
13628 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
13629         fn drop(&mut self) {
13630                 if self.result_ok {
13631                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13632                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13633                         }
13634                 } else {
13635                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13636                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13637                         }
13638                 }
13639         }
13640 }
13641 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
13642         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
13643                 let contents = if o.result_ok {
13644                         let result = unsafe { o.contents.result };
13645                         unsafe { o.contents.result = std::ptr::null_mut() };
13646                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
13647                 } else {
13648                         let err = unsafe { o.contents.err };
13649                         unsafe { o.contents.err = std::ptr::null_mut(); }
13650                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
13651                 };
13652                 Self {
13653                         contents,
13654                         result_ok: o.result_ok,
13655                 }
13656         }
13657 }
13658 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
13659         fn clone(&self) -> Self {
13660                 if self.result_ok {
13661                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13662                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
13663                         } }
13664                 } else {
13665                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
13666                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13667                         } }
13668                 }
13669         }
13670 }
13671 #[no_mangle]
13672 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
13673 /// but with all dynamically-allocated buffers duplicated in new buffers.
13674 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
13675 #[repr(C)]
13676 /// The contents of CResult_InvoiceSignOrCreationErrorZ
13677 pub union CResult_InvoiceSignOrCreationErrorZPtr {
13678         /// A pointer to the contents in the success state.
13679         /// Reading from this pointer when `result_ok` is not set is undefined.
13680         pub result: *mut crate::lightning_invoice::Invoice,
13681         /// A pointer to the contents in the error state.
13682         /// Reading from this pointer when `result_ok` is set is undefined.
13683         pub err: *mut crate::lightning_invoice::SignOrCreationError,
13684 }
13685 #[repr(C)]
13686 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
13687 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
13688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13689 pub struct CResult_InvoiceSignOrCreationErrorZ {
13690         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
13691         /// `err` or `result` depending on the state of `result_ok`.
13692         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
13693         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
13694         pub result_ok: bool,
13695 }
13696 #[no_mangle]
13697 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
13698 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
13699         CResult_InvoiceSignOrCreationErrorZ {
13700                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
13701                         result: Box::into_raw(Box::new(o)),
13702                 },
13703                 result_ok: true,
13704         }
13705 }
13706 #[no_mangle]
13707 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
13708 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
13709         CResult_InvoiceSignOrCreationErrorZ {
13710                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
13711                         err: Box::into_raw(Box::new(e)),
13712                 },
13713                 result_ok: false,
13714         }
13715 }
13716 /// Checks if the given object is currently in the success state
13717 #[no_mangle]
13718 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
13719         o.result_ok
13720 }
13721 #[no_mangle]
13722 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
13723 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
13724 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
13725         fn drop(&mut self) {
13726                 if self.result_ok {
13727                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13728                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13729                         }
13730                 } else {
13731                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13732                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13733                         }
13734                 }
13735         }
13736 }
13737 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
13738         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
13739                 let contents = if o.result_ok {
13740                         let result = unsafe { o.contents.result };
13741                         unsafe { o.contents.result = std::ptr::null_mut() };
13742                         CResult_InvoiceSignOrCreationErrorZPtr { result }
13743                 } else {
13744                         let err = unsafe { o.contents.err };
13745                         unsafe { o.contents.err = std::ptr::null_mut(); }
13746                         CResult_InvoiceSignOrCreationErrorZPtr { err }
13747                 };
13748                 Self {
13749                         contents,
13750                         result_ok: o.result_ok,
13751                 }
13752         }
13753 }
13754 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
13755         fn clone(&self) -> Self {
13756                 if self.result_ok {
13757                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
13758                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13759                         } }
13760                 } else {
13761                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
13762                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
13763                         } }
13764                 }
13765         }
13766 }
13767 #[no_mangle]
13768 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
13769 /// but with all dynamically-allocated buffers duplicated in new buffers.
13770 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
13771 #[repr(C)]
13772 /// An enum which can either contain a crate::lightning::chain::Filter or not
13773 pub enum COption_FilterZ {
13774         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
13775         Some(crate::lightning::chain::Filter),
13776         /// When we're in this state, this COption_FilterZ contains nothing
13777         None
13778 }
13779 impl COption_FilterZ {
13780         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13781                 if let Self::Some(_) = self { true } else { false }
13782         }
13783         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13784                 !self.is_some()
13785         }
13786         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
13787                 if let Self::Some(v) = self { v } else { unreachable!() }
13788         }
13789 }
13790 #[no_mangle]
13791 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
13792 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
13793         COption_FilterZ::Some(o)
13794 }
13795 #[no_mangle]
13796 /// Constructs a new COption_FilterZ containing nothing
13797 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
13798         COption_FilterZ::None
13799 }
13800 #[no_mangle]
13801 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
13802 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
13803 #[repr(C)]
13804 /// The contents of CResult_LockedChannelMonitorNoneZ
13805 pub union CResult_LockedChannelMonitorNoneZPtr {
13806         /// A pointer to the contents in the success state.
13807         /// Reading from this pointer when `result_ok` is not set is undefined.
13808         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
13809         /// Note that this value is always NULL, as there are no contents in the Err variant
13810         pub err: *mut std::ffi::c_void,
13811 }
13812 #[repr(C)]
13813 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
13814 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
13815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13816 pub struct CResult_LockedChannelMonitorNoneZ {
13817         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
13818         /// `err` or `result` depending on the state of `result_ok`.
13819         pub contents: CResult_LockedChannelMonitorNoneZPtr,
13820         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
13821         pub result_ok: bool,
13822 }
13823 #[no_mangle]
13824 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
13825 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
13826         CResult_LockedChannelMonitorNoneZ {
13827                 contents: CResult_LockedChannelMonitorNoneZPtr {
13828                         result: Box::into_raw(Box::new(o)),
13829                 },
13830                 result_ok: true,
13831         }
13832 }
13833 #[no_mangle]
13834 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
13835 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
13836         CResult_LockedChannelMonitorNoneZ {
13837                 contents: CResult_LockedChannelMonitorNoneZPtr {
13838                         err: std::ptr::null_mut(),
13839                 },
13840                 result_ok: false,
13841         }
13842 }
13843 /// Checks if the given object is currently in the success state
13844 #[no_mangle]
13845 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
13846         o.result_ok
13847 }
13848 #[no_mangle]
13849 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
13850 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
13851 impl Drop for CResult_LockedChannelMonitorNoneZ {
13852         fn drop(&mut self) {
13853                 if self.result_ok {
13854                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13855                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13856                         }
13857                 } else {
13858                 }
13859         }
13860 }
13861 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
13862         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
13863                 let contents = if o.result_ok {
13864                         let result = unsafe { o.contents.result };
13865                         unsafe { o.contents.result = std::ptr::null_mut() };
13866                         CResult_LockedChannelMonitorNoneZPtr { result }
13867                 } else {
13868                         let _ = unsafe { Box::from_raw(o.contents.err) };
13869                         o.contents.err = std::ptr::null_mut();
13870                         CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
13871                 };
13872                 Self {
13873                         contents,
13874                         result_ok: o.result_ok,
13875                 }
13876         }
13877 }
13878 #[repr(C)]
13879 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
13880 /// This corresponds to std::vector in C++
13881 pub struct CVec_OutPointZ {
13882         /// The elements in the array.
13883         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13884         pub data: *mut crate::lightning::chain::transaction::OutPoint,
13885         /// The number of elements pointed to by `data`.
13886         pub datalen: usize
13887 }
13888 impl CVec_OutPointZ {
13889         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
13890                 if self.datalen == 0 { return Vec::new(); }
13891                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13892                 self.data = std::ptr::null_mut();
13893                 self.datalen = 0;
13894                 ret
13895         }
13896         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
13897                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
13898         }
13899 }
13900 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
13901         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
13902                 let datalen = v.len();
13903                 let data = Box::into_raw(v.into_boxed_slice());
13904                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13905         }
13906 }
13907 #[no_mangle]
13908 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13909 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
13910 impl Drop for CVec_OutPointZ {
13911         fn drop(&mut self) {
13912                 if self.datalen == 0 { return; }
13913                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
13914         }
13915 }
13916 impl Clone for CVec_OutPointZ {
13917         fn clone(&self) -> Self {
13918                 let mut res = Vec::new();
13919                 if self.datalen == 0 { return Self::from(res); }
13920                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
13921                 Self::from(res)
13922         }
13923 }