Merge pull request #51 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::None = self { false } else { true }
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 /// An enum which can either contain a  or not
599 pub enum COption_NoneZ {
600         /// When we're in this state, this COption_NoneZ contains a 
601         Some,
602         /// When we're in this state, this COption_NoneZ contains nothing
603         None
604 }
605 impl COption_NoneZ {
606         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
607                 if let Self::None = self { false } else { true }
608         }
609         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
610                 !self.is_some()
611         }
612 }
613 #[no_mangle]
614 /// Constructs a new COption_NoneZ containing a 
615 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
616         COption_NoneZ::Some
617 }
618 #[no_mangle]
619 /// Constructs a new COption_NoneZ containing nothing
620 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
621         COption_NoneZ::None
622 }
623 #[no_mangle]
624 /// Frees any resources associated with the , if we are in the Some state
625 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
626 #[repr(C)]
627 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
628 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
629         /// A pointer to the contents in the success state.
630         /// Reading from this pointer when `result_ok` is not set is undefined.
631         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
632         /// A pointer to the contents in the error state.
633         /// Reading from this pointer when `result_ok` is set is undefined.
634         pub err: *mut crate::lightning::ln::msgs::DecodeError,
635 }
636 #[repr(C)]
637 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
638 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
640 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
641         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
642         /// `err` or `result` depending on the state of `result_ok`.
643         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
644         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
645         pub result_ok: bool,
646 }
647 #[no_mangle]
648 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
649 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
650         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
651                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
652                         result: Box::into_raw(Box::new(o)),
653                 },
654                 result_ok: true,
655         }
656 }
657 #[no_mangle]
658 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
659 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
661                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
662                         err: Box::into_raw(Box::new(e)),
663                 },
664                 result_ok: false,
665         }
666 }
667 /// Checks if the given object is currently in the success state
668 #[no_mangle]
669 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
670         o.result_ok
671 }
672 #[no_mangle]
673 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
674 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
675 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
676         fn drop(&mut self) {
677                 if self.result_ok {
678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
680                         }
681                 } else {
682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
684                         }
685                 }
686         }
687 }
688 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
689         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
690                 let contents = if o.result_ok {
691                         let result = unsafe { o.contents.result };
692                         unsafe { o.contents.result = std::ptr::null_mut() };
693                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
694                 } else {
695                         let err = unsafe { o.contents.err };
696                         unsafe { o.contents.err = std::ptr::null_mut(); }
697                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
698                 };
699                 Self {
700                         contents,
701                         result_ok: o.result_ok,
702                 }
703         }
704 }
705 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
706         fn clone(&self) -> Self {
707                 if self.result_ok {
708                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
709                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
710                         } }
711                 } else {
712                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
713                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
714                         } }
715                 }
716         }
717 }
718 #[no_mangle]
719 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
720 /// but with all dynamically-allocated buffers duplicated in new buffers.
721 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
722 #[repr(C)]
723 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
724 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
725         /// A pointer to the contents in the success state.
726         /// Reading from this pointer when `result_ok` is not set is undefined.
727         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
728         /// A pointer to the contents in the error state.
729         /// Reading from this pointer when `result_ok` is set is undefined.
730         pub err: *mut crate::lightning::ln::msgs::DecodeError,
731 }
732 #[repr(C)]
733 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
734 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
736 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
737         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
738         /// `err` or `result` depending on the state of `result_ok`.
739         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
740         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
741         pub result_ok: bool,
742 }
743 #[no_mangle]
744 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
745 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
746         CResult_ChannelTransactionParametersDecodeErrorZ {
747                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
748                         result: Box::into_raw(Box::new(o)),
749                 },
750                 result_ok: true,
751         }
752 }
753 #[no_mangle]
754 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
755 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
756         CResult_ChannelTransactionParametersDecodeErrorZ {
757                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
758                         err: Box::into_raw(Box::new(e)),
759                 },
760                 result_ok: false,
761         }
762 }
763 /// Checks if the given object is currently in the success state
764 #[no_mangle]
765 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
766         o.result_ok
767 }
768 #[no_mangle]
769 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
770 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
771 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
772         fn drop(&mut self) {
773                 if self.result_ok {
774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
776                         }
777                 } else {
778                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
779                                 let _ = unsafe { Box::from_raw(self.contents.err) };
780                         }
781                 }
782         }
783 }
784 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
785         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
786                 let contents = if o.result_ok {
787                         let result = unsafe { o.contents.result };
788                         unsafe { o.contents.result = std::ptr::null_mut() };
789                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
790                 } else {
791                         let err = unsafe { o.contents.err };
792                         unsafe { o.contents.err = std::ptr::null_mut(); }
793                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
794                 };
795                 Self {
796                         contents,
797                         result_ok: o.result_ok,
798                 }
799         }
800 }
801 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
802         fn clone(&self) -> Self {
803                 if self.result_ok {
804                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
805                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
806                         } }
807                 } else {
808                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
809                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
810                         } }
811                 }
812         }
813 }
814 #[no_mangle]
815 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
816 /// but with all dynamically-allocated buffers duplicated in new buffers.
817 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
818 #[repr(C)]
819 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
820 /// This corresponds to std::vector in C++
821 pub struct CVec_SignatureZ {
822         /// The elements in the array.
823         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
824         pub data: *mut crate::c_types::Signature,
825         /// The number of elements pointed to by `data`.
826         pub datalen: usize
827 }
828 impl CVec_SignatureZ {
829         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
830                 if self.datalen == 0 { return Vec::new(); }
831                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
832                 self.data = std::ptr::null_mut();
833                 self.datalen = 0;
834                 ret
835         }
836         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
837                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
838         }
839 }
840 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
841         fn from(v: Vec<crate::c_types::Signature>) -> Self {
842                 let datalen = v.len();
843                 let data = Box::into_raw(v.into_boxed_slice());
844                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
845         }
846 }
847 #[no_mangle]
848 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
849 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
850 impl Drop for CVec_SignatureZ {
851         fn drop(&mut self) {
852                 if self.datalen == 0 { return; }
853                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
854         }
855 }
856 impl Clone for CVec_SignatureZ {
857         fn clone(&self) -> Self {
858                 let mut res = Vec::new();
859                 if self.datalen == 0 { return Self::from(res); }
860                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
861                 Self::from(res)
862         }
863 }
864 #[repr(C)]
865 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
866 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
867         /// A pointer to the contents in the success state.
868         /// Reading from this pointer when `result_ok` is not set is undefined.
869         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
870         /// A pointer to the contents in the error state.
871         /// Reading from this pointer when `result_ok` is set is undefined.
872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
873 }
874 #[repr(C)]
875 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
876 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
878 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
879         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
880         /// `err` or `result` depending on the state of `result_ok`.
881         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
882         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
883         pub result_ok: bool,
884 }
885 #[no_mangle]
886 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
887 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
888         CResult_HolderCommitmentTransactionDecodeErrorZ {
889                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
890                         result: Box::into_raw(Box::new(o)),
891                 },
892                 result_ok: true,
893         }
894 }
895 #[no_mangle]
896 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
897 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
898         CResult_HolderCommitmentTransactionDecodeErrorZ {
899                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
900                         err: Box::into_raw(Box::new(e)),
901                 },
902                 result_ok: false,
903         }
904 }
905 /// Checks if the given object is currently in the success state
906 #[no_mangle]
907 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
908         o.result_ok
909 }
910 #[no_mangle]
911 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
912 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
913 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
914         fn drop(&mut self) {
915                 if self.result_ok {
916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
918                         }
919                 } else {
920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
922                         }
923                 }
924         }
925 }
926 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
928                 let contents = if o.result_ok {
929                         let result = unsafe { o.contents.result };
930                         unsafe { o.contents.result = std::ptr::null_mut() };
931                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
932                 } else {
933                         let err = unsafe { o.contents.err };
934                         unsafe { o.contents.err = std::ptr::null_mut(); }
935                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
936                 };
937                 Self {
938                         contents,
939                         result_ok: o.result_ok,
940                 }
941         }
942 }
943 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
944         fn clone(&self) -> Self {
945                 if self.result_ok {
946                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
947                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
948                         } }
949                 } else {
950                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
951                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
952                         } }
953                 }
954         }
955 }
956 #[no_mangle]
957 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
958 /// but with all dynamically-allocated buffers duplicated in new buffers.
959 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
960 #[repr(C)]
961 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
962 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
963         /// A pointer to the contents in the success state.
964         /// Reading from this pointer when `result_ok` is not set is undefined.
965         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
966         /// A pointer to the contents in the error state.
967         /// Reading from this pointer when `result_ok` is set is undefined.
968         pub err: *mut crate::lightning::ln::msgs::DecodeError,
969 }
970 #[repr(C)]
971 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
972 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
974 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
975         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
976         /// `err` or `result` depending on the state of `result_ok`.
977         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
978         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
979         pub result_ok: bool,
980 }
981 #[no_mangle]
982 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
983 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
984         CResult_BuiltCommitmentTransactionDecodeErrorZ {
985                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
986                         result: Box::into_raw(Box::new(o)),
987                 },
988                 result_ok: true,
989         }
990 }
991 #[no_mangle]
992 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
993 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
994         CResult_BuiltCommitmentTransactionDecodeErrorZ {
995                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
996                         err: Box::into_raw(Box::new(e)),
997                 },
998                 result_ok: false,
999         }
1000 }
1001 /// Checks if the given object is currently in the success state
1002 #[no_mangle]
1003 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1004         o.result_ok
1005 }
1006 #[no_mangle]
1007 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1008 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1009 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1010         fn drop(&mut self) {
1011                 if self.result_ok {
1012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1014                         }
1015                 } else {
1016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1018                         }
1019                 }
1020         }
1021 }
1022 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1023         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1024                 let contents = if o.result_ok {
1025                         let result = unsafe { o.contents.result };
1026                         unsafe { o.contents.result = std::ptr::null_mut() };
1027                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1028                 } else {
1029                         let err = unsafe { o.contents.err };
1030                         unsafe { o.contents.err = std::ptr::null_mut(); }
1031                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1032                 };
1033                 Self {
1034                         contents,
1035                         result_ok: o.result_ok,
1036                 }
1037         }
1038 }
1039 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1040         fn clone(&self) -> Self {
1041                 if self.result_ok {
1042                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1043                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1044                         } }
1045                 } else {
1046                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1047                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1048                         } }
1049                 }
1050         }
1051 }
1052 #[no_mangle]
1053 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1054 /// but with all dynamically-allocated buffers duplicated in new buffers.
1055 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1056 #[repr(C)]
1057 /// The contents of CResult_TrustedClosingTransactionNoneZ
1058 pub union CResult_TrustedClosingTransactionNoneZPtr {
1059         /// A pointer to the contents in the success state.
1060         /// Reading from this pointer when `result_ok` is not set is undefined.
1061         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1062         /// Note that this value is always NULL, as there are no contents in the Err variant
1063         pub err: *mut std::ffi::c_void,
1064 }
1065 #[repr(C)]
1066 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1067 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1069 pub struct CResult_TrustedClosingTransactionNoneZ {
1070         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1071         /// `err` or `result` depending on the state of `result_ok`.
1072         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1073         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1074         pub result_ok: bool,
1075 }
1076 #[no_mangle]
1077 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1078 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1079         CResult_TrustedClosingTransactionNoneZ {
1080                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1081                         result: Box::into_raw(Box::new(o)),
1082                 },
1083                 result_ok: true,
1084         }
1085 }
1086 #[no_mangle]
1087 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1088 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1089         CResult_TrustedClosingTransactionNoneZ {
1090                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1091                         err: std::ptr::null_mut(),
1092                 },
1093                 result_ok: false,
1094         }
1095 }
1096 /// Checks if the given object is currently in the success state
1097 #[no_mangle]
1098 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1099         o.result_ok
1100 }
1101 #[no_mangle]
1102 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1103 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1104 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1105         fn drop(&mut self) {
1106                 if self.result_ok {
1107                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1108                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1109                         }
1110                 } else {
1111                 }
1112         }
1113 }
1114 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1115         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1116                 let contents = if o.result_ok {
1117                         let result = unsafe { o.contents.result };
1118                         unsafe { o.contents.result = std::ptr::null_mut() };
1119                         CResult_TrustedClosingTransactionNoneZPtr { result }
1120                 } else {
1121                         let _ = unsafe { Box::from_raw(o.contents.err) };
1122                         o.contents.err = std::ptr::null_mut();
1123                         CResult_TrustedClosingTransactionNoneZPtr { err: std::ptr::null_mut() }
1124                 };
1125                 Self {
1126                         contents,
1127                         result_ok: o.result_ok,
1128                 }
1129         }
1130 }
1131 #[repr(C)]
1132 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1133 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1134         /// A pointer to the contents in the success state.
1135         /// Reading from this pointer when `result_ok` is not set is undefined.
1136         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1137         /// A pointer to the contents in the error state.
1138         /// Reading from this pointer when `result_ok` is set is undefined.
1139         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1140 }
1141 #[repr(C)]
1142 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1143 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1145 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1146         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1147         /// `err` or `result` depending on the state of `result_ok`.
1148         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1149         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1150         pub result_ok: bool,
1151 }
1152 #[no_mangle]
1153 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1154 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1155         CResult_CommitmentTransactionDecodeErrorZ {
1156                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1157                         result: Box::into_raw(Box::new(o)),
1158                 },
1159                 result_ok: true,
1160         }
1161 }
1162 #[no_mangle]
1163 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1164 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1165         CResult_CommitmentTransactionDecodeErrorZ {
1166                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1167                         err: Box::into_raw(Box::new(e)),
1168                 },
1169                 result_ok: false,
1170         }
1171 }
1172 /// Checks if the given object is currently in the success state
1173 #[no_mangle]
1174 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1175         o.result_ok
1176 }
1177 #[no_mangle]
1178 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1179 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1180 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1181         fn drop(&mut self) {
1182                 if self.result_ok {
1183                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1184                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1185                         }
1186                 } else {
1187                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1188                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1189                         }
1190                 }
1191         }
1192 }
1193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1194         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1195                 let contents = if o.result_ok {
1196                         let result = unsafe { o.contents.result };
1197                         unsafe { o.contents.result = std::ptr::null_mut() };
1198                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1199                 } else {
1200                         let err = unsafe { o.contents.err };
1201                         unsafe { o.contents.err = std::ptr::null_mut(); }
1202                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1203                 };
1204                 Self {
1205                         contents,
1206                         result_ok: o.result_ok,
1207                 }
1208         }
1209 }
1210 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1211         fn clone(&self) -> Self {
1212                 if self.result_ok {
1213                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1214                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1215                         } }
1216                 } else {
1217                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1218                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1219                         } }
1220                 }
1221         }
1222 }
1223 #[no_mangle]
1224 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1225 /// but with all dynamically-allocated buffers duplicated in new buffers.
1226 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1227 #[repr(C)]
1228 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1229 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1230         /// A pointer to the contents in the success state.
1231         /// Reading from this pointer when `result_ok` is not set is undefined.
1232         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1233         /// Note that this value is always NULL, as there are no contents in the Err variant
1234         pub err: *mut std::ffi::c_void,
1235 }
1236 #[repr(C)]
1237 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1238 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1240 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1241         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1242         /// `err` or `result` depending on the state of `result_ok`.
1243         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1244         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1245         pub result_ok: bool,
1246 }
1247 #[no_mangle]
1248 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1249 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1250         CResult_TrustedCommitmentTransactionNoneZ {
1251                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1252                         result: Box::into_raw(Box::new(o)),
1253                 },
1254                 result_ok: true,
1255         }
1256 }
1257 #[no_mangle]
1258 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1259 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1260         CResult_TrustedCommitmentTransactionNoneZ {
1261                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1262                         err: std::ptr::null_mut(),
1263                 },
1264                 result_ok: false,
1265         }
1266 }
1267 /// Checks if the given object is currently in the success state
1268 #[no_mangle]
1269 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1270         o.result_ok
1271 }
1272 #[no_mangle]
1273 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1274 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1275 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1276         fn drop(&mut self) {
1277                 if self.result_ok {
1278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1280                         }
1281                 } else {
1282                 }
1283         }
1284 }
1285 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1286         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1287                 let contents = if o.result_ok {
1288                         let result = unsafe { o.contents.result };
1289                         unsafe { o.contents.result = std::ptr::null_mut() };
1290                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1291                 } else {
1292                         let _ = unsafe { Box::from_raw(o.contents.err) };
1293                         o.contents.err = std::ptr::null_mut();
1294                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1295                 };
1296                 Self {
1297                         contents,
1298                         result_ok: o.result_ok,
1299                 }
1300         }
1301 }
1302 #[repr(C)]
1303 /// The contents of CResult_CVec_SignatureZNoneZ
1304 pub union CResult_CVec_SignatureZNoneZPtr {
1305         /// A pointer to the contents in the success state.
1306         /// Reading from this pointer when `result_ok` is not set is undefined.
1307         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1308         /// Note that this value is always NULL, as there are no contents in the Err variant
1309         pub err: *mut std::ffi::c_void,
1310 }
1311 #[repr(C)]
1312 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1313 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1315 pub struct CResult_CVec_SignatureZNoneZ {
1316         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1317         /// `err` or `result` depending on the state of `result_ok`.
1318         pub contents: CResult_CVec_SignatureZNoneZPtr,
1319         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1320         pub result_ok: bool,
1321 }
1322 #[no_mangle]
1323 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1324 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1325         CResult_CVec_SignatureZNoneZ {
1326                 contents: CResult_CVec_SignatureZNoneZPtr {
1327                         result: Box::into_raw(Box::new(o)),
1328                 },
1329                 result_ok: true,
1330         }
1331 }
1332 #[no_mangle]
1333 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1334 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1335         CResult_CVec_SignatureZNoneZ {
1336                 contents: CResult_CVec_SignatureZNoneZPtr {
1337                         err: std::ptr::null_mut(),
1338                 },
1339                 result_ok: false,
1340         }
1341 }
1342 /// Checks if the given object is currently in the success state
1343 #[no_mangle]
1344 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1345         o.result_ok
1346 }
1347 #[no_mangle]
1348 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1349 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1350 impl Drop for CResult_CVec_SignatureZNoneZ {
1351         fn drop(&mut self) {
1352                 if self.result_ok {
1353                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1354                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1355                         }
1356                 } else {
1357                 }
1358         }
1359 }
1360 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1361         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1362                 let contents = if o.result_ok {
1363                         let result = unsafe { o.contents.result };
1364                         unsafe { o.contents.result = std::ptr::null_mut() };
1365                         CResult_CVec_SignatureZNoneZPtr { result }
1366                 } else {
1367                         let _ = unsafe { Box::from_raw(o.contents.err) };
1368                         o.contents.err = std::ptr::null_mut();
1369                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1370                 };
1371                 Self {
1372                         contents,
1373                         result_ok: o.result_ok,
1374                 }
1375         }
1376 }
1377 impl Clone for CResult_CVec_SignatureZNoneZ {
1378         fn clone(&self) -> Self {
1379                 if self.result_ok {
1380                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1381                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1382                         } }
1383                 } else {
1384                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1385                                 err: std::ptr::null_mut()
1386                         } }
1387                 }
1388         }
1389 }
1390 #[no_mangle]
1391 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1392 /// but with all dynamically-allocated buffers duplicated in new buffers.
1393 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1394 #[repr(C)]
1395 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1396 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1397         /// A pointer to the contents in the success state.
1398         /// Reading from this pointer when `result_ok` is not set is undefined.
1399         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1400         /// A pointer to the contents in the error state.
1401         /// Reading from this pointer when `result_ok` is set is undefined.
1402         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1403 }
1404 #[repr(C)]
1405 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1406 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1408 pub struct CResult_ShutdownScriptDecodeErrorZ {
1409         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1410         /// `err` or `result` depending on the state of `result_ok`.
1411         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1412         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1413         pub result_ok: bool,
1414 }
1415 #[no_mangle]
1416 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1417 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1418         CResult_ShutdownScriptDecodeErrorZ {
1419                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1420                         result: Box::into_raw(Box::new(o)),
1421                 },
1422                 result_ok: true,
1423         }
1424 }
1425 #[no_mangle]
1426 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1427 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1428         CResult_ShutdownScriptDecodeErrorZ {
1429                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1430                         err: Box::into_raw(Box::new(e)),
1431                 },
1432                 result_ok: false,
1433         }
1434 }
1435 /// Checks if the given object is currently in the success state
1436 #[no_mangle]
1437 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1438         o.result_ok
1439 }
1440 #[no_mangle]
1441 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1442 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1443 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1444         fn drop(&mut self) {
1445                 if self.result_ok {
1446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1448                         }
1449                 } else {
1450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1452                         }
1453                 }
1454         }
1455 }
1456 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1457         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1458                 let contents = if o.result_ok {
1459                         let result = unsafe { o.contents.result };
1460                         unsafe { o.contents.result = std::ptr::null_mut() };
1461                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1462                 } else {
1463                         let err = unsafe { o.contents.err };
1464                         unsafe { o.contents.err = std::ptr::null_mut(); }
1465                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1466                 };
1467                 Self {
1468                         contents,
1469                         result_ok: o.result_ok,
1470                 }
1471         }
1472 }
1473 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1474         fn clone(&self) -> Self {
1475                 if self.result_ok {
1476                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1477                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1478                         } }
1479                 } else {
1480                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1481                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1482                         } }
1483                 }
1484         }
1485 }
1486 #[no_mangle]
1487 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1488 /// but with all dynamically-allocated buffers duplicated in new buffers.
1489 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1490 #[repr(C)]
1491 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1492 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1493         /// A pointer to the contents in the success state.
1494         /// Reading from this pointer when `result_ok` is not set is undefined.
1495         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1496         /// A pointer to the contents in the error state.
1497         /// Reading from this pointer when `result_ok` is set is undefined.
1498         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1499 }
1500 #[repr(C)]
1501 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1502 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1504 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1505         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1506         /// `err` or `result` depending on the state of `result_ok`.
1507         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1508         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1509         pub result_ok: bool,
1510 }
1511 #[no_mangle]
1512 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1513 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1514         CResult_ShutdownScriptInvalidShutdownScriptZ {
1515                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1516                         result: Box::into_raw(Box::new(o)),
1517                 },
1518                 result_ok: true,
1519         }
1520 }
1521 #[no_mangle]
1522 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1523 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1524         CResult_ShutdownScriptInvalidShutdownScriptZ {
1525                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1526                         err: Box::into_raw(Box::new(e)),
1527                 },
1528                 result_ok: false,
1529         }
1530 }
1531 /// Checks if the given object is currently in the success state
1532 #[no_mangle]
1533 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1534         o.result_ok
1535 }
1536 #[no_mangle]
1537 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1538 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1539 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1540         fn drop(&mut self) {
1541                 if self.result_ok {
1542                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1543                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1544                         }
1545                 } else {
1546                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1547                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1548                         }
1549                 }
1550         }
1551 }
1552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1553         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1554                 let contents = if o.result_ok {
1555                         let result = unsafe { o.contents.result };
1556                         unsafe { o.contents.result = std::ptr::null_mut() };
1557                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1558                 } else {
1559                         let err = unsafe { o.contents.err };
1560                         unsafe { o.contents.err = std::ptr::null_mut(); }
1561                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1562                 };
1563                 Self {
1564                         contents,
1565                         result_ok: o.result_ok,
1566                 }
1567         }
1568 }
1569 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1570         fn clone(&self) -> Self {
1571                 if self.result_ok {
1572                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1573                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1574                         } }
1575                 } else {
1576                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1577                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1578                         } }
1579                 }
1580         }
1581 }
1582 #[no_mangle]
1583 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1584 /// but with all dynamically-allocated buffers duplicated in new buffers.
1585 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1586 #[repr(C)]
1587 /// The contents of CResult_NoneErrorZ
1588 pub union CResult_NoneErrorZPtr {
1589         /// Note that this value is always NULL, as there are no contents in the OK variant
1590         pub result: *mut std::ffi::c_void,
1591         /// A pointer to the contents in the error state.
1592         /// Reading from this pointer when `result_ok` is set is undefined.
1593         pub err: *mut crate::c_types::IOError,
1594 }
1595 #[repr(C)]
1596 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1597 /// containing a () on success and a crate::c_types::IOError on failure.
1598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1599 pub struct CResult_NoneErrorZ {
1600         /// The contents of this CResult_NoneErrorZ, accessible via either
1601         /// `err` or `result` depending on the state of `result_ok`.
1602         pub contents: CResult_NoneErrorZPtr,
1603         /// Whether this CResult_NoneErrorZ represents a success state.
1604         pub result_ok: bool,
1605 }
1606 #[no_mangle]
1607 /// Creates a new CResult_NoneErrorZ in the success state.
1608 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1609         CResult_NoneErrorZ {
1610                 contents: CResult_NoneErrorZPtr {
1611                         result: std::ptr::null_mut(),
1612                 },
1613                 result_ok: true,
1614         }
1615 }
1616 #[no_mangle]
1617 /// Creates a new CResult_NoneErrorZ in the error state.
1618 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1619         CResult_NoneErrorZ {
1620                 contents: CResult_NoneErrorZPtr {
1621                         err: Box::into_raw(Box::new(e)),
1622                 },
1623                 result_ok: false,
1624         }
1625 }
1626 /// Checks if the given object is currently in the success state
1627 #[no_mangle]
1628 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1629         o.result_ok
1630 }
1631 #[no_mangle]
1632 /// Frees any resources used by the CResult_NoneErrorZ.
1633 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1634 impl Drop for CResult_NoneErrorZ {
1635         fn drop(&mut self) {
1636                 if self.result_ok {
1637                 } else {
1638                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1639                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1640                         }
1641                 }
1642         }
1643 }
1644 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1645         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1646                 let contents = if o.result_ok {
1647                         let _ = unsafe { Box::from_raw(o.contents.result) };
1648                         o.contents.result = std::ptr::null_mut();
1649                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
1650                 } else {
1651                         let err = unsafe { o.contents.err };
1652                         unsafe { o.contents.err = std::ptr::null_mut(); }
1653                         CResult_NoneErrorZPtr { err }
1654                 };
1655                 Self {
1656                         contents,
1657                         result_ok: o.result_ok,
1658                 }
1659         }
1660 }
1661 impl Clone for CResult_NoneErrorZ {
1662         fn clone(&self) -> Self {
1663                 if self.result_ok {
1664                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1665                                 result: std::ptr::null_mut()
1666                         } }
1667                 } else {
1668                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1669                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1670                         } }
1671                 }
1672         }
1673 }
1674 #[no_mangle]
1675 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1676 /// but with all dynamically-allocated buffers duplicated in new buffers.
1677 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1678 #[repr(C)]
1679 /// The contents of CResult_RouteHopDecodeErrorZ
1680 pub union CResult_RouteHopDecodeErrorZPtr {
1681         /// A pointer to the contents in the success state.
1682         /// Reading from this pointer when `result_ok` is not set is undefined.
1683         pub result: *mut crate::lightning::routing::router::RouteHop,
1684         /// A pointer to the contents in the error state.
1685         /// Reading from this pointer when `result_ok` is set is undefined.
1686         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1687 }
1688 #[repr(C)]
1689 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1690 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1692 pub struct CResult_RouteHopDecodeErrorZ {
1693         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1694         /// `err` or `result` depending on the state of `result_ok`.
1695         pub contents: CResult_RouteHopDecodeErrorZPtr,
1696         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1697         pub result_ok: bool,
1698 }
1699 #[no_mangle]
1700 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1701 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1702         CResult_RouteHopDecodeErrorZ {
1703                 contents: CResult_RouteHopDecodeErrorZPtr {
1704                         result: Box::into_raw(Box::new(o)),
1705                 },
1706                 result_ok: true,
1707         }
1708 }
1709 #[no_mangle]
1710 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1711 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1712         CResult_RouteHopDecodeErrorZ {
1713                 contents: CResult_RouteHopDecodeErrorZPtr {
1714                         err: Box::into_raw(Box::new(e)),
1715                 },
1716                 result_ok: false,
1717         }
1718 }
1719 /// Checks if the given object is currently in the success state
1720 #[no_mangle]
1721 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1722         o.result_ok
1723 }
1724 #[no_mangle]
1725 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1726 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1727 impl Drop for CResult_RouteHopDecodeErrorZ {
1728         fn drop(&mut self) {
1729                 if self.result_ok {
1730                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1731                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1732                         }
1733                 } else {
1734                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1735                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1736                         }
1737                 }
1738         }
1739 }
1740 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1741         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1742                 let contents = if o.result_ok {
1743                         let result = unsafe { o.contents.result };
1744                         unsafe { o.contents.result = std::ptr::null_mut() };
1745                         CResult_RouteHopDecodeErrorZPtr { result }
1746                 } else {
1747                         let err = unsafe { o.contents.err };
1748                         unsafe { o.contents.err = std::ptr::null_mut(); }
1749                         CResult_RouteHopDecodeErrorZPtr { err }
1750                 };
1751                 Self {
1752                         contents,
1753                         result_ok: o.result_ok,
1754                 }
1755         }
1756 }
1757 impl Clone for CResult_RouteHopDecodeErrorZ {
1758         fn clone(&self) -> Self {
1759                 if self.result_ok {
1760                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1761                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1762                         } }
1763                 } else {
1764                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1765                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1766                         } }
1767                 }
1768         }
1769 }
1770 #[no_mangle]
1771 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1772 /// but with all dynamically-allocated buffers duplicated in new buffers.
1773 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1774 #[repr(C)]
1775 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1776 /// This corresponds to std::vector in C++
1777 pub struct CVec_RouteHopZ {
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::lightning::routing::router::RouteHop,
1781         /// The number of elements pointed to by `data`.
1782         pub datalen: usize
1783 }
1784 impl CVec_RouteHopZ {
1785         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
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::lightning::routing::router::RouteHop] {
1793                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1794         }
1795 }
1796 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1797         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> 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_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1806 impl Drop for CVec_RouteHopZ {
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_RouteHopZ {
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 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1822 /// This corresponds to std::vector in C++
1823 pub struct CVec_CVec_RouteHopZZ {
1824         /// The elements in the array.
1825         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1826         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1827         /// The number of elements pointed to by `data`.
1828         pub datalen: usize
1829 }
1830 impl CVec_CVec_RouteHopZZ {
1831         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1832                 if self.datalen == 0 { return Vec::new(); }
1833                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1834                 self.data = std::ptr::null_mut();
1835                 self.datalen = 0;
1836                 ret
1837         }
1838         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1839                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1840         }
1841 }
1842 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1843         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1844                 let datalen = v.len();
1845                 let data = Box::into_raw(v.into_boxed_slice());
1846                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1847         }
1848 }
1849 #[no_mangle]
1850 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1851 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1852 impl Drop for CVec_CVec_RouteHopZZ {
1853         fn drop(&mut self) {
1854                 if self.datalen == 0 { return; }
1855                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1856         }
1857 }
1858 impl Clone for CVec_CVec_RouteHopZZ {
1859         fn clone(&self) -> Self {
1860                 let mut res = Vec::new();
1861                 if self.datalen == 0 { return Self::from(res); }
1862                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1863                 Self::from(res)
1864         }
1865 }
1866 #[repr(C)]
1867 /// The contents of CResult_RouteDecodeErrorZ
1868 pub union CResult_RouteDecodeErrorZPtr {
1869         /// A pointer to the contents in the success state.
1870         /// Reading from this pointer when `result_ok` is not set is undefined.
1871         pub result: *mut crate::lightning::routing::router::Route,
1872         /// A pointer to the contents in the error state.
1873         /// Reading from this pointer when `result_ok` is set is undefined.
1874         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1875 }
1876 #[repr(C)]
1877 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1878 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1880 pub struct CResult_RouteDecodeErrorZ {
1881         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1882         /// `err` or `result` depending on the state of `result_ok`.
1883         pub contents: CResult_RouteDecodeErrorZPtr,
1884         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1885         pub result_ok: bool,
1886 }
1887 #[no_mangle]
1888 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1889 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1890         CResult_RouteDecodeErrorZ {
1891                 contents: CResult_RouteDecodeErrorZPtr {
1892                         result: Box::into_raw(Box::new(o)),
1893                 },
1894                 result_ok: true,
1895         }
1896 }
1897 #[no_mangle]
1898 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1899 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1900         CResult_RouteDecodeErrorZ {
1901                 contents: CResult_RouteDecodeErrorZPtr {
1902                         err: Box::into_raw(Box::new(e)),
1903                 },
1904                 result_ok: false,
1905         }
1906 }
1907 /// Checks if the given object is currently in the success state
1908 #[no_mangle]
1909 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
1910         o.result_ok
1911 }
1912 #[no_mangle]
1913 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1914 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1915 impl Drop for CResult_RouteDecodeErrorZ {
1916         fn drop(&mut self) {
1917                 if self.result_ok {
1918                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1919                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1920                         }
1921                 } else {
1922                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1923                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1924                         }
1925                 }
1926         }
1927 }
1928 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1929         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1930                 let contents = if o.result_ok {
1931                         let result = unsafe { o.contents.result };
1932                         unsafe { o.contents.result = std::ptr::null_mut() };
1933                         CResult_RouteDecodeErrorZPtr { result }
1934                 } else {
1935                         let err = unsafe { o.contents.err };
1936                         unsafe { o.contents.err = std::ptr::null_mut(); }
1937                         CResult_RouteDecodeErrorZPtr { err }
1938                 };
1939                 Self {
1940                         contents,
1941                         result_ok: o.result_ok,
1942                 }
1943         }
1944 }
1945 impl Clone for CResult_RouteDecodeErrorZ {
1946         fn clone(&self) -> Self {
1947                 if self.result_ok {
1948                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1949                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1950                         } }
1951                 } else {
1952                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1953                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1954                         } }
1955                 }
1956         }
1957 }
1958 #[no_mangle]
1959 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1960 /// but with all dynamically-allocated buffers duplicated in new buffers.
1961 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1962 #[repr(C)]
1963 /// The contents of CResult_RouteParametersDecodeErrorZ
1964 pub union CResult_RouteParametersDecodeErrorZPtr {
1965         /// A pointer to the contents in the success state.
1966         /// Reading from this pointer when `result_ok` is not set is undefined.
1967         pub result: *mut crate::lightning::routing::router::RouteParameters,
1968         /// A pointer to the contents in the error state.
1969         /// Reading from this pointer when `result_ok` is set is undefined.
1970         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1971 }
1972 #[repr(C)]
1973 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1974 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1976 pub struct CResult_RouteParametersDecodeErrorZ {
1977         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1978         /// `err` or `result` depending on the state of `result_ok`.
1979         pub contents: CResult_RouteParametersDecodeErrorZPtr,
1980         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1981         pub result_ok: bool,
1982 }
1983 #[no_mangle]
1984 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1985 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1986         CResult_RouteParametersDecodeErrorZ {
1987                 contents: CResult_RouteParametersDecodeErrorZPtr {
1988                         result: Box::into_raw(Box::new(o)),
1989                 },
1990                 result_ok: true,
1991         }
1992 }
1993 #[no_mangle]
1994 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
1995 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
1996         CResult_RouteParametersDecodeErrorZ {
1997                 contents: CResult_RouteParametersDecodeErrorZPtr {
1998                         err: Box::into_raw(Box::new(e)),
1999                 },
2000                 result_ok: false,
2001         }
2002 }
2003 /// Checks if the given object is currently in the success state
2004 #[no_mangle]
2005 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2006         o.result_ok
2007 }
2008 #[no_mangle]
2009 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2010 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2011 impl Drop for CResult_RouteParametersDecodeErrorZ {
2012         fn drop(&mut self) {
2013                 if self.result_ok {
2014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2016                         }
2017                 } else {
2018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2020                         }
2021                 }
2022         }
2023 }
2024 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2026                 let contents = if o.result_ok {
2027                         let result = unsafe { o.contents.result };
2028                         unsafe { o.contents.result = std::ptr::null_mut() };
2029                         CResult_RouteParametersDecodeErrorZPtr { result }
2030                 } else {
2031                         let err = unsafe { o.contents.err };
2032                         unsafe { o.contents.err = std::ptr::null_mut(); }
2033                         CResult_RouteParametersDecodeErrorZPtr { err }
2034                 };
2035                 Self {
2036                         contents,
2037                         result_ok: o.result_ok,
2038                 }
2039         }
2040 }
2041 impl Clone for CResult_RouteParametersDecodeErrorZ {
2042         fn clone(&self) -> Self {
2043                 if self.result_ok {
2044                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2045                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2046                         } }
2047                 } else {
2048                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2049                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2050                         } }
2051                 }
2052         }
2053 }
2054 #[no_mangle]
2055 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2056 /// but with all dynamically-allocated buffers duplicated in new buffers.
2057 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2058 #[repr(C)]
2059 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2060 /// This corresponds to std::vector in C++
2061 pub struct CVec_RouteHintZ {
2062         /// The elements in the array.
2063         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2064         pub data: *mut crate::lightning::routing::router::RouteHint,
2065         /// The number of elements pointed to by `data`.
2066         pub datalen: usize
2067 }
2068 impl CVec_RouteHintZ {
2069         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2070                 if self.datalen == 0 { return Vec::new(); }
2071                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2072                 self.data = std::ptr::null_mut();
2073                 self.datalen = 0;
2074                 ret
2075         }
2076         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2077                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2078         }
2079 }
2080 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2081         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2082                 let datalen = v.len();
2083                 let data = Box::into_raw(v.into_boxed_slice());
2084                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2085         }
2086 }
2087 #[no_mangle]
2088 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2089 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2090 impl Drop for CVec_RouteHintZ {
2091         fn drop(&mut self) {
2092                 if self.datalen == 0 { return; }
2093                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2094         }
2095 }
2096 impl Clone for CVec_RouteHintZ {
2097         fn clone(&self) -> Self {
2098                 let mut res = Vec::new();
2099                 if self.datalen == 0 { return Self::from(res); }
2100                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2101                 Self::from(res)
2102         }
2103 }
2104 #[repr(C)]
2105 #[derive(Clone)]
2106 /// An enum which can either contain a u64 or not
2107 pub enum COption_u64Z {
2108         /// When we're in this state, this COption_u64Z contains a u64
2109         Some(u64),
2110         /// When we're in this state, this COption_u64Z contains nothing
2111         None
2112 }
2113 impl COption_u64Z {
2114         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2115                 if let Self::None = self { false } else { true }
2116         }
2117         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2118                 !self.is_some()
2119         }
2120         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2121                 if let Self::Some(v) = self { v } else { unreachable!() }
2122         }
2123 }
2124 #[no_mangle]
2125 /// Constructs a new COption_u64Z containing a u64
2126 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2127         COption_u64Z::Some(o)
2128 }
2129 #[no_mangle]
2130 /// Constructs a new COption_u64Z containing nothing
2131 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2132         COption_u64Z::None
2133 }
2134 #[no_mangle]
2135 /// Frees any resources associated with the u64, if we are in the Some state
2136 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2137 #[no_mangle]
2138 /// Creates a new COption_u64Z which has the same data as `orig`
2139 /// but with all dynamically-allocated buffers duplicated in new buffers.
2140 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2141 #[repr(C)]
2142 /// The contents of CResult_PayeeDecodeErrorZ
2143 pub union CResult_PayeeDecodeErrorZPtr {
2144         /// A pointer to the contents in the success state.
2145         /// Reading from this pointer when `result_ok` is not set is undefined.
2146         pub result: *mut crate::lightning::routing::router::Payee,
2147         /// A pointer to the contents in the error state.
2148         /// Reading from this pointer when `result_ok` is set is undefined.
2149         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2150 }
2151 #[repr(C)]
2152 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2153 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2154 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2155 pub struct CResult_PayeeDecodeErrorZ {
2156         /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2157         /// `err` or `result` depending on the state of `result_ok`.
2158         pub contents: CResult_PayeeDecodeErrorZPtr,
2159         /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2160         pub result_ok: bool,
2161 }
2162 #[no_mangle]
2163 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2164 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2165         CResult_PayeeDecodeErrorZ {
2166                 contents: CResult_PayeeDecodeErrorZPtr {
2167                         result: Box::into_raw(Box::new(o)),
2168                 },
2169                 result_ok: true,
2170         }
2171 }
2172 #[no_mangle]
2173 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2174 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2175         CResult_PayeeDecodeErrorZ {
2176                 contents: CResult_PayeeDecodeErrorZPtr {
2177                         err: Box::into_raw(Box::new(e)),
2178                 },
2179                 result_ok: false,
2180         }
2181 }
2182 /// Checks if the given object is currently in the success state
2183 #[no_mangle]
2184 pub extern "C" fn CResult_PayeeDecodeErrorZ_is_ok(o: &CResult_PayeeDecodeErrorZ) -> bool {
2185         o.result_ok
2186 }
2187 #[no_mangle]
2188 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2189 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2190 impl Drop for CResult_PayeeDecodeErrorZ {
2191         fn drop(&mut self) {
2192                 if self.result_ok {
2193                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2194                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2195                         }
2196                 } else {
2197                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2198                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2199                         }
2200                 }
2201         }
2202 }
2203 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2204         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2205                 let contents = if o.result_ok {
2206                         let result = unsafe { o.contents.result };
2207                         unsafe { o.contents.result = std::ptr::null_mut() };
2208                         CResult_PayeeDecodeErrorZPtr { result }
2209                 } else {
2210                         let err = unsafe { o.contents.err };
2211                         unsafe { o.contents.err = std::ptr::null_mut(); }
2212                         CResult_PayeeDecodeErrorZPtr { err }
2213                 };
2214                 Self {
2215                         contents,
2216                         result_ok: o.result_ok,
2217                 }
2218         }
2219 }
2220 impl Clone for CResult_PayeeDecodeErrorZ {
2221         fn clone(&self) -> Self {
2222                 if self.result_ok {
2223                         Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2224                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2225                         } }
2226                 } else {
2227                         Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2228                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2229                         } }
2230                 }
2231         }
2232 }
2233 #[no_mangle]
2234 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2235 /// but with all dynamically-allocated buffers duplicated in new buffers.
2236 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2237 #[repr(C)]
2238 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2239 /// This corresponds to std::vector in C++
2240 pub struct CVec_RouteHintHopZ {
2241         /// The elements in the array.
2242         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2243         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2244         /// The number of elements pointed to by `data`.
2245         pub datalen: usize
2246 }
2247 impl CVec_RouteHintHopZ {
2248         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2249                 if self.datalen == 0 { return Vec::new(); }
2250                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2251                 self.data = std::ptr::null_mut();
2252                 self.datalen = 0;
2253                 ret
2254         }
2255         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2256                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2257         }
2258 }
2259 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2260         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2261                 let datalen = v.len();
2262                 let data = Box::into_raw(v.into_boxed_slice());
2263                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2264         }
2265 }
2266 #[no_mangle]
2267 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2268 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2269 impl Drop for CVec_RouteHintHopZ {
2270         fn drop(&mut self) {
2271                 if self.datalen == 0 { return; }
2272                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2273         }
2274 }
2275 impl Clone for CVec_RouteHintHopZ {
2276         fn clone(&self) -> Self {
2277                 let mut res = Vec::new();
2278                 if self.datalen == 0 { return Self::from(res); }
2279                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2280                 Self::from(res)
2281         }
2282 }
2283 #[repr(C)]
2284 /// The contents of CResult_RouteHintDecodeErrorZ
2285 pub union CResult_RouteHintDecodeErrorZPtr {
2286         /// A pointer to the contents in the success state.
2287         /// Reading from this pointer when `result_ok` is not set is undefined.
2288         pub result: *mut crate::lightning::routing::router::RouteHint,
2289         /// A pointer to the contents in the error state.
2290         /// Reading from this pointer when `result_ok` is set is undefined.
2291         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2292 }
2293 #[repr(C)]
2294 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2295 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2297 pub struct CResult_RouteHintDecodeErrorZ {
2298         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2299         /// `err` or `result` depending on the state of `result_ok`.
2300         pub contents: CResult_RouteHintDecodeErrorZPtr,
2301         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2302         pub result_ok: bool,
2303 }
2304 #[no_mangle]
2305 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2306 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2307         CResult_RouteHintDecodeErrorZ {
2308                 contents: CResult_RouteHintDecodeErrorZPtr {
2309                         result: Box::into_raw(Box::new(o)),
2310                 },
2311                 result_ok: true,
2312         }
2313 }
2314 #[no_mangle]
2315 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2316 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2317         CResult_RouteHintDecodeErrorZ {
2318                 contents: CResult_RouteHintDecodeErrorZPtr {
2319                         err: Box::into_raw(Box::new(e)),
2320                 },
2321                 result_ok: false,
2322         }
2323 }
2324 /// Checks if the given object is currently in the success state
2325 #[no_mangle]
2326 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2327         o.result_ok
2328 }
2329 #[no_mangle]
2330 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2331 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2332 impl Drop for CResult_RouteHintDecodeErrorZ {
2333         fn drop(&mut self) {
2334                 if self.result_ok {
2335                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2336                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2337                         }
2338                 } else {
2339                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2340                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2341                         }
2342                 }
2343         }
2344 }
2345 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2346         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2347                 let contents = if o.result_ok {
2348                         let result = unsafe { o.contents.result };
2349                         unsafe { o.contents.result = std::ptr::null_mut() };
2350                         CResult_RouteHintDecodeErrorZPtr { result }
2351                 } else {
2352                         let err = unsafe { o.contents.err };
2353                         unsafe { o.contents.err = std::ptr::null_mut(); }
2354                         CResult_RouteHintDecodeErrorZPtr { err }
2355                 };
2356                 Self {
2357                         contents,
2358                         result_ok: o.result_ok,
2359                 }
2360         }
2361 }
2362 impl Clone for CResult_RouteHintDecodeErrorZ {
2363         fn clone(&self) -> Self {
2364                 if self.result_ok {
2365                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2366                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2367                         } }
2368                 } else {
2369                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2370                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2371                         } }
2372                 }
2373         }
2374 }
2375 #[no_mangle]
2376 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2377 /// but with all dynamically-allocated buffers duplicated in new buffers.
2378 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2379 #[repr(C)]
2380 /// The contents of CResult_RouteHintHopDecodeErrorZ
2381 pub union CResult_RouteHintHopDecodeErrorZPtr {
2382         /// A pointer to the contents in the success state.
2383         /// Reading from this pointer when `result_ok` is not set is undefined.
2384         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2385         /// A pointer to the contents in the error state.
2386         /// Reading from this pointer when `result_ok` is set is undefined.
2387         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2388 }
2389 #[repr(C)]
2390 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2391 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2393 pub struct CResult_RouteHintHopDecodeErrorZ {
2394         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2395         /// `err` or `result` depending on the state of `result_ok`.
2396         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2397         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2398         pub result_ok: bool,
2399 }
2400 #[no_mangle]
2401 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2402 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2403         CResult_RouteHintHopDecodeErrorZ {
2404                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2405                         result: Box::into_raw(Box::new(o)),
2406                 },
2407                 result_ok: true,
2408         }
2409 }
2410 #[no_mangle]
2411 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2412 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2413         CResult_RouteHintHopDecodeErrorZ {
2414                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2415                         err: Box::into_raw(Box::new(e)),
2416                 },
2417                 result_ok: false,
2418         }
2419 }
2420 /// Checks if the given object is currently in the success state
2421 #[no_mangle]
2422 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2423         o.result_ok
2424 }
2425 #[no_mangle]
2426 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2427 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2428 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2429         fn drop(&mut self) {
2430                 if self.result_ok {
2431                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2432                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2433                         }
2434                 } else {
2435                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2436                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2437                         }
2438                 }
2439         }
2440 }
2441 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2442         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2443                 let contents = if o.result_ok {
2444                         let result = unsafe { o.contents.result };
2445                         unsafe { o.contents.result = std::ptr::null_mut() };
2446                         CResult_RouteHintHopDecodeErrorZPtr { result }
2447                 } else {
2448                         let err = unsafe { o.contents.err };
2449                         unsafe { o.contents.err = std::ptr::null_mut(); }
2450                         CResult_RouteHintHopDecodeErrorZPtr { err }
2451                 };
2452                 Self {
2453                         contents,
2454                         result_ok: o.result_ok,
2455                 }
2456         }
2457 }
2458 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2459         fn clone(&self) -> Self {
2460                 if self.result_ok {
2461                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2462                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2463                         } }
2464                 } else {
2465                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2466                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2467                         } }
2468                 }
2469         }
2470 }
2471 #[no_mangle]
2472 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2473 /// but with all dynamically-allocated buffers duplicated in new buffers.
2474 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2475 #[repr(C)]
2476 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2477 /// This corresponds to std::vector in C++
2478 pub struct CVec_ChannelDetailsZ {
2479         /// The elements in the array.
2480         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2481         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2482         /// The number of elements pointed to by `data`.
2483         pub datalen: usize
2484 }
2485 impl CVec_ChannelDetailsZ {
2486         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2487                 if self.datalen == 0 { return Vec::new(); }
2488                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2489                 self.data = std::ptr::null_mut();
2490                 self.datalen = 0;
2491                 ret
2492         }
2493         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2494                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2495         }
2496 }
2497 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2498         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2499                 let datalen = v.len();
2500                 let data = Box::into_raw(v.into_boxed_slice());
2501                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2502         }
2503 }
2504 #[no_mangle]
2505 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2506 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2507 impl Drop for CVec_ChannelDetailsZ {
2508         fn drop(&mut self) {
2509                 if self.datalen == 0 { return; }
2510                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2511         }
2512 }
2513 impl Clone for CVec_ChannelDetailsZ {
2514         fn clone(&self) -> Self {
2515                 let mut res = Vec::new();
2516                 if self.datalen == 0 { return Self::from(res); }
2517                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2518                 Self::from(res)
2519         }
2520 }
2521 #[repr(C)]
2522 /// The contents of CResult_RouteLightningErrorZ
2523 pub union CResult_RouteLightningErrorZPtr {
2524         /// A pointer to the contents in the success state.
2525         /// Reading from this pointer when `result_ok` is not set is undefined.
2526         pub result: *mut crate::lightning::routing::router::Route,
2527         /// A pointer to the contents in the error state.
2528         /// Reading from this pointer when `result_ok` is set is undefined.
2529         pub err: *mut crate::lightning::ln::msgs::LightningError,
2530 }
2531 #[repr(C)]
2532 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2533 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2535 pub struct CResult_RouteLightningErrorZ {
2536         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2537         /// `err` or `result` depending on the state of `result_ok`.
2538         pub contents: CResult_RouteLightningErrorZPtr,
2539         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2540         pub result_ok: bool,
2541 }
2542 #[no_mangle]
2543 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2544 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2545         CResult_RouteLightningErrorZ {
2546                 contents: CResult_RouteLightningErrorZPtr {
2547                         result: Box::into_raw(Box::new(o)),
2548                 },
2549                 result_ok: true,
2550         }
2551 }
2552 #[no_mangle]
2553 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2554 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2555         CResult_RouteLightningErrorZ {
2556                 contents: CResult_RouteLightningErrorZPtr {
2557                         err: Box::into_raw(Box::new(e)),
2558                 },
2559                 result_ok: false,
2560         }
2561 }
2562 /// Checks if the given object is currently in the success state
2563 #[no_mangle]
2564 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2565         o.result_ok
2566 }
2567 #[no_mangle]
2568 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2569 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2570 impl Drop for CResult_RouteLightningErrorZ {
2571         fn drop(&mut self) {
2572                 if self.result_ok {
2573                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2574                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2575                         }
2576                 } else {
2577                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2578                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2579                         }
2580                 }
2581         }
2582 }
2583 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2584         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2585                 let contents = if o.result_ok {
2586                         let result = unsafe { o.contents.result };
2587                         unsafe { o.contents.result = std::ptr::null_mut() };
2588                         CResult_RouteLightningErrorZPtr { result }
2589                 } else {
2590                         let err = unsafe { o.contents.err };
2591                         unsafe { o.contents.err = std::ptr::null_mut(); }
2592                         CResult_RouteLightningErrorZPtr { err }
2593                 };
2594                 Self {
2595                         contents,
2596                         result_ok: o.result_ok,
2597                 }
2598         }
2599 }
2600 impl Clone for CResult_RouteLightningErrorZ {
2601         fn clone(&self) -> Self {
2602                 if self.result_ok {
2603                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2604                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2605                         } }
2606                 } else {
2607                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2608                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2609                         } }
2610                 }
2611         }
2612 }
2613 #[no_mangle]
2614 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2615 /// but with all dynamically-allocated buffers duplicated in new buffers.
2616 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2617 #[repr(C)]
2618 /// The contents of CResult_TxOutAccessErrorZ
2619 pub union CResult_TxOutAccessErrorZPtr {
2620         /// A pointer to the contents in the success state.
2621         /// Reading from this pointer when `result_ok` is not set is undefined.
2622         pub result: *mut crate::c_types::TxOut,
2623         /// A pointer to the contents in the error state.
2624         /// Reading from this pointer when `result_ok` is set is undefined.
2625         pub err: *mut crate::lightning::chain::AccessError,
2626 }
2627 #[repr(C)]
2628 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2629 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2631 pub struct CResult_TxOutAccessErrorZ {
2632         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2633         /// `err` or `result` depending on the state of `result_ok`.
2634         pub contents: CResult_TxOutAccessErrorZPtr,
2635         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2636         pub result_ok: bool,
2637 }
2638 #[no_mangle]
2639 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2640 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2641         CResult_TxOutAccessErrorZ {
2642                 contents: CResult_TxOutAccessErrorZPtr {
2643                         result: Box::into_raw(Box::new(o)),
2644                 },
2645                 result_ok: true,
2646         }
2647 }
2648 #[no_mangle]
2649 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2650 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2651         CResult_TxOutAccessErrorZ {
2652                 contents: CResult_TxOutAccessErrorZPtr {
2653                         err: Box::into_raw(Box::new(e)),
2654                 },
2655                 result_ok: false,
2656         }
2657 }
2658 /// Checks if the given object is currently in the success state
2659 #[no_mangle]
2660 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2661         o.result_ok
2662 }
2663 #[no_mangle]
2664 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2665 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2666 impl Drop for CResult_TxOutAccessErrorZ {
2667         fn drop(&mut self) {
2668                 if self.result_ok {
2669                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2670                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2671                         }
2672                 } else {
2673                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2674                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2675                         }
2676                 }
2677         }
2678 }
2679 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2680         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2681                 let contents = if o.result_ok {
2682                         let result = unsafe { o.contents.result };
2683                         unsafe { o.contents.result = std::ptr::null_mut() };
2684                         CResult_TxOutAccessErrorZPtr { result }
2685                 } else {
2686                         let err = unsafe { o.contents.err };
2687                         unsafe { o.contents.err = std::ptr::null_mut(); }
2688                         CResult_TxOutAccessErrorZPtr { err }
2689                 };
2690                 Self {
2691                         contents,
2692                         result_ok: o.result_ok,
2693                 }
2694         }
2695 }
2696 impl Clone for CResult_TxOutAccessErrorZ {
2697         fn clone(&self) -> Self {
2698                 if self.result_ok {
2699                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2700                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2701                         } }
2702                 } else {
2703                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2704                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2705                         } }
2706                 }
2707         }
2708 }
2709 #[no_mangle]
2710 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2711 /// but with all dynamically-allocated buffers duplicated in new buffers.
2712 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2713 #[repr(C)]
2714 /// A tuple of 2 elements. See the individual fields for the types contained.
2715 pub struct C2Tuple_usizeTransactionZ {
2716         /// The element at position 0
2717         pub a: usize,
2718         /// The element at position 1
2719         pub b: crate::c_types::Transaction,
2720 }
2721 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2722         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2723                 Self {
2724                         a: tup.0,
2725                         b: tup.1,
2726                 }
2727         }
2728 }
2729 impl C2Tuple_usizeTransactionZ {
2730         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2731                 (self.a, self.b)
2732         }
2733 }
2734 impl Clone for C2Tuple_usizeTransactionZ {
2735         fn clone(&self) -> Self {
2736                 Self {
2737                         a: Clone::clone(&self.a),
2738                         b: Clone::clone(&self.b),
2739                 }
2740         }
2741 }
2742 #[no_mangle]
2743 /// Creates a new tuple which has the same data as `orig`
2744 /// but with all dynamically-allocated buffers duplicated in new buffers.
2745 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2746 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2747 #[no_mangle]
2748 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2749         C2Tuple_usizeTransactionZ { a, b, }
2750 }
2751
2752 #[no_mangle]
2753 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2754 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2755 #[repr(C)]
2756 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2757 /// This corresponds to std::vector in C++
2758 pub struct CVec_C2Tuple_usizeTransactionZZ {
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::derived::C2Tuple_usizeTransactionZ,
2762         /// The number of elements pointed to by `data`.
2763         pub datalen: usize
2764 }
2765 impl CVec_C2Tuple_usizeTransactionZZ {
2766         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
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::derived::C2Tuple_usizeTransactionZ] {
2774                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2775         }
2776 }
2777 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2778         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> 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_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2787 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
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_C2Tuple_usizeTransactionZZ {
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 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2803 /// This corresponds to std::vector in C++
2804 pub struct CVec_TxidZ {
2805         /// The elements in the array.
2806         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2807         pub data: *mut crate::c_types::ThirtyTwoBytes,
2808         /// The number of elements pointed to by `data`.
2809         pub datalen: usize
2810 }
2811 impl CVec_TxidZ {
2812         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2813                 if self.datalen == 0 { return Vec::new(); }
2814                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2815                 self.data = std::ptr::null_mut();
2816                 self.datalen = 0;
2817                 ret
2818         }
2819         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2820                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2821         }
2822 }
2823 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2824         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2825                 let datalen = v.len();
2826                 let data = Box::into_raw(v.into_boxed_slice());
2827                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2828         }
2829 }
2830 #[no_mangle]
2831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2832 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2833 impl Drop for CVec_TxidZ {
2834         fn drop(&mut self) {
2835                 if self.datalen == 0 { return; }
2836                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2837         }
2838 }
2839 impl Clone for CVec_TxidZ {
2840         fn clone(&self) -> Self {
2841                 let mut res = Vec::new();
2842                 if self.datalen == 0 { return Self::from(res); }
2843                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2844                 Self::from(res)
2845         }
2846 }
2847 #[repr(C)]
2848 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2849 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2850         /// Note that this value is always NULL, as there are no contents in the OK variant
2851         pub result: *mut std::ffi::c_void,
2852         /// A pointer to the contents in the error state.
2853         /// Reading from this pointer when `result_ok` is set is undefined.
2854         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2855 }
2856 #[repr(C)]
2857 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2858 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2860 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2861         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2862         /// `err` or `result` depending on the state of `result_ok`.
2863         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2864         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2865         pub result_ok: bool,
2866 }
2867 #[no_mangle]
2868 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2869 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2870         CResult_NoneChannelMonitorUpdateErrZ {
2871                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2872                         result: std::ptr::null_mut(),
2873                 },
2874                 result_ok: true,
2875         }
2876 }
2877 #[no_mangle]
2878 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2879 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2880         CResult_NoneChannelMonitorUpdateErrZ {
2881                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2882                         err: Box::into_raw(Box::new(e)),
2883                 },
2884                 result_ok: false,
2885         }
2886 }
2887 /// Checks if the given object is currently in the success state
2888 #[no_mangle]
2889 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
2890         o.result_ok
2891 }
2892 #[no_mangle]
2893 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2894 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2895 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2896         fn drop(&mut self) {
2897                 if self.result_ok {
2898                 } else {
2899                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2900                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2901                         }
2902                 }
2903         }
2904 }
2905 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2906         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2907                 let contents = if o.result_ok {
2908                         let _ = unsafe { Box::from_raw(o.contents.result) };
2909                         o.contents.result = std::ptr::null_mut();
2910                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2911                 } else {
2912                         let err = unsafe { o.contents.err };
2913                         unsafe { o.contents.err = std::ptr::null_mut(); }
2914                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2915                 };
2916                 Self {
2917                         contents,
2918                         result_ok: o.result_ok,
2919                 }
2920         }
2921 }
2922 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2923         fn clone(&self) -> Self {
2924                 if self.result_ok {
2925                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2926                                 result: std::ptr::null_mut()
2927                         } }
2928                 } else {
2929                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2930                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2931                         } }
2932                 }
2933         }
2934 }
2935 #[no_mangle]
2936 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2937 /// but with all dynamically-allocated buffers duplicated in new buffers.
2938 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2939 #[repr(C)]
2940 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2941 /// This corresponds to std::vector in C++
2942 pub struct CVec_MonitorEventZ {
2943         /// The elements in the array.
2944         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2945         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2946         /// The number of elements pointed to by `data`.
2947         pub datalen: usize
2948 }
2949 impl CVec_MonitorEventZ {
2950         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2951                 if self.datalen == 0 { return Vec::new(); }
2952                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2953                 self.data = std::ptr::null_mut();
2954                 self.datalen = 0;
2955                 ret
2956         }
2957         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2958                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2959         }
2960 }
2961 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2962         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2963                 let datalen = v.len();
2964                 let data = Box::into_raw(v.into_boxed_slice());
2965                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2966         }
2967 }
2968 #[no_mangle]
2969 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2970 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2971 impl Drop for CVec_MonitorEventZ {
2972         fn drop(&mut self) {
2973                 if self.datalen == 0 { return; }
2974                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2975         }
2976 }
2977 impl Clone for CVec_MonitorEventZ {
2978         fn clone(&self) -> Self {
2979                 let mut res = Vec::new();
2980                 if self.datalen == 0 { return Self::from(res); }
2981                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2982                 Self::from(res)
2983         }
2984 }
2985 #[repr(C)]
2986 #[derive(Clone)]
2987 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2988 pub enum COption_C2Tuple_usizeTransactionZZ {
2989         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2990         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
2991         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2992         None
2993 }
2994 impl COption_C2Tuple_usizeTransactionZZ {
2995         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2996                 if let Self::None = self { false } else { true }
2997         }
2998         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2999                 !self.is_some()
3000         }
3001         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3002                 if let Self::Some(v) = self { v } else { unreachable!() }
3003         }
3004 }
3005 #[no_mangle]
3006 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3007 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3008         COption_C2Tuple_usizeTransactionZZ::Some(o)
3009 }
3010 #[no_mangle]
3011 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3012 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3013         COption_C2Tuple_usizeTransactionZZ::None
3014 }
3015 #[no_mangle]
3016 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3017 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3018 #[no_mangle]
3019 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3020 /// but with all dynamically-allocated buffers duplicated in new buffers.
3021 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3022 #[repr(C)]
3023 #[derive(Clone)]
3024 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3025 pub enum COption_ClosureReasonZ {
3026         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3027         Some(crate::lightning::util::events::ClosureReason),
3028         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3029         None
3030 }
3031 impl COption_ClosureReasonZ {
3032         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3033                 if let Self::None = self { false } else { true }
3034         }
3035         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3036                 !self.is_some()
3037         }
3038         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3039                 if let Self::Some(v) = self { v } else { unreachable!() }
3040         }
3041 }
3042 #[no_mangle]
3043 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3044 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3045         COption_ClosureReasonZ::Some(o)
3046 }
3047 #[no_mangle]
3048 /// Constructs a new COption_ClosureReasonZ containing nothing
3049 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3050         COption_ClosureReasonZ::None
3051 }
3052 #[no_mangle]
3053 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3054 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3055 #[no_mangle]
3056 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3057 /// but with all dynamically-allocated buffers duplicated in new buffers.
3058 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3059 #[repr(C)]
3060 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3061 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3062         /// A pointer to the contents in the success state.
3063         /// Reading from this pointer when `result_ok` is not set is undefined.
3064         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3065         /// A pointer to the contents in the error state.
3066         /// Reading from this pointer when `result_ok` is set is undefined.
3067         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3068 }
3069 #[repr(C)]
3070 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3071 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3073 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3074         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3075         /// `err` or `result` depending on the state of `result_ok`.
3076         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3077         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3078         pub result_ok: bool,
3079 }
3080 #[no_mangle]
3081 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3082 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3083         CResult_COption_ClosureReasonZDecodeErrorZ {
3084                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3085                         result: Box::into_raw(Box::new(o)),
3086                 },
3087                 result_ok: true,
3088         }
3089 }
3090 #[no_mangle]
3091 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3092 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3093         CResult_COption_ClosureReasonZDecodeErrorZ {
3094                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3095                         err: Box::into_raw(Box::new(e)),
3096                 },
3097                 result_ok: false,
3098         }
3099 }
3100 /// Checks if the given object is currently in the success state
3101 #[no_mangle]
3102 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3103         o.result_ok
3104 }
3105 #[no_mangle]
3106 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3107 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3108 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3109         fn drop(&mut self) {
3110                 if self.result_ok {
3111                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3112                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3113                         }
3114                 } else {
3115                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3116                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3117                         }
3118                 }
3119         }
3120 }
3121 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3122         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3123                 let contents = if o.result_ok {
3124                         let result = unsafe { o.contents.result };
3125                         unsafe { o.contents.result = std::ptr::null_mut() };
3126                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3127                 } else {
3128                         let err = unsafe { o.contents.err };
3129                         unsafe { o.contents.err = std::ptr::null_mut(); }
3130                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3131                 };
3132                 Self {
3133                         contents,
3134                         result_ok: o.result_ok,
3135                 }
3136         }
3137 }
3138 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3139         fn clone(&self) -> Self {
3140                 if self.result_ok {
3141                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3142                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3143                         } }
3144                 } else {
3145                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3146                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3147                         } }
3148                 }
3149         }
3150 }
3151 #[no_mangle]
3152 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3153 /// but with all dynamically-allocated buffers duplicated in new buffers.
3154 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3155 #[repr(C)]
3156 #[derive(Clone)]
3157 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3158 pub enum COption_NetworkUpdateZ {
3159         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3160         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3161         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3162         None
3163 }
3164 impl COption_NetworkUpdateZ {
3165         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3166                 if let Self::None = self { false } else { true }
3167         }
3168         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3169                 !self.is_some()
3170         }
3171         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3172                 if let Self::Some(v) = self { v } else { unreachable!() }
3173         }
3174 }
3175 #[no_mangle]
3176 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3177 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3178         COption_NetworkUpdateZ::Some(o)
3179 }
3180 #[no_mangle]
3181 /// Constructs a new COption_NetworkUpdateZ containing nothing
3182 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3183         COption_NetworkUpdateZ::None
3184 }
3185 #[no_mangle]
3186 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3187 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3188 #[no_mangle]
3189 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3190 /// but with all dynamically-allocated buffers duplicated in new buffers.
3191 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3192 #[repr(C)]
3193 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3194 /// This corresponds to std::vector in C++
3195 pub struct CVec_SpendableOutputDescriptorZ {
3196         /// The elements in the array.
3197         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3198         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3199         /// The number of elements pointed to by `data`.
3200         pub datalen: usize
3201 }
3202 impl CVec_SpendableOutputDescriptorZ {
3203         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3204                 if self.datalen == 0 { return Vec::new(); }
3205                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3206                 self.data = std::ptr::null_mut();
3207                 self.datalen = 0;
3208                 ret
3209         }
3210         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3211                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3212         }
3213 }
3214 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3215         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3216                 let datalen = v.len();
3217                 let data = Box::into_raw(v.into_boxed_slice());
3218                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3219         }
3220 }
3221 #[no_mangle]
3222 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3223 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3224 impl Drop for CVec_SpendableOutputDescriptorZ {
3225         fn drop(&mut self) {
3226                 if self.datalen == 0 { return; }
3227                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3228         }
3229 }
3230 impl Clone for CVec_SpendableOutputDescriptorZ {
3231         fn clone(&self) -> Self {
3232                 let mut res = Vec::new();
3233                 if self.datalen == 0 { return Self::from(res); }
3234                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3235                 Self::from(res)
3236         }
3237 }
3238 #[repr(C)]
3239 #[derive(Clone)]
3240 /// An enum which can either contain a crate::lightning::util::events::Event or not
3241 pub enum COption_EventZ {
3242         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3243         Some(crate::lightning::util::events::Event),
3244         /// When we're in this state, this COption_EventZ contains nothing
3245         None
3246 }
3247 impl COption_EventZ {
3248         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3249                 if let Self::None = self { false } else { true }
3250         }
3251         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3252                 !self.is_some()
3253         }
3254         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3255                 if let Self::Some(v) = self { v } else { unreachable!() }
3256         }
3257 }
3258 #[no_mangle]
3259 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3260 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3261         COption_EventZ::Some(o)
3262 }
3263 #[no_mangle]
3264 /// Constructs a new COption_EventZ containing nothing
3265 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3266         COption_EventZ::None
3267 }
3268 #[no_mangle]
3269 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3270 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3271 #[no_mangle]
3272 /// Creates a new COption_EventZ which has the same data as `orig`
3273 /// but with all dynamically-allocated buffers duplicated in new buffers.
3274 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3275 #[repr(C)]
3276 /// The contents of CResult_COption_EventZDecodeErrorZ
3277 pub union CResult_COption_EventZDecodeErrorZPtr {
3278         /// A pointer to the contents in the success state.
3279         /// Reading from this pointer when `result_ok` is not set is undefined.
3280         pub result: *mut crate::c_types::derived::COption_EventZ,
3281         /// A pointer to the contents in the error state.
3282         /// Reading from this pointer when `result_ok` is set is undefined.
3283         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3284 }
3285 #[repr(C)]
3286 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3287 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3289 pub struct CResult_COption_EventZDecodeErrorZ {
3290         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3291         /// `err` or `result` depending on the state of `result_ok`.
3292         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3293         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3294         pub result_ok: bool,
3295 }
3296 #[no_mangle]
3297 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3298 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3299         CResult_COption_EventZDecodeErrorZ {
3300                 contents: CResult_COption_EventZDecodeErrorZPtr {
3301                         result: Box::into_raw(Box::new(o)),
3302                 },
3303                 result_ok: true,
3304         }
3305 }
3306 #[no_mangle]
3307 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3308 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3309         CResult_COption_EventZDecodeErrorZ {
3310                 contents: CResult_COption_EventZDecodeErrorZPtr {
3311                         err: Box::into_raw(Box::new(e)),
3312                 },
3313                 result_ok: false,
3314         }
3315 }
3316 /// Checks if the given object is currently in the success state
3317 #[no_mangle]
3318 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3319         o.result_ok
3320 }
3321 #[no_mangle]
3322 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3323 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3324 impl Drop for CResult_COption_EventZDecodeErrorZ {
3325         fn drop(&mut self) {
3326                 if self.result_ok {
3327                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3328                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3329                         }
3330                 } else {
3331                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3332                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3333                         }
3334                 }
3335         }
3336 }
3337 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3338         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3339                 let contents = if o.result_ok {
3340                         let result = unsafe { o.contents.result };
3341                         unsafe { o.contents.result = std::ptr::null_mut() };
3342                         CResult_COption_EventZDecodeErrorZPtr { result }
3343                 } else {
3344                         let err = unsafe { o.contents.err };
3345                         unsafe { o.contents.err = std::ptr::null_mut(); }
3346                         CResult_COption_EventZDecodeErrorZPtr { err }
3347                 };
3348                 Self {
3349                         contents,
3350                         result_ok: o.result_ok,
3351                 }
3352         }
3353 }
3354 impl Clone for CResult_COption_EventZDecodeErrorZ {
3355         fn clone(&self) -> Self {
3356                 if self.result_ok {
3357                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3358                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3359                         } }
3360                 } else {
3361                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3362                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3363                         } }
3364                 }
3365         }
3366 }
3367 #[no_mangle]
3368 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3369 /// but with all dynamically-allocated buffers duplicated in new buffers.
3370 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3371 #[repr(C)]
3372 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3373 /// This corresponds to std::vector in C++
3374 pub struct CVec_MessageSendEventZ {
3375         /// The elements in the array.
3376         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3377         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3378         /// The number of elements pointed to by `data`.
3379         pub datalen: usize
3380 }
3381 impl CVec_MessageSendEventZ {
3382         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3383                 if self.datalen == 0 { return Vec::new(); }
3384                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3385                 self.data = std::ptr::null_mut();
3386                 self.datalen = 0;
3387                 ret
3388         }
3389         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3390                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3391         }
3392 }
3393 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3394         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3395                 let datalen = v.len();
3396                 let data = Box::into_raw(v.into_boxed_slice());
3397                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3398         }
3399 }
3400 #[no_mangle]
3401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3402 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3403 impl Drop for CVec_MessageSendEventZ {
3404         fn drop(&mut self) {
3405                 if self.datalen == 0 { return; }
3406                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3407         }
3408 }
3409 impl Clone for CVec_MessageSendEventZ {
3410         fn clone(&self) -> Self {
3411                 let mut res = Vec::new();
3412                 if self.datalen == 0 { return Self::from(res); }
3413                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3414                 Self::from(res)
3415         }
3416 }
3417 #[repr(C)]
3418 /// The contents of CResult_ScoringParametersDecodeErrorZ
3419 pub union CResult_ScoringParametersDecodeErrorZPtr {
3420         /// A pointer to the contents in the success state.
3421         /// Reading from this pointer when `result_ok` is not set is undefined.
3422         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3423         /// A pointer to the contents in the error state.
3424         /// Reading from this pointer when `result_ok` is set is undefined.
3425         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3426 }
3427 #[repr(C)]
3428 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3429 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3431 pub struct CResult_ScoringParametersDecodeErrorZ {
3432         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3433         /// `err` or `result` depending on the state of `result_ok`.
3434         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3435         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3436         pub result_ok: bool,
3437 }
3438 #[no_mangle]
3439 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3440 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3441         CResult_ScoringParametersDecodeErrorZ {
3442                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3443                         result: Box::into_raw(Box::new(o)),
3444                 },
3445                 result_ok: true,
3446         }
3447 }
3448 #[no_mangle]
3449 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3450 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3451         CResult_ScoringParametersDecodeErrorZ {
3452                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3453                         err: Box::into_raw(Box::new(e)),
3454                 },
3455                 result_ok: false,
3456         }
3457 }
3458 /// Checks if the given object is currently in the success state
3459 #[no_mangle]
3460 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3461         o.result_ok
3462 }
3463 #[no_mangle]
3464 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3465 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3466 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3467         fn drop(&mut self) {
3468                 if self.result_ok {
3469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3471                         }
3472                 } else {
3473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3475                         }
3476                 }
3477         }
3478 }
3479 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3481                 let contents = if o.result_ok {
3482                         let result = unsafe { o.contents.result };
3483                         unsafe { o.contents.result = std::ptr::null_mut() };
3484                         CResult_ScoringParametersDecodeErrorZPtr { result }
3485                 } else {
3486                         let err = unsafe { o.contents.err };
3487                         unsafe { o.contents.err = std::ptr::null_mut(); }
3488                         CResult_ScoringParametersDecodeErrorZPtr { err }
3489                 };
3490                 Self {
3491                         contents,
3492                         result_ok: o.result_ok,
3493                 }
3494         }
3495 }
3496 #[repr(C)]
3497 /// The contents of CResult_ScorerDecodeErrorZ
3498 pub union CResult_ScorerDecodeErrorZPtr {
3499         /// A pointer to the contents in the success state.
3500         /// Reading from this pointer when `result_ok` is not set is undefined.
3501         pub result: *mut crate::lightning::routing::scoring::Scorer,
3502         /// A pointer to the contents in the error state.
3503         /// Reading from this pointer when `result_ok` is set is undefined.
3504         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3505 }
3506 #[repr(C)]
3507 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3508 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3510 pub struct CResult_ScorerDecodeErrorZ {
3511         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3512         /// `err` or `result` depending on the state of `result_ok`.
3513         pub contents: CResult_ScorerDecodeErrorZPtr,
3514         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3515         pub result_ok: bool,
3516 }
3517 #[no_mangle]
3518 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3519 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3520         CResult_ScorerDecodeErrorZ {
3521                 contents: CResult_ScorerDecodeErrorZPtr {
3522                         result: Box::into_raw(Box::new(o)),
3523                 },
3524                 result_ok: true,
3525         }
3526 }
3527 #[no_mangle]
3528 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3529 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3530         CResult_ScorerDecodeErrorZ {
3531                 contents: CResult_ScorerDecodeErrorZPtr {
3532                         err: Box::into_raw(Box::new(e)),
3533                 },
3534                 result_ok: false,
3535         }
3536 }
3537 /// Checks if the given object is currently in the success state
3538 #[no_mangle]
3539 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3540         o.result_ok
3541 }
3542 #[no_mangle]
3543 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3544 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3545 impl Drop for CResult_ScorerDecodeErrorZ {
3546         fn drop(&mut self) {
3547                 if self.result_ok {
3548                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3549                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3550                         }
3551                 } else {
3552                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3553                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3554                         }
3555                 }
3556         }
3557 }
3558 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3559         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3560                 let contents = if o.result_ok {
3561                         let result = unsafe { o.contents.result };
3562                         unsafe { o.contents.result = std::ptr::null_mut() };
3563                         CResult_ScorerDecodeErrorZPtr { result }
3564                 } else {
3565                         let err = unsafe { o.contents.err };
3566                         unsafe { o.contents.err = std::ptr::null_mut(); }
3567                         CResult_ScorerDecodeErrorZPtr { err }
3568                 };
3569                 Self {
3570                         contents,
3571                         result_ok: o.result_ok,
3572                 }
3573         }
3574 }
3575 #[repr(C)]
3576 /// The contents of CResult_InitFeaturesDecodeErrorZ
3577 pub union CResult_InitFeaturesDecodeErrorZPtr {
3578         /// A pointer to the contents in the success state.
3579         /// Reading from this pointer when `result_ok` is not set is undefined.
3580         pub result: *mut crate::lightning::ln::features::InitFeatures,
3581         /// A pointer to the contents in the error state.
3582         /// Reading from this pointer when `result_ok` is set is undefined.
3583         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3584 }
3585 #[repr(C)]
3586 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3587 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3589 pub struct CResult_InitFeaturesDecodeErrorZ {
3590         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3591         /// `err` or `result` depending on the state of `result_ok`.
3592         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3593         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3594         pub result_ok: bool,
3595 }
3596 #[no_mangle]
3597 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3598 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3599         CResult_InitFeaturesDecodeErrorZ {
3600                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3601                         result: Box::into_raw(Box::new(o)),
3602                 },
3603                 result_ok: true,
3604         }
3605 }
3606 #[no_mangle]
3607 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3608 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3609         CResult_InitFeaturesDecodeErrorZ {
3610                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3611                         err: Box::into_raw(Box::new(e)),
3612                 },
3613                 result_ok: false,
3614         }
3615 }
3616 /// Checks if the given object is currently in the success state
3617 #[no_mangle]
3618 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3619         o.result_ok
3620 }
3621 #[no_mangle]
3622 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3623 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3624 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3625         fn drop(&mut self) {
3626                 if self.result_ok {
3627                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3628                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3629                         }
3630                 } else {
3631                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3632                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3633                         }
3634                 }
3635         }
3636 }
3637 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3638         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3639                 let contents = if o.result_ok {
3640                         let result = unsafe { o.contents.result };
3641                         unsafe { o.contents.result = std::ptr::null_mut() };
3642                         CResult_InitFeaturesDecodeErrorZPtr { result }
3643                 } else {
3644                         let err = unsafe { o.contents.err };
3645                         unsafe { o.contents.err = std::ptr::null_mut(); }
3646                         CResult_InitFeaturesDecodeErrorZPtr { err }
3647                 };
3648                 Self {
3649                         contents,
3650                         result_ok: o.result_ok,
3651                 }
3652         }
3653 }
3654 #[repr(C)]
3655 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3656 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3657         /// A pointer to the contents in the success state.
3658         /// Reading from this pointer when `result_ok` is not set is undefined.
3659         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3660         /// A pointer to the contents in the error state.
3661         /// Reading from this pointer when `result_ok` is set is undefined.
3662         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3663 }
3664 #[repr(C)]
3665 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3666 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3668 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3669         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3670         /// `err` or `result` depending on the state of `result_ok`.
3671         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3672         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3673         pub result_ok: bool,
3674 }
3675 #[no_mangle]
3676 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3677 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3678         CResult_ChannelFeaturesDecodeErrorZ {
3679                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3680                         result: Box::into_raw(Box::new(o)),
3681                 },
3682                 result_ok: true,
3683         }
3684 }
3685 #[no_mangle]
3686 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3687 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3688         CResult_ChannelFeaturesDecodeErrorZ {
3689                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3690                         err: Box::into_raw(Box::new(e)),
3691                 },
3692                 result_ok: false,
3693         }
3694 }
3695 /// Checks if the given object is currently in the success state
3696 #[no_mangle]
3697 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
3698         o.result_ok
3699 }
3700 #[no_mangle]
3701 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3702 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3703 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3704         fn drop(&mut self) {
3705                 if self.result_ok {
3706                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3707                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3708                         }
3709                 } else {
3710                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3711                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3712                         }
3713                 }
3714         }
3715 }
3716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3717         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3718                 let contents = if o.result_ok {
3719                         let result = unsafe { o.contents.result };
3720                         unsafe { o.contents.result = std::ptr::null_mut() };
3721                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
3722                 } else {
3723                         let err = unsafe { o.contents.err };
3724                         unsafe { o.contents.err = std::ptr::null_mut(); }
3725                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
3726                 };
3727                 Self {
3728                         contents,
3729                         result_ok: o.result_ok,
3730                 }
3731         }
3732 }
3733 #[repr(C)]
3734 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3735 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3736         /// A pointer to the contents in the success state.
3737         /// Reading from this pointer when `result_ok` is not set is undefined.
3738         pub result: *mut crate::lightning::ln::features::NodeFeatures,
3739         /// A pointer to the contents in the error state.
3740         /// Reading from this pointer when `result_ok` is set is undefined.
3741         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3742 }
3743 #[repr(C)]
3744 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3745 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3746 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3747 pub struct CResult_NodeFeaturesDecodeErrorZ {
3748         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3749         /// `err` or `result` depending on the state of `result_ok`.
3750         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3751         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3752         pub result_ok: bool,
3753 }
3754 #[no_mangle]
3755 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3756 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3757         CResult_NodeFeaturesDecodeErrorZ {
3758                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3759                         result: Box::into_raw(Box::new(o)),
3760                 },
3761                 result_ok: true,
3762         }
3763 }
3764 #[no_mangle]
3765 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3766 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3767         CResult_NodeFeaturesDecodeErrorZ {
3768                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3769                         err: Box::into_raw(Box::new(e)),
3770                 },
3771                 result_ok: false,
3772         }
3773 }
3774 /// Checks if the given object is currently in the success state
3775 #[no_mangle]
3776 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
3777         o.result_ok
3778 }
3779 #[no_mangle]
3780 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3781 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3782 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3783         fn drop(&mut self) {
3784                 if self.result_ok {
3785                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3786                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3787                         }
3788                 } else {
3789                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3790                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3791                         }
3792                 }
3793         }
3794 }
3795 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3796         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3797                 let contents = if o.result_ok {
3798                         let result = unsafe { o.contents.result };
3799                         unsafe { o.contents.result = std::ptr::null_mut() };
3800                         CResult_NodeFeaturesDecodeErrorZPtr { result }
3801                 } else {
3802                         let err = unsafe { o.contents.err };
3803                         unsafe { o.contents.err = std::ptr::null_mut(); }
3804                         CResult_NodeFeaturesDecodeErrorZPtr { err }
3805                 };
3806                 Self {
3807                         contents,
3808                         result_ok: o.result_ok,
3809                 }
3810         }
3811 }
3812 #[repr(C)]
3813 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3814 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3815         /// A pointer to the contents in the success state.
3816         /// Reading from this pointer when `result_ok` is not set is undefined.
3817         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3818         /// A pointer to the contents in the error state.
3819         /// Reading from this pointer when `result_ok` is set is undefined.
3820         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3821 }
3822 #[repr(C)]
3823 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3824 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3825 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3826 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3827         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3828         /// `err` or `result` depending on the state of `result_ok`.
3829         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3830         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3831         pub result_ok: bool,
3832 }
3833 #[no_mangle]
3834 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3835 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3836         CResult_InvoiceFeaturesDecodeErrorZ {
3837                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3838                         result: Box::into_raw(Box::new(o)),
3839                 },
3840                 result_ok: true,
3841         }
3842 }
3843 #[no_mangle]
3844 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3845 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3846         CResult_InvoiceFeaturesDecodeErrorZ {
3847                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3848                         err: Box::into_raw(Box::new(e)),
3849                 },
3850                 result_ok: false,
3851         }
3852 }
3853 /// Checks if the given object is currently in the success state
3854 #[no_mangle]
3855 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
3856         o.result_ok
3857 }
3858 #[no_mangle]
3859 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3860 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3861 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3862         fn drop(&mut self) {
3863                 if self.result_ok {
3864                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3865                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3866                         }
3867                 } else {
3868                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3869                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3870                         }
3871                 }
3872         }
3873 }
3874 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3875         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3876                 let contents = if o.result_ok {
3877                         let result = unsafe { o.contents.result };
3878                         unsafe { o.contents.result = std::ptr::null_mut() };
3879                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3880                 } else {
3881                         let err = unsafe { o.contents.err };
3882                         unsafe { o.contents.err = std::ptr::null_mut(); }
3883                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3884                 };
3885                 Self {
3886                         contents,
3887                         result_ok: o.result_ok,
3888                 }
3889         }
3890 }
3891 #[repr(C)]
3892 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
3893 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3894         /// A pointer to the contents in the success state.
3895         /// Reading from this pointer when `result_ok` is not set is undefined.
3896         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
3897         /// A pointer to the contents in the error state.
3898         /// Reading from this pointer when `result_ok` is set is undefined.
3899         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3900 }
3901 #[repr(C)]
3902 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
3903 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3904 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3905 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
3906         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
3907         /// `err` or `result` depending on the state of `result_ok`.
3908         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
3909         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
3910         pub result_ok: bool,
3911 }
3912 #[no_mangle]
3913 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
3914 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3915         CResult_ChannelTypeFeaturesDecodeErrorZ {
3916                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3917                         result: Box::into_raw(Box::new(o)),
3918                 },
3919                 result_ok: true,
3920         }
3921 }
3922 #[no_mangle]
3923 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
3924 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3925         CResult_ChannelTypeFeaturesDecodeErrorZ {
3926                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3927                         err: Box::into_raw(Box::new(e)),
3928                 },
3929                 result_ok: false,
3930         }
3931 }
3932 /// Checks if the given object is currently in the success state
3933 #[no_mangle]
3934 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
3935         o.result_ok
3936 }
3937 #[no_mangle]
3938 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
3939 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
3940 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
3941         fn drop(&mut self) {
3942                 if self.result_ok {
3943                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3944                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3945                         }
3946                 } else {
3947                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3948                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3949                         }
3950                 }
3951         }
3952 }
3953 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
3954         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3955                 let contents = if o.result_ok {
3956                         let result = unsafe { o.contents.result };
3957                         unsafe { o.contents.result = std::ptr::null_mut() };
3958                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
3959                 } else {
3960                         let err = unsafe { o.contents.err };
3961                         unsafe { o.contents.err = std::ptr::null_mut(); }
3962                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
3963                 };
3964                 Self {
3965                         contents,
3966                         result_ok: o.result_ok,
3967                 }
3968         }
3969 }
3970 #[repr(C)]
3971 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3972 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3973         /// A pointer to the contents in the success state.
3974         /// Reading from this pointer when `result_ok` is not set is undefined.
3975         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3976         /// A pointer to the contents in the error state.
3977         /// Reading from this pointer when `result_ok` is set is undefined.
3978         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3979 }
3980 #[repr(C)]
3981 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3982 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3984 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3985         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3986         /// `err` or `result` depending on the state of `result_ok`.
3987         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3988         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3989         pub result_ok: bool,
3990 }
3991 #[no_mangle]
3992 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
3993 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3994         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3995                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3996                         result: Box::into_raw(Box::new(o)),
3997                 },
3998                 result_ok: true,
3999         }
4000 }
4001 #[no_mangle]
4002 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4003 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4004         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4005                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4006                         err: Box::into_raw(Box::new(e)),
4007                 },
4008                 result_ok: false,
4009         }
4010 }
4011 /// Checks if the given object is currently in the success state
4012 #[no_mangle]
4013 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4014         o.result_ok
4015 }
4016 #[no_mangle]
4017 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4018 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4019 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4020         fn drop(&mut self) {
4021                 if self.result_ok {
4022                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4023                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4024                         }
4025                 } else {
4026                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4027                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4028                         }
4029                 }
4030         }
4031 }
4032 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4033         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4034                 let contents = if o.result_ok {
4035                         let result = unsafe { o.contents.result };
4036                         unsafe { o.contents.result = std::ptr::null_mut() };
4037                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4038                 } else {
4039                         let err = unsafe { o.contents.err };
4040                         unsafe { o.contents.err = std::ptr::null_mut(); }
4041                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4042                 };
4043                 Self {
4044                         contents,
4045                         result_ok: o.result_ok,
4046                 }
4047         }
4048 }
4049 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4050         fn clone(&self) -> Self {
4051                 if self.result_ok {
4052                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4053                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4054                         } }
4055                 } else {
4056                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4057                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4058                         } }
4059                 }
4060         }
4061 }
4062 #[no_mangle]
4063 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4064 /// but with all dynamically-allocated buffers duplicated in new buffers.
4065 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4066 #[repr(C)]
4067 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4068 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4069         /// A pointer to the contents in the success state.
4070         /// Reading from this pointer when `result_ok` is not set is undefined.
4071         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4072         /// A pointer to the contents in the error state.
4073         /// Reading from this pointer when `result_ok` is set is undefined.
4074         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4075 }
4076 #[repr(C)]
4077 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4078 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4079 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4080 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4081         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4082         /// `err` or `result` depending on the state of `result_ok`.
4083         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4084         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4085         pub result_ok: bool,
4086 }
4087 #[no_mangle]
4088 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4089 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4090         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4091                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4092                         result: Box::into_raw(Box::new(o)),
4093                 },
4094                 result_ok: true,
4095         }
4096 }
4097 #[no_mangle]
4098 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4099 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4100         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4101                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4102                         err: Box::into_raw(Box::new(e)),
4103                 },
4104                 result_ok: false,
4105         }
4106 }
4107 /// Checks if the given object is currently in the success state
4108 #[no_mangle]
4109 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4110         o.result_ok
4111 }
4112 #[no_mangle]
4113 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4114 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4115 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4116         fn drop(&mut self) {
4117                 if self.result_ok {
4118                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4119                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4120                         }
4121                 } else {
4122                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4123                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4124                         }
4125                 }
4126         }
4127 }
4128 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4129         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4130                 let contents = if o.result_ok {
4131                         let result = unsafe { o.contents.result };
4132                         unsafe { o.contents.result = std::ptr::null_mut() };
4133                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4134                 } else {
4135                         let err = unsafe { o.contents.err };
4136                         unsafe { o.contents.err = std::ptr::null_mut(); }
4137                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4138                 };
4139                 Self {
4140                         contents,
4141                         result_ok: o.result_ok,
4142                 }
4143         }
4144 }
4145 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4146         fn clone(&self) -> Self {
4147                 if self.result_ok {
4148                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4149                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4150                         } }
4151                 } else {
4152                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4153                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4154                         } }
4155                 }
4156         }
4157 }
4158 #[no_mangle]
4159 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4160 /// but with all dynamically-allocated buffers duplicated in new buffers.
4161 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4162 #[repr(C)]
4163 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4164 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4165         /// A pointer to the contents in the success state.
4166         /// Reading from this pointer when `result_ok` is not set is undefined.
4167         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4168         /// A pointer to the contents in the error state.
4169         /// Reading from this pointer when `result_ok` is set is undefined.
4170         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4171 }
4172 #[repr(C)]
4173 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4174 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4175 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4176 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4177         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4178         /// `err` or `result` depending on the state of `result_ok`.
4179         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4180         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4181         pub result_ok: bool,
4182 }
4183 #[no_mangle]
4184 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4185 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4186         CResult_SpendableOutputDescriptorDecodeErrorZ {
4187                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4188                         result: Box::into_raw(Box::new(o)),
4189                 },
4190                 result_ok: true,
4191         }
4192 }
4193 #[no_mangle]
4194 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4195 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4196         CResult_SpendableOutputDescriptorDecodeErrorZ {
4197                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4198                         err: Box::into_raw(Box::new(e)),
4199                 },
4200                 result_ok: false,
4201         }
4202 }
4203 /// Checks if the given object is currently in the success state
4204 #[no_mangle]
4205 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4206         o.result_ok
4207 }
4208 #[no_mangle]
4209 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4210 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4211 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4212         fn drop(&mut self) {
4213                 if self.result_ok {
4214                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4215                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4216                         }
4217                 } else {
4218                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4219                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4220                         }
4221                 }
4222         }
4223 }
4224 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4225         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4226                 let contents = if o.result_ok {
4227                         let result = unsafe { o.contents.result };
4228                         unsafe { o.contents.result = std::ptr::null_mut() };
4229                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4230                 } else {
4231                         let err = unsafe { o.contents.err };
4232                         unsafe { o.contents.err = std::ptr::null_mut(); }
4233                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4234                 };
4235                 Self {
4236                         contents,
4237                         result_ok: o.result_ok,
4238                 }
4239         }
4240 }
4241 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4242         fn clone(&self) -> Self {
4243                 if self.result_ok {
4244                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4245                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4246                         } }
4247                 } else {
4248                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4249                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4250                         } }
4251                 }
4252         }
4253 }
4254 #[no_mangle]
4255 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4256 /// but with all dynamically-allocated buffers duplicated in new buffers.
4257 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4258 #[repr(C)]
4259 /// The contents of CResult_NoneNoneZ
4260 pub union CResult_NoneNoneZPtr {
4261         /// Note that this value is always NULL, as there are no contents in the OK variant
4262         pub result: *mut std::ffi::c_void,
4263         /// Note that this value is always NULL, as there are no contents in the Err variant
4264         pub err: *mut std::ffi::c_void,
4265 }
4266 #[repr(C)]
4267 /// A CResult_NoneNoneZ represents the result of a fallible operation,
4268 /// containing a () on success and a () on failure.
4269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4270 pub struct CResult_NoneNoneZ {
4271         /// The contents of this CResult_NoneNoneZ, accessible via either
4272         /// `err` or `result` depending on the state of `result_ok`.
4273         pub contents: CResult_NoneNoneZPtr,
4274         /// Whether this CResult_NoneNoneZ represents a success state.
4275         pub result_ok: bool,
4276 }
4277 #[no_mangle]
4278 /// Creates a new CResult_NoneNoneZ in the success state.
4279 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
4280         CResult_NoneNoneZ {
4281                 contents: CResult_NoneNoneZPtr {
4282                         result: std::ptr::null_mut(),
4283                 },
4284                 result_ok: true,
4285         }
4286 }
4287 #[no_mangle]
4288 /// Creates a new CResult_NoneNoneZ in the error state.
4289 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
4290         CResult_NoneNoneZ {
4291                 contents: CResult_NoneNoneZPtr {
4292                         err: std::ptr::null_mut(),
4293                 },
4294                 result_ok: false,
4295         }
4296 }
4297 /// Checks if the given object is currently in the success state
4298 #[no_mangle]
4299 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
4300         o.result_ok
4301 }
4302 #[no_mangle]
4303 /// Frees any resources used by the CResult_NoneNoneZ.
4304 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
4305 impl Drop for CResult_NoneNoneZ {
4306         fn drop(&mut self) {
4307                 if self.result_ok {
4308                 } else {
4309                 }
4310         }
4311 }
4312 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
4313         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
4314                 let contents = if o.result_ok {
4315                         let _ = unsafe { Box::from_raw(o.contents.result) };
4316                         o.contents.result = std::ptr::null_mut();
4317                         CResult_NoneNoneZPtr { result: std::ptr::null_mut() }
4318                 } else {
4319                         let _ = unsafe { Box::from_raw(o.contents.err) };
4320                         o.contents.err = std::ptr::null_mut();
4321                         CResult_NoneNoneZPtr { err: std::ptr::null_mut() }
4322                 };
4323                 Self {
4324                         contents,
4325                         result_ok: o.result_ok,
4326                 }
4327         }
4328 }
4329 impl Clone for CResult_NoneNoneZ {
4330         fn clone(&self) -> Self {
4331                 if self.result_ok {
4332                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
4333                                 result: std::ptr::null_mut()
4334                         } }
4335                 } else {
4336                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
4337                                 err: std::ptr::null_mut()
4338                         } }
4339                 }
4340         }
4341 }
4342 #[no_mangle]
4343 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
4344 /// but with all dynamically-allocated buffers duplicated in new buffers.
4345 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
4346 #[repr(C)]
4347 /// A tuple of 2 elements. See the individual fields for the types contained.
4348 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4349         /// The element at position 0
4350         pub a: crate::c_types::Signature,
4351         /// The element at position 1
4352         pub b: crate::c_types::derived::CVec_SignatureZ,
4353 }
4354 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4355         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4356                 Self {
4357                         a: tup.0,
4358                         b: tup.1,
4359                 }
4360         }
4361 }
4362 impl C2Tuple_SignatureCVec_SignatureZZ {
4363         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4364                 (self.a, self.b)
4365         }
4366 }
4367 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4368         fn clone(&self) -> Self {
4369                 Self {
4370                         a: Clone::clone(&self.a),
4371                         b: Clone::clone(&self.b),
4372                 }
4373         }
4374 }
4375 #[no_mangle]
4376 /// Creates a new tuple which has the same data as `orig`
4377 /// but with all dynamically-allocated buffers duplicated in new buffers.
4378 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4379 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4380 #[no_mangle]
4381 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4382         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4383 }
4384
4385 #[no_mangle]
4386 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4387 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4388 #[repr(C)]
4389 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4390 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4391         /// A pointer to the contents in the success state.
4392         /// Reading from this pointer when `result_ok` is not set is undefined.
4393         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4394         /// Note that this value is always NULL, as there are no contents in the Err variant
4395         pub err: *mut std::ffi::c_void,
4396 }
4397 #[repr(C)]
4398 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4399 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4401 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4402         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4403         /// `err` or `result` depending on the state of `result_ok`.
4404         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4405         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4406         pub result_ok: bool,
4407 }
4408 #[no_mangle]
4409 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4410 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4411         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4412                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4413                         result: Box::into_raw(Box::new(o)),
4414                 },
4415                 result_ok: true,
4416         }
4417 }
4418 #[no_mangle]
4419 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4420 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4421         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4422                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4423                         err: std::ptr::null_mut(),
4424                 },
4425                 result_ok: false,
4426         }
4427 }
4428 /// Checks if the given object is currently in the success state
4429 #[no_mangle]
4430 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4431         o.result_ok
4432 }
4433 #[no_mangle]
4434 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4435 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4436 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4437         fn drop(&mut self) {
4438                 if self.result_ok {
4439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4441                         }
4442                 } else {
4443                 }
4444         }
4445 }
4446 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4447         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4448                 let contents = if o.result_ok {
4449                         let result = unsafe { o.contents.result };
4450                         unsafe { o.contents.result = std::ptr::null_mut() };
4451                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4452                 } else {
4453                         let _ = unsafe { Box::from_raw(o.contents.err) };
4454                         o.contents.err = std::ptr::null_mut();
4455                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
4456                 };
4457                 Self {
4458                         contents,
4459                         result_ok: o.result_ok,
4460                 }
4461         }
4462 }
4463 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4464         fn clone(&self) -> Self {
4465                 if self.result_ok {
4466                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4467                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4468                         } }
4469                 } else {
4470                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4471                                 err: std::ptr::null_mut()
4472                         } }
4473                 }
4474         }
4475 }
4476 #[no_mangle]
4477 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4478 /// but with all dynamically-allocated buffers duplicated in new buffers.
4479 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4480 #[repr(C)]
4481 /// The contents of CResult_SignatureNoneZ
4482 pub union CResult_SignatureNoneZPtr {
4483         /// A pointer to the contents in the success state.
4484         /// Reading from this pointer when `result_ok` is not set is undefined.
4485         pub result: *mut crate::c_types::Signature,
4486         /// Note that this value is always NULL, as there are no contents in the Err variant
4487         pub err: *mut std::ffi::c_void,
4488 }
4489 #[repr(C)]
4490 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4491 /// containing a crate::c_types::Signature on success and a () on failure.
4492 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4493 pub struct CResult_SignatureNoneZ {
4494         /// The contents of this CResult_SignatureNoneZ, accessible via either
4495         /// `err` or `result` depending on the state of `result_ok`.
4496         pub contents: CResult_SignatureNoneZPtr,
4497         /// Whether this CResult_SignatureNoneZ represents a success state.
4498         pub result_ok: bool,
4499 }
4500 #[no_mangle]
4501 /// Creates a new CResult_SignatureNoneZ in the success state.
4502 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4503         CResult_SignatureNoneZ {
4504                 contents: CResult_SignatureNoneZPtr {
4505                         result: Box::into_raw(Box::new(o)),
4506                 },
4507                 result_ok: true,
4508         }
4509 }
4510 #[no_mangle]
4511 /// Creates a new CResult_SignatureNoneZ in the error state.
4512 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4513         CResult_SignatureNoneZ {
4514                 contents: CResult_SignatureNoneZPtr {
4515                         err: std::ptr::null_mut(),
4516                 },
4517                 result_ok: false,
4518         }
4519 }
4520 /// Checks if the given object is currently in the success state
4521 #[no_mangle]
4522 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4523         o.result_ok
4524 }
4525 #[no_mangle]
4526 /// Frees any resources used by the CResult_SignatureNoneZ.
4527 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4528 impl Drop for CResult_SignatureNoneZ {
4529         fn drop(&mut self) {
4530                 if self.result_ok {
4531                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4532                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4533                         }
4534                 } else {
4535                 }
4536         }
4537 }
4538 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4539         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4540                 let contents = if o.result_ok {
4541                         let result = unsafe { o.contents.result };
4542                         unsafe { o.contents.result = std::ptr::null_mut() };
4543                         CResult_SignatureNoneZPtr { result }
4544                 } else {
4545                         let _ = unsafe { Box::from_raw(o.contents.err) };
4546                         o.contents.err = std::ptr::null_mut();
4547                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
4548                 };
4549                 Self {
4550                         contents,
4551                         result_ok: o.result_ok,
4552                 }
4553         }
4554 }
4555 impl Clone for CResult_SignatureNoneZ {
4556         fn clone(&self) -> Self {
4557                 if self.result_ok {
4558                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4559                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4560                         } }
4561                 } else {
4562                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4563                                 err: std::ptr::null_mut()
4564                         } }
4565                 }
4566         }
4567 }
4568 #[no_mangle]
4569 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4570 /// but with all dynamically-allocated buffers duplicated in new buffers.
4571 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4572 #[repr(C)]
4573 /// The contents of CResult_SignDecodeErrorZ
4574 pub union CResult_SignDecodeErrorZPtr {
4575         /// A pointer to the contents in the success state.
4576         /// Reading from this pointer when `result_ok` is not set is undefined.
4577         pub result: *mut crate::lightning::chain::keysinterface::Sign,
4578         /// A pointer to the contents in the error state.
4579         /// Reading from this pointer when `result_ok` is set is undefined.
4580         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4581 }
4582 #[repr(C)]
4583 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4584 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4586 pub struct CResult_SignDecodeErrorZ {
4587         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4588         /// `err` or `result` depending on the state of `result_ok`.
4589         pub contents: CResult_SignDecodeErrorZPtr,
4590         /// Whether this CResult_SignDecodeErrorZ represents a success state.
4591         pub result_ok: bool,
4592 }
4593 #[no_mangle]
4594 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4595 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4596         CResult_SignDecodeErrorZ {
4597                 contents: CResult_SignDecodeErrorZPtr {
4598                         result: Box::into_raw(Box::new(o)),
4599                 },
4600                 result_ok: true,
4601         }
4602 }
4603 #[no_mangle]
4604 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4605 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4606         CResult_SignDecodeErrorZ {
4607                 contents: CResult_SignDecodeErrorZPtr {
4608                         err: Box::into_raw(Box::new(e)),
4609                 },
4610                 result_ok: false,
4611         }
4612 }
4613 /// Checks if the given object is currently in the success state
4614 #[no_mangle]
4615 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
4616         o.result_ok
4617 }
4618 #[no_mangle]
4619 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4620 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4621 impl Drop for CResult_SignDecodeErrorZ {
4622         fn drop(&mut self) {
4623                 if self.result_ok {
4624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4626                         }
4627                 } else {
4628                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4629                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4630                         }
4631                 }
4632         }
4633 }
4634 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4635         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4636                 let contents = if o.result_ok {
4637                         let result = unsafe { o.contents.result };
4638                         unsafe { o.contents.result = std::ptr::null_mut() };
4639                         CResult_SignDecodeErrorZPtr { result }
4640                 } else {
4641                         let err = unsafe { o.contents.err };
4642                         unsafe { o.contents.err = std::ptr::null_mut(); }
4643                         CResult_SignDecodeErrorZPtr { err }
4644                 };
4645                 Self {
4646                         contents,
4647                         result_ok: o.result_ok,
4648                 }
4649         }
4650 }
4651 impl Clone for CResult_SignDecodeErrorZ {
4652         fn clone(&self) -> Self {
4653                 if self.result_ok {
4654                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4655                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4656                         } }
4657                 } else {
4658                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4659                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4660                         } }
4661                 }
4662         }
4663 }
4664 #[no_mangle]
4665 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4666 /// but with all dynamically-allocated buffers duplicated in new buffers.
4667 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4668 #[repr(C)]
4669 /// A dynamically-allocated array of u8s of arbitrary size.
4670 /// This corresponds to std::vector in C++
4671 pub struct CVec_u8Z {
4672         /// The elements in the array.
4673         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4674         pub data: *mut u8,
4675         /// The number of elements pointed to by `data`.
4676         pub datalen: usize
4677 }
4678 impl CVec_u8Z {
4679         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4680                 if self.datalen == 0 { return Vec::new(); }
4681                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4682                 self.data = std::ptr::null_mut();
4683                 self.datalen = 0;
4684                 ret
4685         }
4686         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4687                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4688         }
4689 }
4690 impl From<Vec<u8>> for CVec_u8Z {
4691         fn from(v: Vec<u8>) -> Self {
4692                 let datalen = v.len();
4693                 let data = Box::into_raw(v.into_boxed_slice());
4694                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4695         }
4696 }
4697 #[no_mangle]
4698 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4699 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4700 impl Drop for CVec_u8Z {
4701         fn drop(&mut self) {
4702                 if self.datalen == 0 { return; }
4703                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4704         }
4705 }
4706 impl Clone for CVec_u8Z {
4707         fn clone(&self) -> Self {
4708                 let mut res = Vec::new();
4709                 if self.datalen == 0 { return Self::from(res); }
4710                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4711                 Self::from(res)
4712         }
4713 }
4714 #[repr(C)]
4715 /// The contents of CResult_RecoverableSignatureNoneZ
4716 pub union CResult_RecoverableSignatureNoneZPtr {
4717         /// A pointer to the contents in the success state.
4718         /// Reading from this pointer when `result_ok` is not set is undefined.
4719         pub result: *mut crate::c_types::RecoverableSignature,
4720         /// Note that this value is always NULL, as there are no contents in the Err variant
4721         pub err: *mut std::ffi::c_void,
4722 }
4723 #[repr(C)]
4724 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4725 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4727 pub struct CResult_RecoverableSignatureNoneZ {
4728         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4729         /// `err` or `result` depending on the state of `result_ok`.
4730         pub contents: CResult_RecoverableSignatureNoneZPtr,
4731         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4732         pub result_ok: bool,
4733 }
4734 #[no_mangle]
4735 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4736 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4737         CResult_RecoverableSignatureNoneZ {
4738                 contents: CResult_RecoverableSignatureNoneZPtr {
4739                         result: Box::into_raw(Box::new(o)),
4740                 },
4741                 result_ok: true,
4742         }
4743 }
4744 #[no_mangle]
4745 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4746 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4747         CResult_RecoverableSignatureNoneZ {
4748                 contents: CResult_RecoverableSignatureNoneZPtr {
4749                         err: std::ptr::null_mut(),
4750                 },
4751                 result_ok: false,
4752         }
4753 }
4754 /// Checks if the given object is currently in the success state
4755 #[no_mangle]
4756 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
4757         o.result_ok
4758 }
4759 #[no_mangle]
4760 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4761 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4762 impl Drop for CResult_RecoverableSignatureNoneZ {
4763         fn drop(&mut self) {
4764                 if self.result_ok {
4765                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4766                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4767                         }
4768                 } else {
4769                 }
4770         }
4771 }
4772 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4773         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4774                 let contents = if o.result_ok {
4775                         let result = unsafe { o.contents.result };
4776                         unsafe { o.contents.result = std::ptr::null_mut() };
4777                         CResult_RecoverableSignatureNoneZPtr { result }
4778                 } else {
4779                         let _ = unsafe { Box::from_raw(o.contents.err) };
4780                         o.contents.err = std::ptr::null_mut();
4781                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
4782                 };
4783                 Self {
4784                         contents,
4785                         result_ok: o.result_ok,
4786                 }
4787         }
4788 }
4789 impl Clone for CResult_RecoverableSignatureNoneZ {
4790         fn clone(&self) -> Self {
4791                 if self.result_ok {
4792                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4793                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4794                         } }
4795                 } else {
4796                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4797                                 err: std::ptr::null_mut()
4798                         } }
4799                 }
4800         }
4801 }
4802 #[no_mangle]
4803 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4804 /// but with all dynamically-allocated buffers duplicated in new buffers.
4805 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4806 #[repr(C)]
4807 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4808 /// This corresponds to std::vector in C++
4809 pub struct CVec_CVec_u8ZZ {
4810         /// The elements in the array.
4811         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4812         pub data: *mut crate::c_types::derived::CVec_u8Z,
4813         /// The number of elements pointed to by `data`.
4814         pub datalen: usize
4815 }
4816 impl CVec_CVec_u8ZZ {
4817         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4818                 if self.datalen == 0 { return Vec::new(); }
4819                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4820                 self.data = std::ptr::null_mut();
4821                 self.datalen = 0;
4822                 ret
4823         }
4824         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4825                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4826         }
4827 }
4828 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4829         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4830                 let datalen = v.len();
4831                 let data = Box::into_raw(v.into_boxed_slice());
4832                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4833         }
4834 }
4835 #[no_mangle]
4836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4837 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4838 impl Drop for CVec_CVec_u8ZZ {
4839         fn drop(&mut self) {
4840                 if self.datalen == 0 { return; }
4841                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4842         }
4843 }
4844 impl Clone for CVec_CVec_u8ZZ {
4845         fn clone(&self) -> Self {
4846                 let mut res = Vec::new();
4847                 if self.datalen == 0 { return Self::from(res); }
4848                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4849                 Self::from(res)
4850         }
4851 }
4852 #[repr(C)]
4853 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4854 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4855         /// A pointer to the contents in the success state.
4856         /// Reading from this pointer when `result_ok` is not set is undefined.
4857         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4858         /// Note that this value is always NULL, as there are no contents in the Err variant
4859         pub err: *mut std::ffi::c_void,
4860 }
4861 #[repr(C)]
4862 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4863 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4865 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4866         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4867         /// `err` or `result` depending on the state of `result_ok`.
4868         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4869         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4870         pub result_ok: bool,
4871 }
4872 #[no_mangle]
4873 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4874 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4875         CResult_CVec_CVec_u8ZZNoneZ {
4876                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4877                         result: Box::into_raw(Box::new(o)),
4878                 },
4879                 result_ok: true,
4880         }
4881 }
4882 #[no_mangle]
4883 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4884 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4885         CResult_CVec_CVec_u8ZZNoneZ {
4886                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4887                         err: std::ptr::null_mut(),
4888                 },
4889                 result_ok: false,
4890         }
4891 }
4892 /// Checks if the given object is currently in the success state
4893 #[no_mangle]
4894 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
4895         o.result_ok
4896 }
4897 #[no_mangle]
4898 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4899 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4900 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4901         fn drop(&mut self) {
4902                 if self.result_ok {
4903                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4904                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4905                         }
4906                 } else {
4907                 }
4908         }
4909 }
4910 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4911         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4912                 let contents = if o.result_ok {
4913                         let result = unsafe { o.contents.result };
4914                         unsafe { o.contents.result = std::ptr::null_mut() };
4915                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
4916                 } else {
4917                         let _ = unsafe { Box::from_raw(o.contents.err) };
4918                         o.contents.err = std::ptr::null_mut();
4919                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4920                 };
4921                 Self {
4922                         contents,
4923                         result_ok: o.result_ok,
4924                 }
4925         }
4926 }
4927 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4928         fn clone(&self) -> Self {
4929                 if self.result_ok {
4930                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4931                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4932                         } }
4933                 } else {
4934                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4935                                 err: std::ptr::null_mut()
4936                         } }
4937                 }
4938         }
4939 }
4940 #[no_mangle]
4941 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4942 /// but with all dynamically-allocated buffers duplicated in new buffers.
4943 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4944 #[repr(C)]
4945 /// The contents of CResult_InMemorySignerDecodeErrorZ
4946 pub union CResult_InMemorySignerDecodeErrorZPtr {
4947         /// A pointer to the contents in the success state.
4948         /// Reading from this pointer when `result_ok` is not set is undefined.
4949         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4950         /// A pointer to the contents in the error state.
4951         /// Reading from this pointer when `result_ok` is set is undefined.
4952         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4953 }
4954 #[repr(C)]
4955 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4956 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4958 pub struct CResult_InMemorySignerDecodeErrorZ {
4959         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4960         /// `err` or `result` depending on the state of `result_ok`.
4961         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4962         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4963         pub result_ok: bool,
4964 }
4965 #[no_mangle]
4966 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4967 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4968         CResult_InMemorySignerDecodeErrorZ {
4969                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4970                         result: Box::into_raw(Box::new(o)),
4971                 },
4972                 result_ok: true,
4973         }
4974 }
4975 #[no_mangle]
4976 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4977 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4978         CResult_InMemorySignerDecodeErrorZ {
4979                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4980                         err: Box::into_raw(Box::new(e)),
4981                 },
4982                 result_ok: false,
4983         }
4984 }
4985 /// Checks if the given object is currently in the success state
4986 #[no_mangle]
4987 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
4988         o.result_ok
4989 }
4990 #[no_mangle]
4991 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
4992 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4993 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4994         fn drop(&mut self) {
4995                 if self.result_ok {
4996                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4997                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4998                         }
4999                 } else {
5000                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5001                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5002                         }
5003                 }
5004         }
5005 }
5006 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5007         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5008                 let contents = if o.result_ok {
5009                         let result = unsafe { o.contents.result };
5010                         unsafe { o.contents.result = std::ptr::null_mut() };
5011                         CResult_InMemorySignerDecodeErrorZPtr { result }
5012                 } else {
5013                         let err = unsafe { o.contents.err };
5014                         unsafe { o.contents.err = std::ptr::null_mut(); }
5015                         CResult_InMemorySignerDecodeErrorZPtr { err }
5016                 };
5017                 Self {
5018                         contents,
5019                         result_ok: o.result_ok,
5020                 }
5021         }
5022 }
5023 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5024         fn clone(&self) -> Self {
5025                 if self.result_ok {
5026                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5027                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5028                         } }
5029                 } else {
5030                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5031                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5032                         } }
5033                 }
5034         }
5035 }
5036 #[no_mangle]
5037 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5038 /// but with all dynamically-allocated buffers duplicated in new buffers.
5039 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5040 #[repr(C)]
5041 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5042 /// This corresponds to std::vector in C++
5043 pub struct CVec_TxOutZ {
5044         /// The elements in the array.
5045         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5046         pub data: *mut crate::c_types::TxOut,
5047         /// The number of elements pointed to by `data`.
5048         pub datalen: usize
5049 }
5050 impl CVec_TxOutZ {
5051         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5052                 if self.datalen == 0 { return Vec::new(); }
5053                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5054                 self.data = std::ptr::null_mut();
5055                 self.datalen = 0;
5056                 ret
5057         }
5058         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5059                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5060         }
5061 }
5062 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5063         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5064                 let datalen = v.len();
5065                 let data = Box::into_raw(v.into_boxed_slice());
5066                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5067         }
5068 }
5069 #[no_mangle]
5070 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5071 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5072 impl Drop for CVec_TxOutZ {
5073         fn drop(&mut self) {
5074                 if self.datalen == 0 { return; }
5075                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5076         }
5077 }
5078 impl Clone for CVec_TxOutZ {
5079         fn clone(&self) -> Self {
5080                 let mut res = Vec::new();
5081                 if self.datalen == 0 { return Self::from(res); }
5082                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5083                 Self::from(res)
5084         }
5085 }
5086 #[repr(C)]
5087 /// The contents of CResult_TransactionNoneZ
5088 pub union CResult_TransactionNoneZPtr {
5089         /// A pointer to the contents in the success state.
5090         /// Reading from this pointer when `result_ok` is not set is undefined.
5091         pub result: *mut crate::c_types::Transaction,
5092         /// Note that this value is always NULL, as there are no contents in the Err variant
5093         pub err: *mut std::ffi::c_void,
5094 }
5095 #[repr(C)]
5096 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5097 /// containing a crate::c_types::Transaction on success and a () on failure.
5098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5099 pub struct CResult_TransactionNoneZ {
5100         /// The contents of this CResult_TransactionNoneZ, accessible via either
5101         /// `err` or `result` depending on the state of `result_ok`.
5102         pub contents: CResult_TransactionNoneZPtr,
5103         /// Whether this CResult_TransactionNoneZ represents a success state.
5104         pub result_ok: bool,
5105 }
5106 #[no_mangle]
5107 /// Creates a new CResult_TransactionNoneZ in the success state.
5108 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5109         CResult_TransactionNoneZ {
5110                 contents: CResult_TransactionNoneZPtr {
5111                         result: Box::into_raw(Box::new(o)),
5112                 },
5113                 result_ok: true,
5114         }
5115 }
5116 #[no_mangle]
5117 /// Creates a new CResult_TransactionNoneZ in the error state.
5118 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5119         CResult_TransactionNoneZ {
5120                 contents: CResult_TransactionNoneZPtr {
5121                         err: std::ptr::null_mut(),
5122                 },
5123                 result_ok: false,
5124         }
5125 }
5126 /// Checks if the given object is currently in the success state
5127 #[no_mangle]
5128 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5129         o.result_ok
5130 }
5131 #[no_mangle]
5132 /// Frees any resources used by the CResult_TransactionNoneZ.
5133 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5134 impl Drop for CResult_TransactionNoneZ {
5135         fn drop(&mut self) {
5136                 if self.result_ok {
5137                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5138                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5139                         }
5140                 } else {
5141                 }
5142         }
5143 }
5144 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5145         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5146                 let contents = if o.result_ok {
5147                         let result = unsafe { o.contents.result };
5148                         unsafe { o.contents.result = std::ptr::null_mut() };
5149                         CResult_TransactionNoneZPtr { result }
5150                 } else {
5151                         let _ = unsafe { Box::from_raw(o.contents.err) };
5152                         o.contents.err = std::ptr::null_mut();
5153                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
5154                 };
5155                 Self {
5156                         contents,
5157                         result_ok: o.result_ok,
5158                 }
5159         }
5160 }
5161 impl Clone for CResult_TransactionNoneZ {
5162         fn clone(&self) -> Self {
5163                 if self.result_ok {
5164                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5165                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5166                         } }
5167                 } else {
5168                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5169                                 err: std::ptr::null_mut()
5170                         } }
5171                 }
5172         }
5173 }
5174 #[no_mangle]
5175 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5176 /// but with all dynamically-allocated buffers duplicated in new buffers.
5177 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5178 #[repr(C)]
5179 /// A tuple of 2 elements. See the individual fields for the types contained.
5180 pub struct C2Tuple_BlockHashChannelMonitorZ {
5181         /// The element at position 0
5182         pub a: crate::c_types::ThirtyTwoBytes,
5183         /// The element at position 1
5184         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5185 }
5186 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5187         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5188                 Self {
5189                         a: tup.0,
5190                         b: tup.1,
5191                 }
5192         }
5193 }
5194 impl C2Tuple_BlockHashChannelMonitorZ {
5195         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5196                 (self.a, self.b)
5197         }
5198 }
5199 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5200 #[no_mangle]
5201 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5202         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5203 }
5204
5205 #[no_mangle]
5206 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5207 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5208 #[repr(C)]
5209 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5210 /// This corresponds to std::vector in C++
5211 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5212         /// The elements in the array.
5213         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5214         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5215         /// The number of elements pointed to by `data`.
5216         pub datalen: usize
5217 }
5218 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5219         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5220                 if self.datalen == 0 { return Vec::new(); }
5221                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5222                 self.data = std::ptr::null_mut();
5223                 self.datalen = 0;
5224                 ret
5225         }
5226         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5227                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5228         }
5229 }
5230 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5231         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5232                 let datalen = v.len();
5233                 let data = Box::into_raw(v.into_boxed_slice());
5234                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5235         }
5236 }
5237 #[no_mangle]
5238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5239 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5240 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5241         fn drop(&mut self) {
5242                 if self.datalen == 0 { return; }
5243                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5244         }
5245 }
5246 #[repr(C)]
5247 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5248 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5249         /// A pointer to the contents in the success state.
5250         /// Reading from this pointer when `result_ok` is not set is undefined.
5251         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5252         /// A pointer to the contents in the error state.
5253         /// Reading from this pointer when `result_ok` is set is undefined.
5254         pub err: *mut crate::c_types::IOError,
5255 }
5256 #[repr(C)]
5257 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5258 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5259 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5260 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5261         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5262         /// `err` or `result` depending on the state of `result_ok`.
5263         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5264         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5265         pub result_ok: bool,
5266 }
5267 #[no_mangle]
5268 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5269 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5270         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5271                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5272                         result: Box::into_raw(Box::new(o)),
5273                 },
5274                 result_ok: true,
5275         }
5276 }
5277 #[no_mangle]
5278 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5279 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5280         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5281                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5282                         err: Box::into_raw(Box::new(e)),
5283                 },
5284                 result_ok: false,
5285         }
5286 }
5287 /// Checks if the given object is currently in the success state
5288 #[no_mangle]
5289 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5290         o.result_ok
5291 }
5292 #[no_mangle]
5293 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5294 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5295 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5296         fn drop(&mut self) {
5297                 if self.result_ok {
5298                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5299                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5300                         }
5301                 } else {
5302                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5303                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5304                         }
5305                 }
5306         }
5307 }
5308 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5309         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5310                 let contents = if o.result_ok {
5311                         let result = unsafe { o.contents.result };
5312                         unsafe { o.contents.result = std::ptr::null_mut() };
5313                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5314                 } else {
5315                         let err = unsafe { o.contents.err };
5316                         unsafe { o.contents.err = std::ptr::null_mut(); }
5317                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5318                 };
5319                 Self {
5320                         contents,
5321                         result_ok: o.result_ok,
5322                 }
5323         }
5324 }
5325 #[repr(C)]
5326 #[derive(Clone)]
5327 /// An enum which can either contain a u16 or not
5328 pub enum COption_u16Z {
5329         /// When we're in this state, this COption_u16Z contains a u16
5330         Some(u16),
5331         /// When we're in this state, this COption_u16Z contains nothing
5332         None
5333 }
5334 impl COption_u16Z {
5335         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5336                 if let Self::None = self { false } else { true }
5337         }
5338         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5339                 !self.is_some()
5340         }
5341         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5342                 if let Self::Some(v) = self { v } else { unreachable!() }
5343         }
5344 }
5345 #[no_mangle]
5346 /// Constructs a new COption_u16Z containing a u16
5347 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5348         COption_u16Z::Some(o)
5349 }
5350 #[no_mangle]
5351 /// Constructs a new COption_u16Z containing nothing
5352 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5353         COption_u16Z::None
5354 }
5355 #[no_mangle]
5356 /// Frees any resources associated with the u16, if we are in the Some state
5357 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5358 #[no_mangle]
5359 /// Creates a new COption_u16Z which has the same data as `orig`
5360 /// but with all dynamically-allocated buffers duplicated in new buffers.
5361 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5362 #[repr(C)]
5363 /// The contents of CResult_NoneAPIErrorZ
5364 pub union CResult_NoneAPIErrorZPtr {
5365         /// Note that this value is always NULL, as there are no contents in the OK variant
5366         pub result: *mut std::ffi::c_void,
5367         /// A pointer to the contents in the error state.
5368         /// Reading from this pointer when `result_ok` is set is undefined.
5369         pub err: *mut crate::lightning::util::errors::APIError,
5370 }
5371 #[repr(C)]
5372 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5373 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5375 pub struct CResult_NoneAPIErrorZ {
5376         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5377         /// `err` or `result` depending on the state of `result_ok`.
5378         pub contents: CResult_NoneAPIErrorZPtr,
5379         /// Whether this CResult_NoneAPIErrorZ represents a success state.
5380         pub result_ok: bool,
5381 }
5382 #[no_mangle]
5383 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5384 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5385         CResult_NoneAPIErrorZ {
5386                 contents: CResult_NoneAPIErrorZPtr {
5387                         result: std::ptr::null_mut(),
5388                 },
5389                 result_ok: true,
5390         }
5391 }
5392 #[no_mangle]
5393 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5394 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5395         CResult_NoneAPIErrorZ {
5396                 contents: CResult_NoneAPIErrorZPtr {
5397                         err: Box::into_raw(Box::new(e)),
5398                 },
5399                 result_ok: false,
5400         }
5401 }
5402 /// Checks if the given object is currently in the success state
5403 #[no_mangle]
5404 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5405         o.result_ok
5406 }
5407 #[no_mangle]
5408 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5409 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5410 impl Drop for CResult_NoneAPIErrorZ {
5411         fn drop(&mut self) {
5412                 if self.result_ok {
5413                 } else {
5414                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5415                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5416                         }
5417                 }
5418         }
5419 }
5420 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
5421         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
5422                 let contents = if o.result_ok {
5423                         let _ = unsafe { Box::from_raw(o.contents.result) };
5424                         o.contents.result = std::ptr::null_mut();
5425                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
5426                 } else {
5427                         let err = unsafe { o.contents.err };
5428                         unsafe { o.contents.err = std::ptr::null_mut(); }
5429                         CResult_NoneAPIErrorZPtr { err }
5430                 };
5431                 Self {
5432                         contents,
5433                         result_ok: o.result_ok,
5434                 }
5435         }
5436 }
5437 impl Clone for CResult_NoneAPIErrorZ {
5438         fn clone(&self) -> Self {
5439                 if self.result_ok {
5440                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
5441                                 result: std::ptr::null_mut()
5442                         } }
5443                 } else {
5444                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
5445                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5446                         } }
5447                 }
5448         }
5449 }
5450 #[no_mangle]
5451 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
5452 /// but with all dynamically-allocated buffers duplicated in new buffers.
5453 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
5454 #[repr(C)]
5455 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5456 /// This corresponds to std::vector in C++
5457 pub struct CVec_CResult_NoneAPIErrorZZ {
5458         /// The elements in the array.
5459         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5460         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
5461         /// The number of elements pointed to by `data`.
5462         pub datalen: usize
5463 }
5464 impl CVec_CResult_NoneAPIErrorZZ {
5465         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
5466                 if self.datalen == 0 { return Vec::new(); }
5467                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5468                 self.data = std::ptr::null_mut();
5469                 self.datalen = 0;
5470                 ret
5471         }
5472         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
5473                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5474         }
5475 }
5476 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
5477         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
5478                 let datalen = v.len();
5479                 let data = Box::into_raw(v.into_boxed_slice());
5480                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5481         }
5482 }
5483 #[no_mangle]
5484 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5485 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
5486 impl Drop for CVec_CResult_NoneAPIErrorZZ {
5487         fn drop(&mut self) {
5488                 if self.datalen == 0 { return; }
5489                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5490         }
5491 }
5492 impl Clone for CVec_CResult_NoneAPIErrorZZ {
5493         fn clone(&self) -> Self {
5494                 let mut res = Vec::new();
5495                 if self.datalen == 0 { return Self::from(res); }
5496                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5497                 Self::from(res)
5498         }
5499 }
5500 #[repr(C)]
5501 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5502 /// This corresponds to std::vector in C++
5503 pub struct CVec_APIErrorZ {
5504         /// The elements in the array.
5505         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5506         pub data: *mut crate::lightning::util::errors::APIError,
5507         /// The number of elements pointed to by `data`.
5508         pub datalen: usize
5509 }
5510 impl CVec_APIErrorZ {
5511         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
5512                 if self.datalen == 0 { return Vec::new(); }
5513                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5514                 self.data = std::ptr::null_mut();
5515                 self.datalen = 0;
5516                 ret
5517         }
5518         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
5519                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5520         }
5521 }
5522 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
5523         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
5524                 let datalen = v.len();
5525                 let data = Box::into_raw(v.into_boxed_slice());
5526                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5527         }
5528 }
5529 #[no_mangle]
5530 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5531 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
5532 impl Drop for CVec_APIErrorZ {
5533         fn drop(&mut self) {
5534                 if self.datalen == 0 { return; }
5535                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5536         }
5537 }
5538 impl Clone for CVec_APIErrorZ {
5539         fn clone(&self) -> Self {
5540                 let mut res = Vec::new();
5541                 if self.datalen == 0 { return Self::from(res); }
5542                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5543                 Self::from(res)
5544         }
5545 }
5546 #[repr(C)]
5547 /// The contents of CResult__u832APIErrorZ
5548 pub union CResult__u832APIErrorZPtr {
5549         /// A pointer to the contents in the success state.
5550         /// Reading from this pointer when `result_ok` is not set is undefined.
5551         pub result: *mut crate::c_types::ThirtyTwoBytes,
5552         /// A pointer to the contents in the error state.
5553         /// Reading from this pointer when `result_ok` is set is undefined.
5554         pub err: *mut crate::lightning::util::errors::APIError,
5555 }
5556 #[repr(C)]
5557 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
5558 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5559 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5560 pub struct CResult__u832APIErrorZ {
5561         /// The contents of this CResult__u832APIErrorZ, accessible via either
5562         /// `err` or `result` depending on the state of `result_ok`.
5563         pub contents: CResult__u832APIErrorZPtr,
5564         /// Whether this CResult__u832APIErrorZ represents a success state.
5565         pub result_ok: bool,
5566 }
5567 #[no_mangle]
5568 /// Creates a new CResult__u832APIErrorZ in the success state.
5569 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
5570         CResult__u832APIErrorZ {
5571                 contents: CResult__u832APIErrorZPtr {
5572                         result: Box::into_raw(Box::new(o)),
5573                 },
5574                 result_ok: true,
5575         }
5576 }
5577 #[no_mangle]
5578 /// Creates a new CResult__u832APIErrorZ in the error state.
5579 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
5580         CResult__u832APIErrorZ {
5581                 contents: CResult__u832APIErrorZPtr {
5582                         err: Box::into_raw(Box::new(e)),
5583                 },
5584                 result_ok: false,
5585         }
5586 }
5587 /// Checks if the given object is currently in the success state
5588 #[no_mangle]
5589 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
5590         o.result_ok
5591 }
5592 #[no_mangle]
5593 /// Frees any resources used by the CResult__u832APIErrorZ.
5594 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
5595 impl Drop for CResult__u832APIErrorZ {
5596         fn drop(&mut self) {
5597                 if self.result_ok {
5598                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5599                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5600                         }
5601                 } else {
5602                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5603                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5604                         }
5605                 }
5606         }
5607 }
5608 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
5609         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5610                 let contents = if o.result_ok {
5611                         let result = unsafe { o.contents.result };
5612                         unsafe { o.contents.result = std::ptr::null_mut() };
5613                         CResult__u832APIErrorZPtr { result }
5614                 } else {
5615                         let err = unsafe { o.contents.err };
5616                         unsafe { o.contents.err = std::ptr::null_mut(); }
5617                         CResult__u832APIErrorZPtr { err }
5618                 };
5619                 Self {
5620                         contents,
5621                         result_ok: o.result_ok,
5622                 }
5623         }
5624 }
5625 impl Clone for CResult__u832APIErrorZ {
5626         fn clone(&self) -> Self {
5627                 if self.result_ok {
5628                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5629                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5630                         } }
5631                 } else {
5632                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5633                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5634                         } }
5635                 }
5636         }
5637 }
5638 #[no_mangle]
5639 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5640 /// but with all dynamically-allocated buffers duplicated in new buffers.
5641 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5642 #[repr(C)]
5643 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5644 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5645         /// A pointer to the contents in the success state.
5646         /// Reading from this pointer when `result_ok` is not set is undefined.
5647         pub result: *mut crate::c_types::ThirtyTwoBytes,
5648         /// A pointer to the contents in the error state.
5649         /// Reading from this pointer when `result_ok` is set is undefined.
5650         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5651 }
5652 #[repr(C)]
5653 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5654 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5655 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5656 pub struct CResult_PaymentIdPaymentSendFailureZ {
5657         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5658         /// `err` or `result` depending on the state of `result_ok`.
5659         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5660         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5661         pub result_ok: bool,
5662 }
5663 #[no_mangle]
5664 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5665 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5666         CResult_PaymentIdPaymentSendFailureZ {
5667                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5668                         result: Box::into_raw(Box::new(o)),
5669                 },
5670                 result_ok: true,
5671         }
5672 }
5673 #[no_mangle]
5674 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5675 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5676         CResult_PaymentIdPaymentSendFailureZ {
5677                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5678                         err: Box::into_raw(Box::new(e)),
5679                 },
5680                 result_ok: false,
5681         }
5682 }
5683 /// Checks if the given object is currently in the success state
5684 #[no_mangle]
5685 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
5686         o.result_ok
5687 }
5688 #[no_mangle]
5689 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5690 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5691 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5692         fn drop(&mut self) {
5693                 if self.result_ok {
5694                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5695                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5696                         }
5697                 } else {
5698                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5699                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5700                         }
5701                 }
5702         }
5703 }
5704 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5705         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5706                 let contents = if o.result_ok {
5707                         let result = unsafe { o.contents.result };
5708                         unsafe { o.contents.result = std::ptr::null_mut() };
5709                         CResult_PaymentIdPaymentSendFailureZPtr { result }
5710                 } else {
5711                         let err = unsafe { o.contents.err };
5712                         unsafe { o.contents.err = std::ptr::null_mut(); }
5713                         CResult_PaymentIdPaymentSendFailureZPtr { err }
5714                 };
5715                 Self {
5716                         contents,
5717                         result_ok: o.result_ok,
5718                 }
5719         }
5720 }
5721 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5722         fn clone(&self) -> Self {
5723                 if self.result_ok {
5724                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5725                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5726                         } }
5727                 } else {
5728                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5729                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5730                         } }
5731                 }
5732         }
5733 }
5734 #[no_mangle]
5735 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5736 /// but with all dynamically-allocated buffers duplicated in new buffers.
5737 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5738 #[repr(C)]
5739 /// The contents of CResult_NonePaymentSendFailureZ
5740 pub union CResult_NonePaymentSendFailureZPtr {
5741         /// Note that this value is always NULL, as there are no contents in the OK variant
5742         pub result: *mut std::ffi::c_void,
5743         /// A pointer to the contents in the error state.
5744         /// Reading from this pointer when `result_ok` is set is undefined.
5745         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5746 }
5747 #[repr(C)]
5748 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5749 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5751 pub struct CResult_NonePaymentSendFailureZ {
5752         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5753         /// `err` or `result` depending on the state of `result_ok`.
5754         pub contents: CResult_NonePaymentSendFailureZPtr,
5755         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5756         pub result_ok: bool,
5757 }
5758 #[no_mangle]
5759 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5760 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5761         CResult_NonePaymentSendFailureZ {
5762                 contents: CResult_NonePaymentSendFailureZPtr {
5763                         result: std::ptr::null_mut(),
5764                 },
5765                 result_ok: true,
5766         }
5767 }
5768 #[no_mangle]
5769 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5770 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5771         CResult_NonePaymentSendFailureZ {
5772                 contents: CResult_NonePaymentSendFailureZPtr {
5773                         err: Box::into_raw(Box::new(e)),
5774                 },
5775                 result_ok: false,
5776         }
5777 }
5778 /// Checks if the given object is currently in the success state
5779 #[no_mangle]
5780 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
5781         o.result_ok
5782 }
5783 #[no_mangle]
5784 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5785 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5786 impl Drop for CResult_NonePaymentSendFailureZ {
5787         fn drop(&mut self) {
5788                 if self.result_ok {
5789                 } else {
5790                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5791                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5792                         }
5793                 }
5794         }
5795 }
5796 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5797         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5798                 let contents = if o.result_ok {
5799                         let _ = unsafe { Box::from_raw(o.contents.result) };
5800                         o.contents.result = std::ptr::null_mut();
5801                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
5802                 } else {
5803                         let err = unsafe { o.contents.err };
5804                         unsafe { o.contents.err = std::ptr::null_mut(); }
5805                         CResult_NonePaymentSendFailureZPtr { err }
5806                 };
5807                 Self {
5808                         contents,
5809                         result_ok: o.result_ok,
5810                 }
5811         }
5812 }
5813 impl Clone for CResult_NonePaymentSendFailureZ {
5814         fn clone(&self) -> Self {
5815                 if self.result_ok {
5816                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5817                                 result: std::ptr::null_mut()
5818                         } }
5819                 } else {
5820                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5821                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5822                         } }
5823                 }
5824         }
5825 }
5826 #[no_mangle]
5827 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5828 /// but with all dynamically-allocated buffers duplicated in new buffers.
5829 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5830 #[repr(C)]
5831 /// A tuple of 2 elements. See the individual fields for the types contained.
5832 pub struct C2Tuple_PaymentHashPaymentIdZ {
5833         /// The element at position 0
5834         pub a: crate::c_types::ThirtyTwoBytes,
5835         /// The element at position 1
5836         pub b: crate::c_types::ThirtyTwoBytes,
5837 }
5838 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5839         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5840                 Self {
5841                         a: tup.0,
5842                         b: tup.1,
5843                 }
5844         }
5845 }
5846 impl C2Tuple_PaymentHashPaymentIdZ {
5847         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5848                 (self.a, self.b)
5849         }
5850 }
5851 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5852         fn clone(&self) -> Self {
5853                 Self {
5854                         a: Clone::clone(&self.a),
5855                         b: Clone::clone(&self.b),
5856                 }
5857         }
5858 }
5859 #[no_mangle]
5860 /// Creates a new tuple which has the same data as `orig`
5861 /// but with all dynamically-allocated buffers duplicated in new buffers.
5862 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5863 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5864 #[no_mangle]
5865 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5866         C2Tuple_PaymentHashPaymentIdZ { a, b, }
5867 }
5868
5869 #[no_mangle]
5870 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5871 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5872 #[repr(C)]
5873 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5874 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5875         /// A pointer to the contents in the success state.
5876         /// Reading from this pointer when `result_ok` is not set is undefined.
5877         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5878         /// A pointer to the contents in the error state.
5879         /// Reading from this pointer when `result_ok` is set is undefined.
5880         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5881 }
5882 #[repr(C)]
5883 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5884 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5887         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5888         /// `err` or `result` depending on the state of `result_ok`.
5889         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5890         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5891         pub result_ok: bool,
5892 }
5893 #[no_mangle]
5894 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5895 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5896         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5897                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5898                         result: Box::into_raw(Box::new(o)),
5899                 },
5900                 result_ok: true,
5901         }
5902 }
5903 #[no_mangle]
5904 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5905 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5906         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5907                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5908                         err: Box::into_raw(Box::new(e)),
5909                 },
5910                 result_ok: false,
5911         }
5912 }
5913 /// Checks if the given object is currently in the success state
5914 #[no_mangle]
5915 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
5916         o.result_ok
5917 }
5918 #[no_mangle]
5919 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5920 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5921 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5922         fn drop(&mut self) {
5923                 if self.result_ok {
5924                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5925                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5926                         }
5927                 } else {
5928                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5929                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5930                         }
5931                 }
5932         }
5933 }
5934 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5935         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5936                 let contents = if o.result_ok {
5937                         let result = unsafe { o.contents.result };
5938                         unsafe { o.contents.result = std::ptr::null_mut() };
5939                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5940                 } else {
5941                         let err = unsafe { o.contents.err };
5942                         unsafe { o.contents.err = std::ptr::null_mut(); }
5943                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5944                 };
5945                 Self {
5946                         contents,
5947                         result_ok: o.result_ok,
5948                 }
5949         }
5950 }
5951 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5952         fn clone(&self) -> Self {
5953                 if self.result_ok {
5954                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5955                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5956                         } }
5957                 } else {
5958                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5959                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5960                         } }
5961                 }
5962         }
5963 }
5964 #[no_mangle]
5965 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5966 /// but with all dynamically-allocated buffers duplicated in new buffers.
5967 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5968 #[repr(C)]
5969 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5970 /// This corresponds to std::vector in C++
5971 pub struct CVec_NetAddressZ {
5972         /// The elements in the array.
5973         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5974         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5975         /// The number of elements pointed to by `data`.
5976         pub datalen: usize
5977 }
5978 impl CVec_NetAddressZ {
5979         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5980                 if self.datalen == 0 { return Vec::new(); }
5981                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5982                 self.data = std::ptr::null_mut();
5983                 self.datalen = 0;
5984                 ret
5985         }
5986         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5987                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5988         }
5989 }
5990 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5991         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5992                 let datalen = v.len();
5993                 let data = Box::into_raw(v.into_boxed_slice());
5994                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5995         }
5996 }
5997 #[no_mangle]
5998 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5999 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6000 impl Drop for CVec_NetAddressZ {
6001         fn drop(&mut self) {
6002                 if self.datalen == 0 { return; }
6003                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6004         }
6005 }
6006 impl Clone for CVec_NetAddressZ {
6007         fn clone(&self) -> Self {
6008                 let mut res = Vec::new();
6009                 if self.datalen == 0 { return Self::from(res); }
6010                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6011                 Self::from(res)
6012         }
6013 }
6014 #[repr(C)]
6015 /// A tuple of 2 elements. See the individual fields for the types contained.
6016 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6017         /// The element at position 0
6018         pub a: crate::c_types::ThirtyTwoBytes,
6019         /// The element at position 1
6020         pub b: crate::c_types::ThirtyTwoBytes,
6021 }
6022 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6023         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6024                 Self {
6025                         a: tup.0,
6026                         b: tup.1,
6027                 }
6028         }
6029 }
6030 impl C2Tuple_PaymentHashPaymentSecretZ {
6031         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6032                 (self.a, self.b)
6033         }
6034 }
6035 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6036         fn clone(&self) -> Self {
6037                 Self {
6038                         a: Clone::clone(&self.a),
6039                         b: Clone::clone(&self.b),
6040                 }
6041         }
6042 }
6043 #[no_mangle]
6044 /// Creates a new tuple which has the same data as `orig`
6045 /// but with all dynamically-allocated buffers duplicated in new buffers.
6046 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6047 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6048 #[no_mangle]
6049 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6050         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6051 }
6052
6053 #[no_mangle]
6054 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6055 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6056 #[repr(C)]
6057 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6058 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6059         /// A pointer to the contents in the success state.
6060         /// Reading from this pointer when `result_ok` is not set is undefined.
6061         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6062         /// Note that this value is always NULL, as there are no contents in the Err variant
6063         pub err: *mut std::ffi::c_void,
6064 }
6065 #[repr(C)]
6066 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6067 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6069 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6070         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6071         /// `err` or `result` depending on the state of `result_ok`.
6072         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6073         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6074         pub result_ok: bool,
6075 }
6076 #[no_mangle]
6077 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6078 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6079         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6080                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6081                         result: Box::into_raw(Box::new(o)),
6082                 },
6083                 result_ok: true,
6084         }
6085 }
6086 #[no_mangle]
6087 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6088 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6089         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6090                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6091                         err: std::ptr::null_mut(),
6092                 },
6093                 result_ok: false,
6094         }
6095 }
6096 /// Checks if the given object is currently in the success state
6097 #[no_mangle]
6098 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6099         o.result_ok
6100 }
6101 #[no_mangle]
6102 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6103 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6104 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6105         fn drop(&mut self) {
6106                 if self.result_ok {
6107                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6108                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6109                         }
6110                 } else {
6111                 }
6112         }
6113 }
6114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6115         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6116                 let contents = if o.result_ok {
6117                         let result = unsafe { o.contents.result };
6118                         unsafe { o.contents.result = std::ptr::null_mut() };
6119                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6120                 } else {
6121                         let _ = unsafe { Box::from_raw(o.contents.err) };
6122                         o.contents.err = std::ptr::null_mut();
6123                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: std::ptr::null_mut() }
6124                 };
6125                 Self {
6126                         contents,
6127                         result_ok: o.result_ok,
6128                 }
6129         }
6130 }
6131 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6132         fn clone(&self) -> Self {
6133                 if self.result_ok {
6134                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6135                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6136                         } }
6137                 } else {
6138                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6139                                 err: std::ptr::null_mut()
6140                         } }
6141                 }
6142         }
6143 }
6144 #[no_mangle]
6145 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6146 /// but with all dynamically-allocated buffers duplicated in new buffers.
6147 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6148 #[repr(C)]
6149 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6150 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6151         /// A pointer to the contents in the success state.
6152         /// Reading from this pointer when `result_ok` is not set is undefined.
6153         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6154         /// A pointer to the contents in the error state.
6155         /// Reading from this pointer when `result_ok` is set is undefined.
6156         pub err: *mut crate::lightning::util::errors::APIError,
6157 }
6158 #[repr(C)]
6159 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6160 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6162 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6163         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6164         /// `err` or `result` depending on the state of `result_ok`.
6165         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6166         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6167         pub result_ok: bool,
6168 }
6169 #[no_mangle]
6170 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6171 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6172         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6173                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6174                         result: Box::into_raw(Box::new(o)),
6175                 },
6176                 result_ok: true,
6177         }
6178 }
6179 #[no_mangle]
6180 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6181 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6182         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6183                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6184                         err: Box::into_raw(Box::new(e)),
6185                 },
6186                 result_ok: false,
6187         }
6188 }
6189 /// Checks if the given object is currently in the success state
6190 #[no_mangle]
6191 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6192         o.result_ok
6193 }
6194 #[no_mangle]
6195 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6196 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6197 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6198         fn drop(&mut self) {
6199                 if self.result_ok {
6200                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6201                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6202                         }
6203                 } else {
6204                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6205                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6206                         }
6207                 }
6208         }
6209 }
6210 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6211         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6212                 let contents = if o.result_ok {
6213                         let result = unsafe { o.contents.result };
6214                         unsafe { o.contents.result = std::ptr::null_mut() };
6215                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6216                 } else {
6217                         let err = unsafe { o.contents.err };
6218                         unsafe { o.contents.err = std::ptr::null_mut(); }
6219                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6220                 };
6221                 Self {
6222                         contents,
6223                         result_ok: o.result_ok,
6224                 }
6225         }
6226 }
6227 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6228         fn clone(&self) -> Self {
6229                 if self.result_ok {
6230                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6231                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6232                         } }
6233                 } else {
6234                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6235                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6236                         } }
6237                 }
6238         }
6239 }
6240 #[no_mangle]
6241 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6242 /// but with all dynamically-allocated buffers duplicated in new buffers.
6243 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6244 #[repr(C)]
6245 /// The contents of CResult_PaymentSecretNoneZ
6246 pub union CResult_PaymentSecretNoneZPtr {
6247         /// A pointer to the contents in the success state.
6248         /// Reading from this pointer when `result_ok` is not set is undefined.
6249         pub result: *mut crate::c_types::ThirtyTwoBytes,
6250         /// Note that this value is always NULL, as there are no contents in the Err variant
6251         pub err: *mut std::ffi::c_void,
6252 }
6253 #[repr(C)]
6254 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6255 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6256 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6257 pub struct CResult_PaymentSecretNoneZ {
6258         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6259         /// `err` or `result` depending on the state of `result_ok`.
6260         pub contents: CResult_PaymentSecretNoneZPtr,
6261         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6262         pub result_ok: bool,
6263 }
6264 #[no_mangle]
6265 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6266 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6267         CResult_PaymentSecretNoneZ {
6268                 contents: CResult_PaymentSecretNoneZPtr {
6269                         result: Box::into_raw(Box::new(o)),
6270                 },
6271                 result_ok: true,
6272         }
6273 }
6274 #[no_mangle]
6275 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6276 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6277         CResult_PaymentSecretNoneZ {
6278                 contents: CResult_PaymentSecretNoneZPtr {
6279                         err: std::ptr::null_mut(),
6280                 },
6281                 result_ok: false,
6282         }
6283 }
6284 /// Checks if the given object is currently in the success state
6285 #[no_mangle]
6286 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6287         o.result_ok
6288 }
6289 #[no_mangle]
6290 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6291 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6292 impl Drop for CResult_PaymentSecretNoneZ {
6293         fn drop(&mut self) {
6294                 if self.result_ok {
6295                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6296                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6297                         }
6298                 } else {
6299                 }
6300         }
6301 }
6302 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6303         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6304                 let contents = if o.result_ok {
6305                         let result = unsafe { o.contents.result };
6306                         unsafe { o.contents.result = std::ptr::null_mut() };
6307                         CResult_PaymentSecretNoneZPtr { result }
6308                 } else {
6309                         let _ = unsafe { Box::from_raw(o.contents.err) };
6310                         o.contents.err = std::ptr::null_mut();
6311                         CResult_PaymentSecretNoneZPtr { err: std::ptr::null_mut() }
6312                 };
6313                 Self {
6314                         contents,
6315                         result_ok: o.result_ok,
6316                 }
6317         }
6318 }
6319 impl Clone for CResult_PaymentSecretNoneZ {
6320         fn clone(&self) -> Self {
6321                 if self.result_ok {
6322                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6323                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6324                         } }
6325                 } else {
6326                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6327                                 err: std::ptr::null_mut()
6328                         } }
6329                 }
6330         }
6331 }
6332 #[no_mangle]
6333 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6334 /// but with all dynamically-allocated buffers duplicated in new buffers.
6335 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6336 #[repr(C)]
6337 /// The contents of CResult_PaymentSecretAPIErrorZ
6338 pub union CResult_PaymentSecretAPIErrorZPtr {
6339         /// A pointer to the contents in the success state.
6340         /// Reading from this pointer when `result_ok` is not set is undefined.
6341         pub result: *mut crate::c_types::ThirtyTwoBytes,
6342         /// A pointer to the contents in the error state.
6343         /// Reading from this pointer when `result_ok` is set is undefined.
6344         pub err: *mut crate::lightning::util::errors::APIError,
6345 }
6346 #[repr(C)]
6347 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6348 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6350 pub struct CResult_PaymentSecretAPIErrorZ {
6351         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6352         /// `err` or `result` depending on the state of `result_ok`.
6353         pub contents: CResult_PaymentSecretAPIErrorZPtr,
6354         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6355         pub result_ok: bool,
6356 }
6357 #[no_mangle]
6358 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6359 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6360         CResult_PaymentSecretAPIErrorZ {
6361                 contents: CResult_PaymentSecretAPIErrorZPtr {
6362                         result: Box::into_raw(Box::new(o)),
6363                 },
6364                 result_ok: true,
6365         }
6366 }
6367 #[no_mangle]
6368 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
6369 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
6370         CResult_PaymentSecretAPIErrorZ {
6371                 contents: CResult_PaymentSecretAPIErrorZPtr {
6372                         err: Box::into_raw(Box::new(e)),
6373                 },
6374                 result_ok: false,
6375         }
6376 }
6377 /// Checks if the given object is currently in the success state
6378 #[no_mangle]
6379 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
6380         o.result_ok
6381 }
6382 #[no_mangle]
6383 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
6384 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
6385 impl Drop for CResult_PaymentSecretAPIErrorZ {
6386         fn drop(&mut self) {
6387                 if self.result_ok {
6388                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6389                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6390                         }
6391                 } else {
6392                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6393                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6394                         }
6395                 }
6396         }
6397 }
6398 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
6399         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6400                 let contents = if o.result_ok {
6401                         let result = unsafe { o.contents.result };
6402                         unsafe { o.contents.result = std::ptr::null_mut() };
6403                         CResult_PaymentSecretAPIErrorZPtr { result }
6404                 } else {
6405                         let err = unsafe { o.contents.err };
6406                         unsafe { o.contents.err = std::ptr::null_mut(); }
6407                         CResult_PaymentSecretAPIErrorZPtr { err }
6408                 };
6409                 Self {
6410                         contents,
6411                         result_ok: o.result_ok,
6412                 }
6413         }
6414 }
6415 impl Clone for CResult_PaymentSecretAPIErrorZ {
6416         fn clone(&self) -> Self {
6417                 if self.result_ok {
6418                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
6419                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6420                         } }
6421                 } else {
6422                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
6423                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6424                         } }
6425                 }
6426         }
6427 }
6428 #[no_mangle]
6429 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
6430 /// but with all dynamically-allocated buffers duplicated in new buffers.
6431 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
6432 #[repr(C)]
6433 /// The contents of CResult_PaymentPreimageAPIErrorZ
6434 pub union CResult_PaymentPreimageAPIErrorZPtr {
6435         /// A pointer to the contents in the success state.
6436         /// Reading from this pointer when `result_ok` is not set is undefined.
6437         pub result: *mut crate::c_types::ThirtyTwoBytes,
6438         /// A pointer to the contents in the error state.
6439         /// Reading from this pointer when `result_ok` is set is undefined.
6440         pub err: *mut crate::lightning::util::errors::APIError,
6441 }
6442 #[repr(C)]
6443 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6444 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6446 pub struct CResult_PaymentPreimageAPIErrorZ {
6447         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6448         /// `err` or `result` depending on the state of `result_ok`.
6449         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
6450         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6451         pub result_ok: bool,
6452 }
6453 #[no_mangle]
6454 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
6455 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
6456         CResult_PaymentPreimageAPIErrorZ {
6457                 contents: CResult_PaymentPreimageAPIErrorZPtr {
6458                         result: Box::into_raw(Box::new(o)),
6459                 },
6460                 result_ok: true,
6461         }
6462 }
6463 #[no_mangle]
6464 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
6465 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
6466         CResult_PaymentPreimageAPIErrorZ {
6467                 contents: CResult_PaymentPreimageAPIErrorZPtr {
6468                         err: Box::into_raw(Box::new(e)),
6469                 },
6470                 result_ok: false,
6471         }
6472 }
6473 /// Checks if the given object is currently in the success state
6474 #[no_mangle]
6475 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
6476         o.result_ok
6477 }
6478 #[no_mangle]
6479 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
6480 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
6481 impl Drop for CResult_PaymentPreimageAPIErrorZ {
6482         fn drop(&mut self) {
6483                 if self.result_ok {
6484                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6485                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6486                         }
6487                 } else {
6488                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6489                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6490                         }
6491                 }
6492         }
6493 }
6494 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
6495         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6496                 let contents = if o.result_ok {
6497                         let result = unsafe { o.contents.result };
6498                         unsafe { o.contents.result = std::ptr::null_mut() };
6499                         CResult_PaymentPreimageAPIErrorZPtr { result }
6500                 } else {
6501                         let err = unsafe { o.contents.err };
6502                         unsafe { o.contents.err = std::ptr::null_mut(); }
6503                         CResult_PaymentPreimageAPIErrorZPtr { err }
6504                 };
6505                 Self {
6506                         contents,
6507                         result_ok: o.result_ok,
6508                 }
6509         }
6510 }
6511 impl Clone for CResult_PaymentPreimageAPIErrorZ {
6512         fn clone(&self) -> Self {
6513                 if self.result_ok {
6514                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
6515                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6516                         } }
6517                 } else {
6518                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
6519                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6520                         } }
6521                 }
6522         }
6523 }
6524 #[no_mangle]
6525 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
6526 /// but with all dynamically-allocated buffers duplicated in new buffers.
6527 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
6528 #[repr(C)]
6529 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6530 /// This corresponds to std::vector in C++
6531 pub struct CVec_ChannelMonitorZ {
6532         /// The elements in the array.
6533         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6534         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
6535         /// The number of elements pointed to by `data`.
6536         pub datalen: usize
6537 }
6538 impl CVec_ChannelMonitorZ {
6539         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
6540                 if self.datalen == 0 { return Vec::new(); }
6541                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6542                 self.data = std::ptr::null_mut();
6543                 self.datalen = 0;
6544                 ret
6545         }
6546         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
6547                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6548         }
6549 }
6550 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
6551         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
6552                 let datalen = v.len();
6553                 let data = Box::into_raw(v.into_boxed_slice());
6554                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6555         }
6556 }
6557 #[no_mangle]
6558 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6559 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
6560 impl Drop for CVec_ChannelMonitorZ {
6561         fn drop(&mut self) {
6562                 if self.datalen == 0 { return; }
6563                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6564         }
6565 }
6566 #[repr(C)]
6567 /// A tuple of 2 elements. See the individual fields for the types contained.
6568 pub struct C2Tuple_BlockHashChannelManagerZ {
6569         /// The element at position 0
6570         pub a: crate::c_types::ThirtyTwoBytes,
6571         /// The element at position 1
6572         pub b: crate::lightning::ln::channelmanager::ChannelManager,
6573 }
6574 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
6575         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
6576                 Self {
6577                         a: tup.0,
6578                         b: tup.1,
6579                 }
6580         }
6581 }
6582 impl C2Tuple_BlockHashChannelManagerZ {
6583         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
6584                 (self.a, self.b)
6585         }
6586 }
6587 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
6588 #[no_mangle]
6589 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
6590         C2Tuple_BlockHashChannelManagerZ { a, b, }
6591 }
6592
6593 #[no_mangle]
6594 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
6595 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
6596 #[repr(C)]
6597 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6598 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6599         /// A pointer to the contents in the success state.
6600         /// Reading from this pointer when `result_ok` is not set is undefined.
6601         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
6602         /// A pointer to the contents in the error state.
6603         /// Reading from this pointer when `result_ok` is set is undefined.
6604         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6605 }
6606 #[repr(C)]
6607 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6608 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6610 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6611         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6612         /// `err` or `result` depending on the state of `result_ok`.
6613         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
6614         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6615         pub result_ok: bool,
6616 }
6617 #[no_mangle]
6618 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
6619 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6620         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6621                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6622                         result: Box::into_raw(Box::new(o)),
6623                 },
6624                 result_ok: true,
6625         }
6626 }
6627 #[no_mangle]
6628 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
6629 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6630         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6631                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6632                         err: Box::into_raw(Box::new(e)),
6633                 },
6634                 result_ok: false,
6635         }
6636 }
6637 /// Checks if the given object is currently in the success state
6638 #[no_mangle]
6639 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
6640         o.result_ok
6641 }
6642 #[no_mangle]
6643 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
6644 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
6645 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6646         fn drop(&mut self) {
6647                 if self.result_ok {
6648                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6649                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6650                         }
6651                 } else {
6652                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6653                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6654                         }
6655                 }
6656         }
6657 }
6658 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6659         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6660                 let contents = if o.result_ok {
6661                         let result = unsafe { o.contents.result };
6662                         unsafe { o.contents.result = std::ptr::null_mut() };
6663                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
6664                 } else {
6665                         let err = unsafe { o.contents.err };
6666                         unsafe { o.contents.err = std::ptr::null_mut(); }
6667                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
6668                 };
6669                 Self {
6670                         contents,
6671                         result_ok: o.result_ok,
6672                 }
6673         }
6674 }
6675 #[repr(C)]
6676 /// The contents of CResult_ChannelConfigDecodeErrorZ
6677 pub union CResult_ChannelConfigDecodeErrorZPtr {
6678         /// A pointer to the contents in the success state.
6679         /// Reading from this pointer when `result_ok` is not set is undefined.
6680         pub result: *mut crate::lightning::util::config::ChannelConfig,
6681         /// A pointer to the contents in the error state.
6682         /// Reading from this pointer when `result_ok` is set is undefined.
6683         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6684 }
6685 #[repr(C)]
6686 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6687 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6689 pub struct CResult_ChannelConfigDecodeErrorZ {
6690         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6691         /// `err` or `result` depending on the state of `result_ok`.
6692         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
6693         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6694         pub result_ok: bool,
6695 }
6696 #[no_mangle]
6697 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
6698 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
6699         CResult_ChannelConfigDecodeErrorZ {
6700                 contents: CResult_ChannelConfigDecodeErrorZPtr {
6701                         result: Box::into_raw(Box::new(o)),
6702                 },
6703                 result_ok: true,
6704         }
6705 }
6706 #[no_mangle]
6707 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
6708 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
6709         CResult_ChannelConfigDecodeErrorZ {
6710                 contents: CResult_ChannelConfigDecodeErrorZPtr {
6711                         err: Box::into_raw(Box::new(e)),
6712                 },
6713                 result_ok: false,
6714         }
6715 }
6716 /// Checks if the given object is currently in the success state
6717 #[no_mangle]
6718 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
6719         o.result_ok
6720 }
6721 #[no_mangle]
6722 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
6723 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
6724 impl Drop for CResult_ChannelConfigDecodeErrorZ {
6725         fn drop(&mut self) {
6726                 if self.result_ok {
6727                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6728                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6729                         }
6730                 } else {
6731                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6732                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6733                         }
6734                 }
6735         }
6736 }
6737 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
6738         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
6739                 let contents = if o.result_ok {
6740                         let result = unsafe { o.contents.result };
6741                         unsafe { o.contents.result = std::ptr::null_mut() };
6742                         CResult_ChannelConfigDecodeErrorZPtr { result }
6743                 } else {
6744                         let err = unsafe { o.contents.err };
6745                         unsafe { o.contents.err = std::ptr::null_mut(); }
6746                         CResult_ChannelConfigDecodeErrorZPtr { err }
6747                 };
6748                 Self {
6749                         contents,
6750                         result_ok: o.result_ok,
6751                 }
6752         }
6753 }
6754 impl Clone for CResult_ChannelConfigDecodeErrorZ {
6755         fn clone(&self) -> Self {
6756                 if self.result_ok {
6757                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
6758                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
6759                         } }
6760                 } else {
6761                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
6762                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6763                         } }
6764                 }
6765         }
6766 }
6767 #[no_mangle]
6768 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
6769 /// but with all dynamically-allocated buffers duplicated in new buffers.
6770 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
6771 #[repr(C)]
6772 /// The contents of CResult_OutPointDecodeErrorZ
6773 pub union CResult_OutPointDecodeErrorZPtr {
6774         /// A pointer to the contents in the success state.
6775         /// Reading from this pointer when `result_ok` is not set is undefined.
6776         pub result: *mut crate::lightning::chain::transaction::OutPoint,
6777         /// A pointer to the contents in the error state.
6778         /// Reading from this pointer when `result_ok` is set is undefined.
6779         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6780 }
6781 #[repr(C)]
6782 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6783 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6785 pub struct CResult_OutPointDecodeErrorZ {
6786         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6787         /// `err` or `result` depending on the state of `result_ok`.
6788         pub contents: CResult_OutPointDecodeErrorZPtr,
6789         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
6790         pub result_ok: bool,
6791 }
6792 #[no_mangle]
6793 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
6794 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
6795         CResult_OutPointDecodeErrorZ {
6796                 contents: CResult_OutPointDecodeErrorZPtr {
6797                         result: Box::into_raw(Box::new(o)),
6798                 },
6799                 result_ok: true,
6800         }
6801 }
6802 #[no_mangle]
6803 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
6804 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
6805         CResult_OutPointDecodeErrorZ {
6806                 contents: CResult_OutPointDecodeErrorZPtr {
6807                         err: Box::into_raw(Box::new(e)),
6808                 },
6809                 result_ok: false,
6810         }
6811 }
6812 /// Checks if the given object is currently in the success state
6813 #[no_mangle]
6814 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
6815         o.result_ok
6816 }
6817 #[no_mangle]
6818 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
6819 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
6820 impl Drop for CResult_OutPointDecodeErrorZ {
6821         fn drop(&mut self) {
6822                 if self.result_ok {
6823                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6824                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6825                         }
6826                 } else {
6827                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6828                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6829                         }
6830                 }
6831         }
6832 }
6833 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
6834         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
6835                 let contents = if o.result_ok {
6836                         let result = unsafe { o.contents.result };
6837                         unsafe { o.contents.result = std::ptr::null_mut() };
6838                         CResult_OutPointDecodeErrorZPtr { result }
6839                 } else {
6840                         let err = unsafe { o.contents.err };
6841                         unsafe { o.contents.err = std::ptr::null_mut(); }
6842                         CResult_OutPointDecodeErrorZPtr { err }
6843                 };
6844                 Self {
6845                         contents,
6846                         result_ok: o.result_ok,
6847                 }
6848         }
6849 }
6850 impl Clone for CResult_OutPointDecodeErrorZ {
6851         fn clone(&self) -> Self {
6852                 if self.result_ok {
6853                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
6854                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
6855                         } }
6856                 } else {
6857                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
6858                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6859                         } }
6860                 }
6861         }
6862 }
6863 #[no_mangle]
6864 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
6865 /// but with all dynamically-allocated buffers duplicated in new buffers.
6866 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
6867 #[repr(C)]
6868 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
6869 pub enum COption_TypeZ {
6870         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6871         Some(crate::lightning::ln::wire::Type),
6872         /// When we're in this state, this COption_TypeZ contains nothing
6873         None
6874 }
6875 impl COption_TypeZ {
6876         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6877                 if let Self::None = self { false } else { true }
6878         }
6879         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6880                 !self.is_some()
6881         }
6882         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
6883                 if let Self::Some(v) = self { v } else { unreachable!() }
6884         }
6885 }
6886 #[no_mangle]
6887 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
6888 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
6889         COption_TypeZ::Some(o)
6890 }
6891 #[no_mangle]
6892 /// Constructs a new COption_TypeZ containing nothing
6893 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
6894         COption_TypeZ::None
6895 }
6896 #[no_mangle]
6897 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
6898 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
6899 #[repr(C)]
6900 /// The contents of CResult_COption_TypeZDecodeErrorZ
6901 pub union CResult_COption_TypeZDecodeErrorZPtr {
6902         /// A pointer to the contents in the success state.
6903         /// Reading from this pointer when `result_ok` is not set is undefined.
6904         pub result: *mut crate::c_types::derived::COption_TypeZ,
6905         /// A pointer to the contents in the error state.
6906         /// Reading from this pointer when `result_ok` is set is undefined.
6907         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6908 }
6909 #[repr(C)]
6910 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6911 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6913 pub struct CResult_COption_TypeZDecodeErrorZ {
6914         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6915         /// `err` or `result` depending on the state of `result_ok`.
6916         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
6917         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6918         pub result_ok: bool,
6919 }
6920 #[no_mangle]
6921 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
6922 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
6923         CResult_COption_TypeZDecodeErrorZ {
6924                 contents: CResult_COption_TypeZDecodeErrorZPtr {
6925                         result: Box::into_raw(Box::new(o)),
6926                 },
6927                 result_ok: true,
6928         }
6929 }
6930 #[no_mangle]
6931 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
6932 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
6933         CResult_COption_TypeZDecodeErrorZ {
6934                 contents: CResult_COption_TypeZDecodeErrorZPtr {
6935                         err: Box::into_raw(Box::new(e)),
6936                 },
6937                 result_ok: false,
6938         }
6939 }
6940 /// Checks if the given object is currently in the success state
6941 #[no_mangle]
6942 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
6943         o.result_ok
6944 }
6945 #[no_mangle]
6946 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
6947 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
6948 impl Drop for CResult_COption_TypeZDecodeErrorZ {
6949         fn drop(&mut self) {
6950                 if self.result_ok {
6951                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6952                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6953                         }
6954                 } else {
6955                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6956                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6957                         }
6958                 }
6959         }
6960 }
6961 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
6962         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6963                 let contents = if o.result_ok {
6964                         let result = unsafe { o.contents.result };
6965                         unsafe { o.contents.result = std::ptr::null_mut() };
6966                         CResult_COption_TypeZDecodeErrorZPtr { result }
6967                 } else {
6968                         let err = unsafe { o.contents.err };
6969                         unsafe { o.contents.err = std::ptr::null_mut(); }
6970                         CResult_COption_TypeZDecodeErrorZPtr { err }
6971                 };
6972                 Self {
6973                         contents,
6974                         result_ok: o.result_ok,
6975                 }
6976         }
6977 }
6978 #[repr(C)]
6979 /// The contents of CResult_PaymentIdPaymentErrorZ
6980 pub union CResult_PaymentIdPaymentErrorZPtr {
6981         /// A pointer to the contents in the success state.
6982         /// Reading from this pointer when `result_ok` is not set is undefined.
6983         pub result: *mut crate::c_types::ThirtyTwoBytes,
6984         /// A pointer to the contents in the error state.
6985         /// Reading from this pointer when `result_ok` is set is undefined.
6986         pub err: *mut crate::lightning_invoice::payment::PaymentError,
6987 }
6988 #[repr(C)]
6989 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6990 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
6991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6992 pub struct CResult_PaymentIdPaymentErrorZ {
6993         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
6994         /// `err` or `result` depending on the state of `result_ok`.
6995         pub contents: CResult_PaymentIdPaymentErrorZPtr,
6996         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
6997         pub result_ok: bool,
6998 }
6999 #[no_mangle]
7000 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
7001 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
7002         CResult_PaymentIdPaymentErrorZ {
7003                 contents: CResult_PaymentIdPaymentErrorZPtr {
7004                         result: Box::into_raw(Box::new(o)),
7005                 },
7006                 result_ok: true,
7007         }
7008 }
7009 #[no_mangle]
7010 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
7011 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
7012         CResult_PaymentIdPaymentErrorZ {
7013                 contents: CResult_PaymentIdPaymentErrorZPtr {
7014                         err: Box::into_raw(Box::new(e)),
7015                 },
7016                 result_ok: false,
7017         }
7018 }
7019 /// Checks if the given object is currently in the success state
7020 #[no_mangle]
7021 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
7022         o.result_ok
7023 }
7024 #[no_mangle]
7025 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
7026 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
7027 impl Drop for CResult_PaymentIdPaymentErrorZ {
7028         fn drop(&mut self) {
7029                 if self.result_ok {
7030                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7031                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7032                         }
7033                 } else {
7034                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7035                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7036                         }
7037                 }
7038         }
7039 }
7040 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
7041         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
7042                 let contents = if o.result_ok {
7043                         let result = unsafe { o.contents.result };
7044                         unsafe { o.contents.result = std::ptr::null_mut() };
7045                         CResult_PaymentIdPaymentErrorZPtr { result }
7046                 } else {
7047                         let err = unsafe { o.contents.err };
7048                         unsafe { o.contents.err = std::ptr::null_mut(); }
7049                         CResult_PaymentIdPaymentErrorZPtr { err }
7050                 };
7051                 Self {
7052                         contents,
7053                         result_ok: o.result_ok,
7054                 }
7055         }
7056 }
7057 impl Clone for CResult_PaymentIdPaymentErrorZ {
7058         fn clone(&self) -> Self {
7059                 if self.result_ok {
7060                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
7061                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7062                         } }
7063                 } else {
7064                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
7065                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
7066                         } }
7067                 }
7068         }
7069 }
7070 #[no_mangle]
7071 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
7072 /// but with all dynamically-allocated buffers duplicated in new buffers.
7073 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
7074 #[repr(C)]
7075 /// The contents of CResult_SiPrefixNoneZ
7076 pub union CResult_SiPrefixNoneZPtr {
7077         /// A pointer to the contents in the success state.
7078         /// Reading from this pointer when `result_ok` is not set is undefined.
7079         pub result: *mut crate::lightning_invoice::SiPrefix,
7080         /// Note that this value is always NULL, as there are no contents in the Err variant
7081         pub err: *mut std::ffi::c_void,
7082 }
7083 #[repr(C)]
7084 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
7085 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
7086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7087 pub struct CResult_SiPrefixNoneZ {
7088         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
7089         /// `err` or `result` depending on the state of `result_ok`.
7090         pub contents: CResult_SiPrefixNoneZPtr,
7091         /// Whether this CResult_SiPrefixNoneZ represents a success state.
7092         pub result_ok: bool,
7093 }
7094 #[no_mangle]
7095 /// Creates a new CResult_SiPrefixNoneZ in the success state.
7096 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
7097         CResult_SiPrefixNoneZ {
7098                 contents: CResult_SiPrefixNoneZPtr {
7099                         result: Box::into_raw(Box::new(o)),
7100                 },
7101                 result_ok: true,
7102         }
7103 }
7104 #[no_mangle]
7105 /// Creates a new CResult_SiPrefixNoneZ in the error state.
7106 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
7107         CResult_SiPrefixNoneZ {
7108                 contents: CResult_SiPrefixNoneZPtr {
7109                         err: std::ptr::null_mut(),
7110                 },
7111                 result_ok: false,
7112         }
7113 }
7114 /// Checks if the given object is currently in the success state
7115 #[no_mangle]
7116 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
7117         o.result_ok
7118 }
7119 #[no_mangle]
7120 /// Frees any resources used by the CResult_SiPrefixNoneZ.
7121 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
7122 impl Drop for CResult_SiPrefixNoneZ {
7123         fn drop(&mut self) {
7124                 if self.result_ok {
7125                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7126                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7127                         }
7128                 } else {
7129                 }
7130         }
7131 }
7132 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
7133         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
7134                 let contents = if o.result_ok {
7135                         let result = unsafe { o.contents.result };
7136                         unsafe { o.contents.result = std::ptr::null_mut() };
7137                         CResult_SiPrefixNoneZPtr { result }
7138                 } else {
7139                         let _ = unsafe { Box::from_raw(o.contents.err) };
7140                         o.contents.err = std::ptr::null_mut();
7141                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
7142                 };
7143                 Self {
7144                         contents,
7145                         result_ok: o.result_ok,
7146                 }
7147         }
7148 }
7149 impl Clone for CResult_SiPrefixNoneZ {
7150         fn clone(&self) -> Self {
7151                 if self.result_ok {
7152                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
7153                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
7154                         } }
7155                 } else {
7156                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
7157                                 err: std::ptr::null_mut()
7158                         } }
7159                 }
7160         }
7161 }
7162 #[no_mangle]
7163 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
7164 /// but with all dynamically-allocated buffers duplicated in new buffers.
7165 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
7166 #[repr(C)]
7167 /// The contents of CResult_InvoiceNoneZ
7168 pub union CResult_InvoiceNoneZPtr {
7169         /// A pointer to the contents in the success state.
7170         /// Reading from this pointer when `result_ok` is not set is undefined.
7171         pub result: *mut crate::lightning_invoice::Invoice,
7172         /// Note that this value is always NULL, as there are no contents in the Err variant
7173         pub err: *mut std::ffi::c_void,
7174 }
7175 #[repr(C)]
7176 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
7177 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
7178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7179 pub struct CResult_InvoiceNoneZ {
7180         /// The contents of this CResult_InvoiceNoneZ, accessible via either
7181         /// `err` or `result` depending on the state of `result_ok`.
7182         pub contents: CResult_InvoiceNoneZPtr,
7183         /// Whether this CResult_InvoiceNoneZ represents a success state.
7184         pub result_ok: bool,
7185 }
7186 #[no_mangle]
7187 /// Creates a new CResult_InvoiceNoneZ in the success state.
7188 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
7189         CResult_InvoiceNoneZ {
7190                 contents: CResult_InvoiceNoneZPtr {
7191                         result: Box::into_raw(Box::new(o)),
7192                 },
7193                 result_ok: true,
7194         }
7195 }
7196 #[no_mangle]
7197 /// Creates a new CResult_InvoiceNoneZ in the error state.
7198 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
7199         CResult_InvoiceNoneZ {
7200                 contents: CResult_InvoiceNoneZPtr {
7201                         err: std::ptr::null_mut(),
7202                 },
7203                 result_ok: false,
7204         }
7205 }
7206 /// Checks if the given object is currently in the success state
7207 #[no_mangle]
7208 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
7209         o.result_ok
7210 }
7211 #[no_mangle]
7212 /// Frees any resources used by the CResult_InvoiceNoneZ.
7213 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
7214 impl Drop for CResult_InvoiceNoneZ {
7215         fn drop(&mut self) {
7216                 if self.result_ok {
7217                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7218                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7219                         }
7220                 } else {
7221                 }
7222         }
7223 }
7224 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
7225         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
7226                 let contents = if o.result_ok {
7227                         let result = unsafe { o.contents.result };
7228                         unsafe { o.contents.result = std::ptr::null_mut() };
7229                         CResult_InvoiceNoneZPtr { result }
7230                 } else {
7231                         let _ = unsafe { Box::from_raw(o.contents.err) };
7232                         o.contents.err = std::ptr::null_mut();
7233                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
7234                 };
7235                 Self {
7236                         contents,
7237                         result_ok: o.result_ok,
7238                 }
7239         }
7240 }
7241 impl Clone for CResult_InvoiceNoneZ {
7242         fn clone(&self) -> Self {
7243                 if self.result_ok {
7244                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
7245                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7246                         } }
7247                 } else {
7248                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
7249                                 err: std::ptr::null_mut()
7250                         } }
7251                 }
7252         }
7253 }
7254 #[no_mangle]
7255 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
7256 /// but with all dynamically-allocated buffers duplicated in new buffers.
7257 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
7258 #[repr(C)]
7259 /// The contents of CResult_SignedRawInvoiceNoneZ
7260 pub union CResult_SignedRawInvoiceNoneZPtr {
7261         /// A pointer to the contents in the success state.
7262         /// Reading from this pointer when `result_ok` is not set is undefined.
7263         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
7264         /// Note that this value is always NULL, as there are no contents in the Err variant
7265         pub err: *mut std::ffi::c_void,
7266 }
7267 #[repr(C)]
7268 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
7269 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
7270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7271 pub struct CResult_SignedRawInvoiceNoneZ {
7272         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
7273         /// `err` or `result` depending on the state of `result_ok`.
7274         pub contents: CResult_SignedRawInvoiceNoneZPtr,
7275         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
7276         pub result_ok: bool,
7277 }
7278 #[no_mangle]
7279 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
7280 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
7281         CResult_SignedRawInvoiceNoneZ {
7282                 contents: CResult_SignedRawInvoiceNoneZPtr {
7283                         result: Box::into_raw(Box::new(o)),
7284                 },
7285                 result_ok: true,
7286         }
7287 }
7288 #[no_mangle]
7289 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
7290 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
7291         CResult_SignedRawInvoiceNoneZ {
7292                 contents: CResult_SignedRawInvoiceNoneZPtr {
7293                         err: std::ptr::null_mut(),
7294                 },
7295                 result_ok: false,
7296         }
7297 }
7298 /// Checks if the given object is currently in the success state
7299 #[no_mangle]
7300 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
7301         o.result_ok
7302 }
7303 #[no_mangle]
7304 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
7305 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
7306 impl Drop for CResult_SignedRawInvoiceNoneZ {
7307         fn drop(&mut self) {
7308                 if self.result_ok {
7309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7311                         }
7312                 } else {
7313                 }
7314         }
7315 }
7316 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
7317         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
7318                 let contents = if o.result_ok {
7319                         let result = unsafe { o.contents.result };
7320                         unsafe { o.contents.result = std::ptr::null_mut() };
7321                         CResult_SignedRawInvoiceNoneZPtr { result }
7322                 } else {
7323                         let _ = unsafe { Box::from_raw(o.contents.err) };
7324                         o.contents.err = std::ptr::null_mut();
7325                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
7326                 };
7327                 Self {
7328                         contents,
7329                         result_ok: o.result_ok,
7330                 }
7331         }
7332 }
7333 impl Clone for CResult_SignedRawInvoiceNoneZ {
7334         fn clone(&self) -> Self {
7335                 if self.result_ok {
7336                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
7337                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
7338                         } }
7339                 } else {
7340                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
7341                                 err: std::ptr::null_mut()
7342                         } }
7343                 }
7344         }
7345 }
7346 #[no_mangle]
7347 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
7348 /// but with all dynamically-allocated buffers duplicated in new buffers.
7349 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
7350 #[repr(C)]
7351 /// A tuple of 3 elements. See the individual fields for the types contained.
7352 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7353         /// The element at position 0
7354         pub a: crate::lightning_invoice::RawInvoice,
7355         /// The element at position 1
7356         pub b: crate::c_types::ThirtyTwoBytes,
7357         /// The element at position 2
7358         pub c: crate::lightning_invoice::InvoiceSignature,
7359 }
7360 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7361         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
7362                 Self {
7363                         a: tup.0,
7364                         b: tup.1,
7365                         c: tup.2,
7366                 }
7367         }
7368 }
7369 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7370         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
7371                 (self.a, self.b, self.c)
7372         }
7373 }
7374 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7375         fn clone(&self) -> Self {
7376                 Self {
7377                         a: Clone::clone(&self.a),
7378                         b: Clone::clone(&self.b),
7379                         c: Clone::clone(&self.c),
7380                 }
7381         }
7382 }
7383 #[no_mangle]
7384 /// Creates a new tuple which has the same data as `orig`
7385 /// but with all dynamically-allocated buffers duplicated in new buffers.
7386 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
7387 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
7388 #[no_mangle]
7389 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 {
7390         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
7391 }
7392
7393 #[no_mangle]
7394 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
7395 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
7396 #[repr(C)]
7397 /// The contents of CResult_PayeePubKeyErrorZ
7398 pub union CResult_PayeePubKeyErrorZPtr {
7399         /// A pointer to the contents in the success state.
7400         /// Reading from this pointer when `result_ok` is not set is undefined.
7401         pub result: *mut crate::lightning_invoice::PayeePubKey,
7402         /// A pointer to the contents in the error state.
7403         /// Reading from this pointer when `result_ok` is set is undefined.
7404         pub err: *mut crate::c_types::Secp256k1Error,
7405 }
7406 #[repr(C)]
7407 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7408 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7410 pub struct CResult_PayeePubKeyErrorZ {
7411         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7412         /// `err` or `result` depending on the state of `result_ok`.
7413         pub contents: CResult_PayeePubKeyErrorZPtr,
7414         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
7415         pub result_ok: bool,
7416 }
7417 #[no_mangle]
7418 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
7419 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
7420         CResult_PayeePubKeyErrorZ {
7421                 contents: CResult_PayeePubKeyErrorZPtr {
7422                         result: Box::into_raw(Box::new(o)),
7423                 },
7424                 result_ok: true,
7425         }
7426 }
7427 #[no_mangle]
7428 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
7429 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
7430         CResult_PayeePubKeyErrorZ {
7431                 contents: CResult_PayeePubKeyErrorZPtr {
7432                         err: Box::into_raw(Box::new(e)),
7433                 },
7434                 result_ok: false,
7435         }
7436 }
7437 /// Checks if the given object is currently in the success state
7438 #[no_mangle]
7439 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
7440         o.result_ok
7441 }
7442 #[no_mangle]
7443 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
7444 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
7445 impl Drop for CResult_PayeePubKeyErrorZ {
7446         fn drop(&mut self) {
7447                 if self.result_ok {
7448                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7449                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7450                         }
7451                 } else {
7452                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7453                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7454                         }
7455                 }
7456         }
7457 }
7458 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
7459         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
7460                 let contents = if o.result_ok {
7461                         let result = unsafe { o.contents.result };
7462                         unsafe { o.contents.result = std::ptr::null_mut() };
7463                         CResult_PayeePubKeyErrorZPtr { result }
7464                 } else {
7465                         let err = unsafe { o.contents.err };
7466                         unsafe { o.contents.err = std::ptr::null_mut(); }
7467                         CResult_PayeePubKeyErrorZPtr { err }
7468                 };
7469                 Self {
7470                         contents,
7471                         result_ok: o.result_ok,
7472                 }
7473         }
7474 }
7475 impl Clone for CResult_PayeePubKeyErrorZ {
7476         fn clone(&self) -> Self {
7477                 if self.result_ok {
7478                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
7479                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
7480                         } }
7481                 } else {
7482                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
7483                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7484                         } }
7485                 }
7486         }
7487 }
7488 #[no_mangle]
7489 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
7490 /// but with all dynamically-allocated buffers duplicated in new buffers.
7491 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
7492 #[repr(C)]
7493 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7494 /// This corresponds to std::vector in C++
7495 pub struct CVec_PrivateRouteZ {
7496         /// The elements in the array.
7497         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7498         pub data: *mut crate::lightning_invoice::PrivateRoute,
7499         /// The number of elements pointed to by `data`.
7500         pub datalen: usize
7501 }
7502 impl CVec_PrivateRouteZ {
7503         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
7504                 if self.datalen == 0 { return Vec::new(); }
7505                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7506                 self.data = std::ptr::null_mut();
7507                 self.datalen = 0;
7508                 ret
7509         }
7510         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
7511                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
7512         }
7513 }
7514 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
7515         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
7516                 let datalen = v.len();
7517                 let data = Box::into_raw(v.into_boxed_slice());
7518                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7519         }
7520 }
7521 #[no_mangle]
7522 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7523 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
7524 impl Drop for CVec_PrivateRouteZ {
7525         fn drop(&mut self) {
7526                 if self.datalen == 0 { return; }
7527                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
7528         }
7529 }
7530 impl Clone for CVec_PrivateRouteZ {
7531         fn clone(&self) -> Self {
7532                 let mut res = Vec::new();
7533                 if self.datalen == 0 { return Self::from(res); }
7534                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
7535                 Self::from(res)
7536         }
7537 }
7538 #[repr(C)]
7539 /// The contents of CResult_PositiveTimestampCreationErrorZ
7540 pub union CResult_PositiveTimestampCreationErrorZPtr {
7541         /// A pointer to the contents in the success state.
7542         /// Reading from this pointer when `result_ok` is not set is undefined.
7543         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
7544         /// A pointer to the contents in the error state.
7545         /// Reading from this pointer when `result_ok` is set is undefined.
7546         pub err: *mut crate::lightning_invoice::CreationError,
7547 }
7548 #[repr(C)]
7549 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7550 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7552 pub struct CResult_PositiveTimestampCreationErrorZ {
7553         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7554         /// `err` or `result` depending on the state of `result_ok`.
7555         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
7556         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7557         pub result_ok: bool,
7558 }
7559 #[no_mangle]
7560 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
7561 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
7562         CResult_PositiveTimestampCreationErrorZ {
7563                 contents: CResult_PositiveTimestampCreationErrorZPtr {
7564                         result: Box::into_raw(Box::new(o)),
7565                 },
7566                 result_ok: true,
7567         }
7568 }
7569 #[no_mangle]
7570 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
7571 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
7572         CResult_PositiveTimestampCreationErrorZ {
7573                 contents: CResult_PositiveTimestampCreationErrorZPtr {
7574                         err: Box::into_raw(Box::new(e)),
7575                 },
7576                 result_ok: false,
7577         }
7578 }
7579 /// Checks if the given object is currently in the success state
7580 #[no_mangle]
7581 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
7582         o.result_ok
7583 }
7584 #[no_mangle]
7585 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
7586 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
7587 impl Drop for CResult_PositiveTimestampCreationErrorZ {
7588         fn drop(&mut self) {
7589                 if self.result_ok {
7590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7592                         }
7593                 } else {
7594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7596                         }
7597                 }
7598         }
7599 }
7600 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
7601         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
7602                 let contents = if o.result_ok {
7603                         let result = unsafe { o.contents.result };
7604                         unsafe { o.contents.result = std::ptr::null_mut() };
7605                         CResult_PositiveTimestampCreationErrorZPtr { result }
7606                 } else {
7607                         let err = unsafe { o.contents.err };
7608                         unsafe { o.contents.err = std::ptr::null_mut(); }
7609                         CResult_PositiveTimestampCreationErrorZPtr { err }
7610                 };
7611                 Self {
7612                         contents,
7613                         result_ok: o.result_ok,
7614                 }
7615         }
7616 }
7617 impl Clone for CResult_PositiveTimestampCreationErrorZ {
7618         fn clone(&self) -> Self {
7619                 if self.result_ok {
7620                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
7621                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
7622                         } }
7623                 } else {
7624                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
7625                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7626                         } }
7627                 }
7628         }
7629 }
7630 #[no_mangle]
7631 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
7632 /// but with all dynamically-allocated buffers duplicated in new buffers.
7633 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
7634 #[repr(C)]
7635 /// The contents of CResult_NoneSemanticErrorZ
7636 pub union CResult_NoneSemanticErrorZPtr {
7637         /// Note that this value is always NULL, as there are no contents in the OK variant
7638         pub result: *mut std::ffi::c_void,
7639         /// A pointer to the contents in the error state.
7640         /// Reading from this pointer when `result_ok` is set is undefined.
7641         pub err: *mut crate::lightning_invoice::SemanticError,
7642 }
7643 #[repr(C)]
7644 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7645 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7647 pub struct CResult_NoneSemanticErrorZ {
7648         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
7649         /// `err` or `result` depending on the state of `result_ok`.
7650         pub contents: CResult_NoneSemanticErrorZPtr,
7651         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
7652         pub result_ok: bool,
7653 }
7654 #[no_mangle]
7655 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
7656 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
7657         CResult_NoneSemanticErrorZ {
7658                 contents: CResult_NoneSemanticErrorZPtr {
7659                         result: std::ptr::null_mut(),
7660                 },
7661                 result_ok: true,
7662         }
7663 }
7664 #[no_mangle]
7665 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
7666 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
7667         CResult_NoneSemanticErrorZ {
7668                 contents: CResult_NoneSemanticErrorZPtr {
7669                         err: Box::into_raw(Box::new(e)),
7670                 },
7671                 result_ok: false,
7672         }
7673 }
7674 /// Checks if the given object is currently in the success state
7675 #[no_mangle]
7676 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
7677         o.result_ok
7678 }
7679 #[no_mangle]
7680 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
7681 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
7682 impl Drop for CResult_NoneSemanticErrorZ {
7683         fn drop(&mut self) {
7684                 if self.result_ok {
7685                 } else {
7686                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7687                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7688                         }
7689                 }
7690         }
7691 }
7692 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
7693         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
7694                 let contents = if o.result_ok {
7695                         let _ = unsafe { Box::from_raw(o.contents.result) };
7696                         o.contents.result = std::ptr::null_mut();
7697                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
7698                 } else {
7699                         let err = unsafe { o.contents.err };
7700                         unsafe { o.contents.err = std::ptr::null_mut(); }
7701                         CResult_NoneSemanticErrorZPtr { err }
7702                 };
7703                 Self {
7704                         contents,
7705                         result_ok: o.result_ok,
7706                 }
7707         }
7708 }
7709 impl Clone for CResult_NoneSemanticErrorZ {
7710         fn clone(&self) -> Self {
7711                 if self.result_ok {
7712                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
7713                                 result: std::ptr::null_mut()
7714                         } }
7715                 } else {
7716                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
7717                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7718                         } }
7719                 }
7720         }
7721 }
7722 #[no_mangle]
7723 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
7724 /// but with all dynamically-allocated buffers duplicated in new buffers.
7725 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
7726 #[repr(C)]
7727 /// The contents of CResult_InvoiceSemanticErrorZ
7728 pub union CResult_InvoiceSemanticErrorZPtr {
7729         /// A pointer to the contents in the success state.
7730         /// Reading from this pointer when `result_ok` is not set is undefined.
7731         pub result: *mut crate::lightning_invoice::Invoice,
7732         /// A pointer to the contents in the error state.
7733         /// Reading from this pointer when `result_ok` is set is undefined.
7734         pub err: *mut crate::lightning_invoice::SemanticError,
7735 }
7736 #[repr(C)]
7737 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7738 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7739 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7740 pub struct CResult_InvoiceSemanticErrorZ {
7741         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7742         /// `err` or `result` depending on the state of `result_ok`.
7743         pub contents: CResult_InvoiceSemanticErrorZPtr,
7744         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7745         pub result_ok: bool,
7746 }
7747 #[no_mangle]
7748 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
7749 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
7750         CResult_InvoiceSemanticErrorZ {
7751                 contents: CResult_InvoiceSemanticErrorZPtr {
7752                         result: Box::into_raw(Box::new(o)),
7753                 },
7754                 result_ok: true,
7755         }
7756 }
7757 #[no_mangle]
7758 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
7759 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
7760         CResult_InvoiceSemanticErrorZ {
7761                 contents: CResult_InvoiceSemanticErrorZPtr {
7762                         err: Box::into_raw(Box::new(e)),
7763                 },
7764                 result_ok: false,
7765         }
7766 }
7767 /// Checks if the given object is currently in the success state
7768 #[no_mangle]
7769 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
7770         o.result_ok
7771 }
7772 #[no_mangle]
7773 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
7774 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
7775 impl Drop for CResult_InvoiceSemanticErrorZ {
7776         fn drop(&mut self) {
7777                 if self.result_ok {
7778                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7779                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7780                         }
7781                 } else {
7782                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7783                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7784                         }
7785                 }
7786         }
7787 }
7788 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
7789         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
7790                 let contents = if o.result_ok {
7791                         let result = unsafe { o.contents.result };
7792                         unsafe { o.contents.result = std::ptr::null_mut() };
7793                         CResult_InvoiceSemanticErrorZPtr { result }
7794                 } else {
7795                         let err = unsafe { o.contents.err };
7796                         unsafe { o.contents.err = std::ptr::null_mut(); }
7797                         CResult_InvoiceSemanticErrorZPtr { err }
7798                 };
7799                 Self {
7800                         contents,
7801                         result_ok: o.result_ok,
7802                 }
7803         }
7804 }
7805 impl Clone for CResult_InvoiceSemanticErrorZ {
7806         fn clone(&self) -> Self {
7807                 if self.result_ok {
7808                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
7809                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7810                         } }
7811                 } else {
7812                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
7813                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7814                         } }
7815                 }
7816         }
7817 }
7818 #[no_mangle]
7819 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
7820 /// but with all dynamically-allocated buffers duplicated in new buffers.
7821 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
7822 #[repr(C)]
7823 /// The contents of CResult_DescriptionCreationErrorZ
7824 pub union CResult_DescriptionCreationErrorZPtr {
7825         /// A pointer to the contents in the success state.
7826         /// Reading from this pointer when `result_ok` is not set is undefined.
7827         pub result: *mut crate::lightning_invoice::Description,
7828         /// A pointer to the contents in the error state.
7829         /// Reading from this pointer when `result_ok` is set is undefined.
7830         pub err: *mut crate::lightning_invoice::CreationError,
7831 }
7832 #[repr(C)]
7833 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7834 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7835 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7836 pub struct CResult_DescriptionCreationErrorZ {
7837         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7838         /// `err` or `result` depending on the state of `result_ok`.
7839         pub contents: CResult_DescriptionCreationErrorZPtr,
7840         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
7841         pub result_ok: bool,
7842 }
7843 #[no_mangle]
7844 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
7845 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
7846         CResult_DescriptionCreationErrorZ {
7847                 contents: CResult_DescriptionCreationErrorZPtr {
7848                         result: Box::into_raw(Box::new(o)),
7849                 },
7850                 result_ok: true,
7851         }
7852 }
7853 #[no_mangle]
7854 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
7855 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
7856         CResult_DescriptionCreationErrorZ {
7857                 contents: CResult_DescriptionCreationErrorZPtr {
7858                         err: Box::into_raw(Box::new(e)),
7859                 },
7860                 result_ok: false,
7861         }
7862 }
7863 /// Checks if the given object is currently in the success state
7864 #[no_mangle]
7865 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
7866         o.result_ok
7867 }
7868 #[no_mangle]
7869 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
7870 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
7871 impl Drop for CResult_DescriptionCreationErrorZ {
7872         fn drop(&mut self) {
7873                 if self.result_ok {
7874                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7875                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7876                         }
7877                 } else {
7878                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7879                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7880                         }
7881                 }
7882         }
7883 }
7884 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
7885         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
7886                 let contents = if o.result_ok {
7887                         let result = unsafe { o.contents.result };
7888                         unsafe { o.contents.result = std::ptr::null_mut() };
7889                         CResult_DescriptionCreationErrorZPtr { result }
7890                 } else {
7891                         let err = unsafe { o.contents.err };
7892                         unsafe { o.contents.err = std::ptr::null_mut(); }
7893                         CResult_DescriptionCreationErrorZPtr { err }
7894                 };
7895                 Self {
7896                         contents,
7897                         result_ok: o.result_ok,
7898                 }
7899         }
7900 }
7901 impl Clone for CResult_DescriptionCreationErrorZ {
7902         fn clone(&self) -> Self {
7903                 if self.result_ok {
7904                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
7905                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
7906                         } }
7907                 } else {
7908                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
7909                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7910                         } }
7911                 }
7912         }
7913 }
7914 #[no_mangle]
7915 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
7916 /// but with all dynamically-allocated buffers duplicated in new buffers.
7917 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
7918 #[repr(C)]
7919 /// The contents of CResult_ExpiryTimeCreationErrorZ
7920 pub union CResult_ExpiryTimeCreationErrorZPtr {
7921         /// A pointer to the contents in the success state.
7922         /// Reading from this pointer when `result_ok` is not set is undefined.
7923         pub result: *mut crate::lightning_invoice::ExpiryTime,
7924         /// A pointer to the contents in the error state.
7925         /// Reading from this pointer when `result_ok` is set is undefined.
7926         pub err: *mut crate::lightning_invoice::CreationError,
7927 }
7928 #[repr(C)]
7929 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
7930 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
7931 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7932 pub struct CResult_ExpiryTimeCreationErrorZ {
7933         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
7934         /// `err` or `result` depending on the state of `result_ok`.
7935         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
7936         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
7937         pub result_ok: bool,
7938 }
7939 #[no_mangle]
7940 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
7941 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
7942         CResult_ExpiryTimeCreationErrorZ {
7943                 contents: CResult_ExpiryTimeCreationErrorZPtr {
7944                         result: Box::into_raw(Box::new(o)),
7945                 },
7946                 result_ok: true,
7947         }
7948 }
7949 #[no_mangle]
7950 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
7951 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
7952         CResult_ExpiryTimeCreationErrorZ {
7953                 contents: CResult_ExpiryTimeCreationErrorZPtr {
7954                         err: Box::into_raw(Box::new(e)),
7955                 },
7956                 result_ok: false,
7957         }
7958 }
7959 /// Checks if the given object is currently in the success state
7960 #[no_mangle]
7961 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_is_ok(o: &CResult_ExpiryTimeCreationErrorZ) -> bool {
7962         o.result_ok
7963 }
7964 #[no_mangle]
7965 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
7966 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
7967 impl Drop for CResult_ExpiryTimeCreationErrorZ {
7968         fn drop(&mut self) {
7969                 if self.result_ok {
7970                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7971                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7972                         }
7973                 } else {
7974                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7975                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7976                         }
7977                 }
7978         }
7979 }
7980 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
7981         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
7982                 let contents = if o.result_ok {
7983                         let result = unsafe { o.contents.result };
7984                         unsafe { o.contents.result = std::ptr::null_mut() };
7985                         CResult_ExpiryTimeCreationErrorZPtr { result }
7986                 } else {
7987                         let err = unsafe { o.contents.err };
7988                         unsafe { o.contents.err = std::ptr::null_mut(); }
7989                         CResult_ExpiryTimeCreationErrorZPtr { err }
7990                 };
7991                 Self {
7992                         contents,
7993                         result_ok: o.result_ok,
7994                 }
7995         }
7996 }
7997 impl Clone for CResult_ExpiryTimeCreationErrorZ {
7998         fn clone(&self) -> Self {
7999                 if self.result_ok {
8000                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
8001                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
8002                         } }
8003                 } else {
8004                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
8005                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8006                         } }
8007                 }
8008         }
8009 }
8010 #[no_mangle]
8011 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
8012 /// but with all dynamically-allocated buffers duplicated in new buffers.
8013 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
8014 #[repr(C)]
8015 /// The contents of CResult_PrivateRouteCreationErrorZ
8016 pub union CResult_PrivateRouteCreationErrorZPtr {
8017         /// A pointer to the contents in the success state.
8018         /// Reading from this pointer when `result_ok` is not set is undefined.
8019         pub result: *mut crate::lightning_invoice::PrivateRoute,
8020         /// A pointer to the contents in the error state.
8021         /// Reading from this pointer when `result_ok` is set is undefined.
8022         pub err: *mut crate::lightning_invoice::CreationError,
8023 }
8024 #[repr(C)]
8025 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8026 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8027 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8028 pub struct CResult_PrivateRouteCreationErrorZ {
8029         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8030         /// `err` or `result` depending on the state of `result_ok`.
8031         pub contents: CResult_PrivateRouteCreationErrorZPtr,
8032         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8033         pub result_ok: bool,
8034 }
8035 #[no_mangle]
8036 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8037 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8038         CResult_PrivateRouteCreationErrorZ {
8039                 contents: CResult_PrivateRouteCreationErrorZPtr {
8040                         result: Box::into_raw(Box::new(o)),
8041                 },
8042                 result_ok: true,
8043         }
8044 }
8045 #[no_mangle]
8046 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8047 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8048         CResult_PrivateRouteCreationErrorZ {
8049                 contents: CResult_PrivateRouteCreationErrorZPtr {
8050                         err: Box::into_raw(Box::new(e)),
8051                 },
8052                 result_ok: false,
8053         }
8054 }
8055 /// Checks if the given object is currently in the success state
8056 #[no_mangle]
8057 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8058         o.result_ok
8059 }
8060 #[no_mangle]
8061 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8062 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8063 impl Drop for CResult_PrivateRouteCreationErrorZ {
8064         fn drop(&mut self) {
8065                 if self.result_ok {
8066                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8067                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8068                         }
8069                 } else {
8070                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8071                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8072                         }
8073                 }
8074         }
8075 }
8076 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8077         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8078                 let contents = if o.result_ok {
8079                         let result = unsafe { o.contents.result };
8080                         unsafe { o.contents.result = std::ptr::null_mut() };
8081                         CResult_PrivateRouteCreationErrorZPtr { result }
8082                 } else {
8083                         let err = unsafe { o.contents.err };
8084                         unsafe { o.contents.err = std::ptr::null_mut(); }
8085                         CResult_PrivateRouteCreationErrorZPtr { err }
8086                 };
8087                 Self {
8088                         contents,
8089                         result_ok: o.result_ok,
8090                 }
8091         }
8092 }
8093 impl Clone for CResult_PrivateRouteCreationErrorZ {
8094         fn clone(&self) -> Self {
8095                 if self.result_ok {
8096                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
8097                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
8098                         } }
8099                 } else {
8100                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
8101                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8102                         } }
8103                 }
8104         }
8105 }
8106 #[no_mangle]
8107 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
8108 /// but with all dynamically-allocated buffers duplicated in new buffers.
8109 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
8110 #[repr(C)]
8111 /// The contents of CResult_StringErrorZ
8112 pub union CResult_StringErrorZPtr {
8113         /// A pointer to the contents in the success state.
8114         /// Reading from this pointer when `result_ok` is not set is undefined.
8115         pub result: *mut crate::c_types::Str,
8116         /// A pointer to the contents in the error state.
8117         /// Reading from this pointer when `result_ok` is set is undefined.
8118         pub err: *mut crate::c_types::Secp256k1Error,
8119 }
8120 #[repr(C)]
8121 /// A CResult_StringErrorZ represents the result of a fallible operation,
8122 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8123 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8124 pub struct CResult_StringErrorZ {
8125         /// The contents of this CResult_StringErrorZ, accessible via either
8126         /// `err` or `result` depending on the state of `result_ok`.
8127         pub contents: CResult_StringErrorZPtr,
8128         /// Whether this CResult_StringErrorZ represents a success state.
8129         pub result_ok: bool,
8130 }
8131 #[no_mangle]
8132 /// Creates a new CResult_StringErrorZ in the success state.
8133 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
8134         CResult_StringErrorZ {
8135                 contents: CResult_StringErrorZPtr {
8136                         result: Box::into_raw(Box::new(o)),
8137                 },
8138                 result_ok: true,
8139         }
8140 }
8141 #[no_mangle]
8142 /// Creates a new CResult_StringErrorZ in the error state.
8143 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
8144         CResult_StringErrorZ {
8145                 contents: CResult_StringErrorZPtr {
8146                         err: Box::into_raw(Box::new(e)),
8147                 },
8148                 result_ok: false,
8149         }
8150 }
8151 /// Checks if the given object is currently in the success state
8152 #[no_mangle]
8153 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
8154         o.result_ok
8155 }
8156 #[no_mangle]
8157 /// Frees any resources used by the CResult_StringErrorZ.
8158 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
8159 impl Drop for CResult_StringErrorZ {
8160         fn drop(&mut self) {
8161                 if self.result_ok {
8162                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8163                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8164                         }
8165                 } else {
8166                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8167                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8168                         }
8169                 }
8170         }
8171 }
8172 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
8173         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
8174                 let contents = if o.result_ok {
8175                         let result = unsafe { o.contents.result };
8176                         unsafe { o.contents.result = std::ptr::null_mut() };
8177                         CResult_StringErrorZPtr { result }
8178                 } else {
8179                         let err = unsafe { o.contents.err };
8180                         unsafe { o.contents.err = std::ptr::null_mut(); }
8181                         CResult_StringErrorZPtr { err }
8182                 };
8183                 Self {
8184                         contents,
8185                         result_ok: o.result_ok,
8186                 }
8187         }
8188 }
8189 #[repr(C)]
8190 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8191 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8192         /// A pointer to the contents in the success state.
8193         /// Reading from this pointer when `result_ok` is not set is undefined.
8194         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
8195         /// A pointer to the contents in the error state.
8196         /// Reading from this pointer when `result_ok` is set is undefined.
8197         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8198 }
8199 #[repr(C)]
8200 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8201 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8203 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
8204         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8205         /// `err` or `result` depending on the state of `result_ok`.
8206         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
8207         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8208         pub result_ok: bool,
8209 }
8210 #[no_mangle]
8211 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
8212 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8213         CResult_ChannelMonitorUpdateDecodeErrorZ {
8214                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8215                         result: Box::into_raw(Box::new(o)),
8216                 },
8217                 result_ok: true,
8218         }
8219 }
8220 #[no_mangle]
8221 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
8222 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8223         CResult_ChannelMonitorUpdateDecodeErrorZ {
8224                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8225                         err: Box::into_raw(Box::new(e)),
8226                 },
8227                 result_ok: false,
8228         }
8229 }
8230 /// Checks if the given object is currently in the success state
8231 #[no_mangle]
8232 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
8233         o.result_ok
8234 }
8235 #[no_mangle]
8236 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
8237 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
8238 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
8239         fn drop(&mut self) {
8240                 if self.result_ok {
8241                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8242                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8243                         }
8244                 } else {
8245                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8246                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8247                         }
8248                 }
8249         }
8250 }
8251 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
8252         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8253                 let contents = if o.result_ok {
8254                         let result = unsafe { o.contents.result };
8255                         unsafe { o.contents.result = std::ptr::null_mut() };
8256                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
8257                 } else {
8258                         let err = unsafe { o.contents.err };
8259                         unsafe { o.contents.err = std::ptr::null_mut(); }
8260                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
8261                 };
8262                 Self {
8263                         contents,
8264                         result_ok: o.result_ok,
8265                 }
8266         }
8267 }
8268 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
8269         fn clone(&self) -> Self {
8270                 if self.result_ok {
8271                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8272                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
8273                         } }
8274                 } else {
8275                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8276                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8277                         } }
8278                 }
8279         }
8280 }
8281 #[no_mangle]
8282 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
8283 /// but with all dynamically-allocated buffers duplicated in new buffers.
8284 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
8285 #[repr(C)]
8286 #[derive(Clone)]
8287 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8288 pub enum COption_MonitorEventZ {
8289         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8290         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
8291         /// When we're in this state, this COption_MonitorEventZ contains nothing
8292         None
8293 }
8294 impl COption_MonitorEventZ {
8295         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8296                 if let Self::None = self { false } else { true }
8297         }
8298         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8299                 !self.is_some()
8300         }
8301         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
8302                 if let Self::Some(v) = self { v } else { unreachable!() }
8303         }
8304 }
8305 #[no_mangle]
8306 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
8307 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
8308         COption_MonitorEventZ::Some(o)
8309 }
8310 #[no_mangle]
8311 /// Constructs a new COption_MonitorEventZ containing nothing
8312 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
8313         COption_MonitorEventZ::None
8314 }
8315 #[no_mangle]
8316 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
8317 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
8318 #[no_mangle]
8319 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
8320 /// but with all dynamically-allocated buffers duplicated in new buffers.
8321 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
8322 #[repr(C)]
8323 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
8324 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
8325         /// A pointer to the contents in the success state.
8326         /// Reading from this pointer when `result_ok` is not set is undefined.
8327         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
8328         /// A pointer to the contents in the error state.
8329         /// Reading from this pointer when `result_ok` is set is undefined.
8330         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8331 }
8332 #[repr(C)]
8333 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8334 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8336 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
8337         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8338         /// `err` or `result` depending on the state of `result_ok`.
8339         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
8340         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8341         pub result_ok: bool,
8342 }
8343 #[no_mangle]
8344 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
8345 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
8346         CResult_COption_MonitorEventZDecodeErrorZ {
8347                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8348                         result: Box::into_raw(Box::new(o)),
8349                 },
8350                 result_ok: true,
8351         }
8352 }
8353 #[no_mangle]
8354 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
8355 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
8356         CResult_COption_MonitorEventZDecodeErrorZ {
8357                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8358                         err: Box::into_raw(Box::new(e)),
8359                 },
8360                 result_ok: false,
8361         }
8362 }
8363 /// Checks if the given object is currently in the success state
8364 #[no_mangle]
8365 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
8366         o.result_ok
8367 }
8368 #[no_mangle]
8369 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
8370 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
8371 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
8372         fn drop(&mut self) {
8373                 if self.result_ok {
8374                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8375                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8376                         }
8377                 } else {
8378                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8379                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8380                         }
8381                 }
8382         }
8383 }
8384 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
8385         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8386                 let contents = if o.result_ok {
8387                         let result = unsafe { o.contents.result };
8388                         unsafe { o.contents.result = std::ptr::null_mut() };
8389                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
8390                 } else {
8391                         let err = unsafe { o.contents.err };
8392                         unsafe { o.contents.err = std::ptr::null_mut(); }
8393                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
8394                 };
8395                 Self {
8396                         contents,
8397                         result_ok: o.result_ok,
8398                 }
8399         }
8400 }
8401 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
8402         fn clone(&self) -> Self {
8403                 if self.result_ok {
8404                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8405                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
8406                         } }
8407                 } else {
8408                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8409                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8410                         } }
8411                 }
8412         }
8413 }
8414 #[no_mangle]
8415 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
8416 /// but with all dynamically-allocated buffers duplicated in new buffers.
8417 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
8418 #[repr(C)]
8419 /// The contents of CResult_HTLCUpdateDecodeErrorZ
8420 pub union CResult_HTLCUpdateDecodeErrorZPtr {
8421         /// A pointer to the contents in the success state.
8422         /// Reading from this pointer when `result_ok` is not set is undefined.
8423         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
8424         /// A pointer to the contents in the error state.
8425         /// Reading from this pointer when `result_ok` is set is undefined.
8426         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8427 }
8428 #[repr(C)]
8429 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8430 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8432 pub struct CResult_HTLCUpdateDecodeErrorZ {
8433         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8434         /// `err` or `result` depending on the state of `result_ok`.
8435         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
8436         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8437         pub result_ok: bool,
8438 }
8439 #[no_mangle]
8440 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
8441 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
8442         CResult_HTLCUpdateDecodeErrorZ {
8443                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8444                         result: Box::into_raw(Box::new(o)),
8445                 },
8446                 result_ok: true,
8447         }
8448 }
8449 #[no_mangle]
8450 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
8451 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
8452         CResult_HTLCUpdateDecodeErrorZ {
8453                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8454                         err: Box::into_raw(Box::new(e)),
8455                 },
8456                 result_ok: false,
8457         }
8458 }
8459 /// Checks if the given object is currently in the success state
8460 #[no_mangle]
8461 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
8462         o.result_ok
8463 }
8464 #[no_mangle]
8465 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
8466 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
8467 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
8468         fn drop(&mut self) {
8469                 if self.result_ok {
8470                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8471                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8472                         }
8473                 } else {
8474                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8475                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8476                         }
8477                 }
8478         }
8479 }
8480 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
8481         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8482                 let contents = if o.result_ok {
8483                         let result = unsafe { o.contents.result };
8484                         unsafe { o.contents.result = std::ptr::null_mut() };
8485                         CResult_HTLCUpdateDecodeErrorZPtr { result }
8486                 } else {
8487                         let err = unsafe { o.contents.err };
8488                         unsafe { o.contents.err = std::ptr::null_mut(); }
8489                         CResult_HTLCUpdateDecodeErrorZPtr { err }
8490                 };
8491                 Self {
8492                         contents,
8493                         result_ok: o.result_ok,
8494                 }
8495         }
8496 }
8497 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
8498         fn clone(&self) -> Self {
8499                 if self.result_ok {
8500                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8501                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
8502                         } }
8503                 } else {
8504                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8505                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8506                         } }
8507                 }
8508         }
8509 }
8510 #[no_mangle]
8511 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8512 /// but with all dynamically-allocated buffers duplicated in new buffers.
8513 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
8514 #[repr(C)]
8515 /// A tuple of 2 elements. See the individual fields for the types contained.
8516 pub struct C2Tuple_OutPointScriptZ {
8517         /// The element at position 0
8518         pub a: crate::lightning::chain::transaction::OutPoint,
8519         /// The element at position 1
8520         pub b: crate::c_types::derived::CVec_u8Z,
8521 }
8522 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
8523         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
8524                 Self {
8525                         a: tup.0,
8526                         b: tup.1,
8527                 }
8528         }
8529 }
8530 impl C2Tuple_OutPointScriptZ {
8531         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
8532                 (self.a, self.b)
8533         }
8534 }
8535 impl Clone for C2Tuple_OutPointScriptZ {
8536         fn clone(&self) -> Self {
8537                 Self {
8538                         a: Clone::clone(&self.a),
8539                         b: Clone::clone(&self.b),
8540                 }
8541         }
8542 }
8543 #[no_mangle]
8544 /// Creates a new tuple which has the same data as `orig`
8545 /// but with all dynamically-allocated buffers duplicated in new buffers.
8546 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
8547 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8548 #[no_mangle]
8549 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
8550         C2Tuple_OutPointScriptZ { a, b, }
8551 }
8552
8553 #[no_mangle]
8554 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
8555 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
8556 #[repr(C)]
8557 /// A tuple of 2 elements. See the individual fields for the types contained.
8558 pub struct C2Tuple_u32ScriptZ {
8559         /// The element at position 0
8560         pub a: u32,
8561         /// The element at position 1
8562         pub b: crate::c_types::derived::CVec_u8Z,
8563 }
8564 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
8565         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
8566                 Self {
8567                         a: tup.0,
8568                         b: tup.1,
8569                 }
8570         }
8571 }
8572 impl C2Tuple_u32ScriptZ {
8573         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
8574                 (self.a, self.b)
8575         }
8576 }
8577 impl Clone for C2Tuple_u32ScriptZ {
8578         fn clone(&self) -> Self {
8579                 Self {
8580                         a: Clone::clone(&self.a),
8581                         b: Clone::clone(&self.b),
8582                 }
8583         }
8584 }
8585 #[no_mangle]
8586 /// Creates a new tuple which has the same data as `orig`
8587 /// but with all dynamically-allocated buffers duplicated in new buffers.
8588 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
8589 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
8590 #[no_mangle]
8591 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
8592         C2Tuple_u32ScriptZ { a, b, }
8593 }
8594
8595 #[no_mangle]
8596 /// Frees any resources used by the C2Tuple_u32ScriptZ.
8597 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
8598 #[repr(C)]
8599 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8600 /// This corresponds to std::vector in C++
8601 pub struct CVec_C2Tuple_u32ScriptZZ {
8602         /// The elements in the array.
8603         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8604         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
8605         /// The number of elements pointed to by `data`.
8606         pub datalen: usize
8607 }
8608 impl CVec_C2Tuple_u32ScriptZZ {
8609         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
8610                 if self.datalen == 0 { return Vec::new(); }
8611                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8612                 self.data = std::ptr::null_mut();
8613                 self.datalen = 0;
8614                 ret
8615         }
8616         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
8617                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8618         }
8619 }
8620 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
8621         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
8622                 let datalen = v.len();
8623                 let data = Box::into_raw(v.into_boxed_slice());
8624                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8625         }
8626 }
8627 #[no_mangle]
8628 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8629 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
8630 impl Drop for CVec_C2Tuple_u32ScriptZZ {
8631         fn drop(&mut self) {
8632                 if self.datalen == 0 { return; }
8633                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8634         }
8635 }
8636 impl Clone for CVec_C2Tuple_u32ScriptZZ {
8637         fn clone(&self) -> Self {
8638                 let mut res = Vec::new();
8639                 if self.datalen == 0 { return Self::from(res); }
8640                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8641                 Self::from(res)
8642         }
8643 }
8644 #[repr(C)]
8645 /// A tuple of 2 elements. See the individual fields for the types contained.
8646 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8647         /// The element at position 0
8648         pub a: crate::c_types::ThirtyTwoBytes,
8649         /// The element at position 1
8650         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
8651 }
8652 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8653         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
8654                 Self {
8655                         a: tup.0,
8656                         b: tup.1,
8657                 }
8658         }
8659 }
8660 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8661         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
8662                 (self.a, self.b)
8663         }
8664 }
8665 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8666         fn clone(&self) -> Self {
8667                 Self {
8668                         a: Clone::clone(&self.a),
8669                         b: Clone::clone(&self.b),
8670                 }
8671         }
8672 }
8673 #[no_mangle]
8674 /// Creates a new tuple which has the same data as `orig`
8675 /// but with all dynamically-allocated buffers duplicated in new buffers.
8676 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
8677 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8678 #[no_mangle]
8679 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 {
8680         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
8681 }
8682
8683 #[no_mangle]
8684 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8685 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
8686 #[repr(C)]
8687 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8688 /// This corresponds to std::vector in C++
8689 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8690         /// The elements in the array.
8691         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8692         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
8693         /// The number of elements pointed to by `data`.
8694         pub datalen: usize
8695 }
8696 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8697         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
8698                 if self.datalen == 0 { return Vec::new(); }
8699                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8700                 self.data = std::ptr::null_mut();
8701                 self.datalen = 0;
8702                 ret
8703         }
8704         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
8705                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8706         }
8707 }
8708 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8709         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
8710                 let datalen = v.len();
8711                 let data = Box::into_raw(v.into_boxed_slice());
8712                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8713         }
8714 }
8715 #[no_mangle]
8716 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8717 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
8718 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8719         fn drop(&mut self) {
8720                 if self.datalen == 0 { return; }
8721                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8722         }
8723 }
8724 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8725         fn clone(&self) -> Self {
8726                 let mut res = Vec::new();
8727                 if self.datalen == 0 { return Self::from(res); }
8728                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8729                 Self::from(res)
8730         }
8731 }
8732 #[repr(C)]
8733 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8734 /// This corresponds to std::vector in C++
8735 pub struct CVec_EventZ {
8736         /// The elements in the array.
8737         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8738         pub data: *mut crate::lightning::util::events::Event,
8739         /// The number of elements pointed to by `data`.
8740         pub datalen: usize
8741 }
8742 impl CVec_EventZ {
8743         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
8744                 if self.datalen == 0 { return Vec::new(); }
8745                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8746                 self.data = std::ptr::null_mut();
8747                 self.datalen = 0;
8748                 ret
8749         }
8750         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
8751                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8752         }
8753 }
8754 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
8755         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
8756                 let datalen = v.len();
8757                 let data = Box::into_raw(v.into_boxed_slice());
8758                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8759         }
8760 }
8761 #[no_mangle]
8762 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8763 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
8764 impl Drop for CVec_EventZ {
8765         fn drop(&mut self) {
8766                 if self.datalen == 0 { return; }
8767                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8768         }
8769 }
8770 impl Clone for CVec_EventZ {
8771         fn clone(&self) -> Self {
8772                 let mut res = Vec::new();
8773                 if self.datalen == 0 { return Self::from(res); }
8774                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8775                 Self::from(res)
8776         }
8777 }
8778 #[repr(C)]
8779 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8780 /// This corresponds to std::vector in C++
8781 pub struct CVec_TransactionZ {
8782         /// The elements in the array.
8783         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8784         pub data: *mut crate::c_types::Transaction,
8785         /// The number of elements pointed to by `data`.
8786         pub datalen: usize
8787 }
8788 impl CVec_TransactionZ {
8789         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
8790                 if self.datalen == 0 { return Vec::new(); }
8791                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8792                 self.data = std::ptr::null_mut();
8793                 self.datalen = 0;
8794                 ret
8795         }
8796         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
8797                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8798         }
8799 }
8800 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
8801         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
8802                 let datalen = v.len();
8803                 let data = Box::into_raw(v.into_boxed_slice());
8804                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8805         }
8806 }
8807 #[no_mangle]
8808 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8809 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
8810 impl Drop for CVec_TransactionZ {
8811         fn drop(&mut self) {
8812                 if self.datalen == 0 { return; }
8813                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8814         }
8815 }
8816 impl Clone for CVec_TransactionZ {
8817         fn clone(&self) -> Self {
8818                 let mut res = Vec::new();
8819                 if self.datalen == 0 { return Self::from(res); }
8820                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8821                 Self::from(res)
8822         }
8823 }
8824 #[repr(C)]
8825 /// A tuple of 2 elements. See the individual fields for the types contained.
8826 pub struct C2Tuple_u32TxOutZ {
8827         /// The element at position 0
8828         pub a: u32,
8829         /// The element at position 1
8830         pub b: crate::c_types::TxOut,
8831 }
8832 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
8833         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
8834                 Self {
8835                         a: tup.0,
8836                         b: tup.1,
8837                 }
8838         }
8839 }
8840 impl C2Tuple_u32TxOutZ {
8841         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
8842                 (self.a, self.b)
8843         }
8844 }
8845 impl Clone for C2Tuple_u32TxOutZ {
8846         fn clone(&self) -> Self {
8847                 Self {
8848                         a: Clone::clone(&self.a),
8849                         b: Clone::clone(&self.b),
8850                 }
8851         }
8852 }
8853 #[no_mangle]
8854 /// Creates a new tuple which has the same data as `orig`
8855 /// but with all dynamically-allocated buffers duplicated in new buffers.
8856 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
8857 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
8858 #[no_mangle]
8859 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
8860         C2Tuple_u32TxOutZ { a, b, }
8861 }
8862
8863 #[no_mangle]
8864 /// Frees any resources used by the C2Tuple_u32TxOutZ.
8865 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
8866 #[repr(C)]
8867 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8868 /// This corresponds to std::vector in C++
8869 pub struct CVec_C2Tuple_u32TxOutZZ {
8870         /// The elements in the array.
8871         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8872         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
8873         /// The number of elements pointed to by `data`.
8874         pub datalen: usize
8875 }
8876 impl CVec_C2Tuple_u32TxOutZZ {
8877         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
8878                 if self.datalen == 0 { return Vec::new(); }
8879                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8880                 self.data = std::ptr::null_mut();
8881                 self.datalen = 0;
8882                 ret
8883         }
8884         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
8885                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8886         }
8887 }
8888 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
8889         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
8890                 let datalen = v.len();
8891                 let data = Box::into_raw(v.into_boxed_slice());
8892                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8893         }
8894 }
8895 #[no_mangle]
8896 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8897 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
8898 impl Drop for CVec_C2Tuple_u32TxOutZZ {
8899         fn drop(&mut self) {
8900                 if self.datalen == 0 { return; }
8901                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8902         }
8903 }
8904 impl Clone for CVec_C2Tuple_u32TxOutZZ {
8905         fn clone(&self) -> Self {
8906                 let mut res = Vec::new();
8907                 if self.datalen == 0 { return Self::from(res); }
8908                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8909                 Self::from(res)
8910         }
8911 }
8912 #[repr(C)]
8913 /// A tuple of 2 elements. See the individual fields for the types contained.
8914 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8915         /// The element at position 0
8916         pub a: crate::c_types::ThirtyTwoBytes,
8917         /// The element at position 1
8918         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
8919 }
8920 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8921         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
8922                 Self {
8923                         a: tup.0,
8924                         b: tup.1,
8925                 }
8926         }
8927 }
8928 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8929         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
8930                 (self.a, self.b)
8931         }
8932 }
8933 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8934         fn clone(&self) -> Self {
8935                 Self {
8936                         a: Clone::clone(&self.a),
8937                         b: Clone::clone(&self.b),
8938                 }
8939         }
8940 }
8941 #[no_mangle]
8942 /// Creates a new tuple which has the same data as `orig`
8943 /// but with all dynamically-allocated buffers duplicated in new buffers.
8944 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
8945 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8946 #[no_mangle]
8947 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 {
8948         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
8949 }
8950
8951 #[no_mangle]
8952 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8953 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
8954 #[repr(C)]
8955 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8956 /// This corresponds to std::vector in C++
8957 pub struct CVec_TransactionOutputsZ {
8958         /// The elements in the array.
8959         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8960         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
8961         /// The number of elements pointed to by `data`.
8962         pub datalen: usize
8963 }
8964 impl CVec_TransactionOutputsZ {
8965         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
8966                 if self.datalen == 0 { return Vec::new(); }
8967                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8968                 self.data = std::ptr::null_mut();
8969                 self.datalen = 0;
8970                 ret
8971         }
8972         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
8973                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8974         }
8975 }
8976 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
8977         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
8978                 let datalen = v.len();
8979                 let data = Box::into_raw(v.into_boxed_slice());
8980                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8981         }
8982 }
8983 #[no_mangle]
8984 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8985 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
8986 impl Drop for CVec_TransactionOutputsZ {
8987         fn drop(&mut self) {
8988                 if self.datalen == 0 { return; }
8989                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8990         }
8991 }
8992 impl Clone for CVec_TransactionOutputsZ {
8993         fn clone(&self) -> Self {
8994                 let mut res = Vec::new();
8995                 if self.datalen == 0 { return Self::from(res); }
8996                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8997                 Self::from(res)
8998         }
8999 }
9000 #[repr(C)]
9001 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9002 /// This corresponds to std::vector in C++
9003 pub struct CVec_BalanceZ {
9004         /// The elements in the array.
9005         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9006         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9007         /// The number of elements pointed to by `data`.
9008         pub datalen: usize
9009 }
9010 impl CVec_BalanceZ {
9011         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9012                 if self.datalen == 0 { return Vec::new(); }
9013                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9014                 self.data = std::ptr::null_mut();
9015                 self.datalen = 0;
9016                 ret
9017         }
9018         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9019                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9020         }
9021 }
9022 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9023         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9024                 let datalen = v.len();
9025                 let data = Box::into_raw(v.into_boxed_slice());
9026                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9027         }
9028 }
9029 #[no_mangle]
9030 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9031 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9032 impl Drop for CVec_BalanceZ {
9033         fn drop(&mut self) {
9034                 if self.datalen == 0 { return; }
9035                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9036         }
9037 }
9038 impl Clone for CVec_BalanceZ {
9039         fn clone(&self) -> Self {
9040                 let mut res = Vec::new();
9041                 if self.datalen == 0 { return Self::from(res); }
9042                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9043                 Self::from(res)
9044         }
9045 }
9046 #[repr(C)]
9047 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9048 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9049         /// A pointer to the contents in the success state.
9050         /// Reading from this pointer when `result_ok` is not set is undefined.
9051         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9052         /// A pointer to the contents in the error state.
9053         /// Reading from this pointer when `result_ok` is set is undefined.
9054         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9055 }
9056 #[repr(C)]
9057 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9058 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9060 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9061         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9062         /// `err` or `result` depending on the state of `result_ok`.
9063         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9064         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9065         pub result_ok: bool,
9066 }
9067 #[no_mangle]
9068 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9069 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9070         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9071                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9072                         result: Box::into_raw(Box::new(o)),
9073                 },
9074                 result_ok: true,
9075         }
9076 }
9077 #[no_mangle]
9078 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9079 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9080         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9081                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9082                         err: Box::into_raw(Box::new(e)),
9083                 },
9084                 result_ok: false,
9085         }
9086 }
9087 /// Checks if the given object is currently in the success state
9088 #[no_mangle]
9089 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
9090         o.result_ok
9091 }
9092 #[no_mangle]
9093 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9094 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
9095 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9096         fn drop(&mut self) {
9097                 if self.result_ok {
9098                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9099                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9100                         }
9101                 } else {
9102                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9103                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9104                         }
9105                 }
9106         }
9107 }
9108 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9109         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9110                 let contents = if o.result_ok {
9111                         let result = unsafe { o.contents.result };
9112                         unsafe { o.contents.result = std::ptr::null_mut() };
9113                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
9114                 } else {
9115                         let err = unsafe { o.contents.err };
9116                         unsafe { o.contents.err = std::ptr::null_mut(); }
9117                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
9118                 };
9119                 Self {
9120                         contents,
9121                         result_ok: o.result_ok,
9122                 }
9123         }
9124 }
9125 #[repr(C)]
9126 /// The contents of CResult_NoneLightningErrorZ
9127 pub union CResult_NoneLightningErrorZPtr {
9128         /// Note that this value is always NULL, as there are no contents in the OK variant
9129         pub result: *mut std::ffi::c_void,
9130         /// A pointer to the contents in the error state.
9131         /// Reading from this pointer when `result_ok` is set is undefined.
9132         pub err: *mut crate::lightning::ln::msgs::LightningError,
9133 }
9134 #[repr(C)]
9135 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
9136 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
9137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9138 pub struct CResult_NoneLightningErrorZ {
9139         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
9140         /// `err` or `result` depending on the state of `result_ok`.
9141         pub contents: CResult_NoneLightningErrorZPtr,
9142         /// Whether this CResult_NoneLightningErrorZ represents a success state.
9143         pub result_ok: bool,
9144 }
9145 #[no_mangle]
9146 /// Creates a new CResult_NoneLightningErrorZ in the success state.
9147 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
9148         CResult_NoneLightningErrorZ {
9149                 contents: CResult_NoneLightningErrorZPtr {
9150                         result: std::ptr::null_mut(),
9151                 },
9152                 result_ok: true,
9153         }
9154 }
9155 #[no_mangle]
9156 /// Creates a new CResult_NoneLightningErrorZ in the error state.
9157 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
9158         CResult_NoneLightningErrorZ {
9159                 contents: CResult_NoneLightningErrorZPtr {
9160                         err: Box::into_raw(Box::new(e)),
9161                 },
9162                 result_ok: false,
9163         }
9164 }
9165 /// Checks if the given object is currently in the success state
9166 #[no_mangle]
9167 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
9168         o.result_ok
9169 }
9170 #[no_mangle]
9171 /// Frees any resources used by the CResult_NoneLightningErrorZ.
9172 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
9173 impl Drop for CResult_NoneLightningErrorZ {
9174         fn drop(&mut self) {
9175                 if self.result_ok {
9176                 } else {
9177                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9178                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9179                         }
9180                 }
9181         }
9182 }
9183 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
9184         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
9185                 let contents = if o.result_ok {
9186                         let _ = unsafe { Box::from_raw(o.contents.result) };
9187                         o.contents.result = std::ptr::null_mut();
9188                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
9189                 } else {
9190                         let err = unsafe { o.contents.err };
9191                         unsafe { o.contents.err = std::ptr::null_mut(); }
9192                         CResult_NoneLightningErrorZPtr { err }
9193                 };
9194                 Self {
9195                         contents,
9196                         result_ok: o.result_ok,
9197                 }
9198         }
9199 }
9200 impl Clone for CResult_NoneLightningErrorZ {
9201         fn clone(&self) -> Self {
9202                 if self.result_ok {
9203                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
9204                                 result: std::ptr::null_mut()
9205                         } }
9206                 } else {
9207                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
9208                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9209                         } }
9210                 }
9211         }
9212 }
9213 #[no_mangle]
9214 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9215 /// but with all dynamically-allocated buffers duplicated in new buffers.
9216 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
9217 #[repr(C)]
9218 /// A tuple of 2 elements. See the individual fields for the types contained.
9219 pub struct C2Tuple_PublicKeyTypeZ {
9220         /// The element at position 0
9221         pub a: crate::c_types::PublicKey,
9222         /// The element at position 1
9223         pub b: crate::lightning::ln::wire::Type,
9224 }
9225 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
9226         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
9227                 Self {
9228                         a: tup.0,
9229                         b: tup.1,
9230                 }
9231         }
9232 }
9233 impl C2Tuple_PublicKeyTypeZ {
9234         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
9235                 (self.a, self.b)
9236         }
9237 }
9238 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
9239 #[no_mangle]
9240 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
9241         C2Tuple_PublicKeyTypeZ { a, b, }
9242 }
9243
9244 #[no_mangle]
9245 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
9246 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
9247 #[repr(C)]
9248 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9249 /// This corresponds to std::vector in C++
9250 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
9251         /// The elements in the array.
9252         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9253         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
9254         /// The number of elements pointed to by `data`.
9255         pub datalen: usize
9256 }
9257 impl CVec_C2Tuple_PublicKeyTypeZZ {
9258         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
9259                 if self.datalen == 0 { return Vec::new(); }
9260                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9261                 self.data = std::ptr::null_mut();
9262                 self.datalen = 0;
9263                 ret
9264         }
9265         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
9266                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9267         }
9268 }
9269 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
9270         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
9271                 let datalen = v.len();
9272                 let data = Box::into_raw(v.into_boxed_slice());
9273                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9274         }
9275 }
9276 #[no_mangle]
9277 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9278 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
9279 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
9280         fn drop(&mut self) {
9281                 if self.datalen == 0 { return; }
9282                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9283         }
9284 }
9285 #[repr(C)]
9286 /// The contents of CResult_boolLightningErrorZ
9287 pub union CResult_boolLightningErrorZPtr {
9288         /// A pointer to the contents in the success state.
9289         /// Reading from this pointer when `result_ok` is not set is undefined.
9290         pub result: *mut bool,
9291         /// A pointer to the contents in the error state.
9292         /// Reading from this pointer when `result_ok` is set is undefined.
9293         pub err: *mut crate::lightning::ln::msgs::LightningError,
9294 }
9295 #[repr(C)]
9296 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
9297 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
9298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9299 pub struct CResult_boolLightningErrorZ {
9300         /// The contents of this CResult_boolLightningErrorZ, accessible via either
9301         /// `err` or `result` depending on the state of `result_ok`.
9302         pub contents: CResult_boolLightningErrorZPtr,
9303         /// Whether this CResult_boolLightningErrorZ represents a success state.
9304         pub result_ok: bool,
9305 }
9306 #[no_mangle]
9307 /// Creates a new CResult_boolLightningErrorZ in the success state.
9308 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
9309         CResult_boolLightningErrorZ {
9310                 contents: CResult_boolLightningErrorZPtr {
9311                         result: Box::into_raw(Box::new(o)),
9312                 },
9313                 result_ok: true,
9314         }
9315 }
9316 #[no_mangle]
9317 /// Creates a new CResult_boolLightningErrorZ in the error state.
9318 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
9319         CResult_boolLightningErrorZ {
9320                 contents: CResult_boolLightningErrorZPtr {
9321                         err: Box::into_raw(Box::new(e)),
9322                 },
9323                 result_ok: false,
9324         }
9325 }
9326 /// Checks if the given object is currently in the success state
9327 #[no_mangle]
9328 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
9329         o.result_ok
9330 }
9331 #[no_mangle]
9332 /// Frees any resources used by the CResult_boolLightningErrorZ.
9333 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
9334 impl Drop for CResult_boolLightningErrorZ {
9335         fn drop(&mut self) {
9336                 if self.result_ok {
9337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9339                         }
9340                 } else {
9341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9343                         }
9344                 }
9345         }
9346 }
9347 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
9348         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
9349                 let contents = if o.result_ok {
9350                         let result = unsafe { o.contents.result };
9351                         unsafe { o.contents.result = std::ptr::null_mut() };
9352                         CResult_boolLightningErrorZPtr { result }
9353                 } else {
9354                         let err = unsafe { o.contents.err };
9355                         unsafe { o.contents.err = std::ptr::null_mut(); }
9356                         CResult_boolLightningErrorZPtr { err }
9357                 };
9358                 Self {
9359                         contents,
9360                         result_ok: o.result_ok,
9361                 }
9362         }
9363 }
9364 impl Clone for CResult_boolLightningErrorZ {
9365         fn clone(&self) -> Self {
9366                 if self.result_ok {
9367                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
9368                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9369                         } }
9370                 } else {
9371                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
9372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9373                         } }
9374                 }
9375         }
9376 }
9377 #[no_mangle]
9378 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9379 /// but with all dynamically-allocated buffers duplicated in new buffers.
9380 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
9381 #[repr(C)]
9382 /// A tuple of 3 elements. See the individual fields for the types contained.
9383 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9384         /// The element at position 0
9385         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
9386         /// The element at position 1
9387         pub b: crate::lightning::ln::msgs::ChannelUpdate,
9388         /// The element at position 2
9389         pub c: crate::lightning::ln::msgs::ChannelUpdate,
9390 }
9391 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9392         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
9393                 Self {
9394                         a: tup.0,
9395                         b: tup.1,
9396                         c: tup.2,
9397                 }
9398         }
9399 }
9400 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9401         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
9402                 (self.a, self.b, self.c)
9403         }
9404 }
9405 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9406         fn clone(&self) -> Self {
9407                 Self {
9408                         a: Clone::clone(&self.a),
9409                         b: Clone::clone(&self.b),
9410                         c: Clone::clone(&self.c),
9411                 }
9412         }
9413 }
9414 #[no_mangle]
9415 /// Creates a new tuple which has the same data as `orig`
9416 /// but with all dynamically-allocated buffers duplicated in new buffers.
9417 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
9418 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9419 #[no_mangle]
9420 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 {
9421         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
9422 }
9423
9424 #[no_mangle]
9425 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9426 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
9427 #[repr(C)]
9428 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
9429 /// This corresponds to std::vector in C++
9430 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9431         /// The elements in the array.
9432         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9433         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
9434         /// The number of elements pointed to by `data`.
9435         pub datalen: usize
9436 }
9437 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9438         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
9439                 if self.datalen == 0 { return Vec::new(); }
9440                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9441                 self.data = std::ptr::null_mut();
9442                 self.datalen = 0;
9443                 ret
9444         }
9445         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
9446                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9447         }
9448 }
9449 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9450         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
9451                 let datalen = v.len();
9452                 let data = Box::into_raw(v.into_boxed_slice());
9453                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9454         }
9455 }
9456 #[no_mangle]
9457 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9458 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
9459 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9460         fn drop(&mut self) {
9461                 if self.datalen == 0 { return; }
9462                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9463         }
9464 }
9465 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9466         fn clone(&self) -> Self {
9467                 let mut res = Vec::new();
9468                 if self.datalen == 0 { return Self::from(res); }
9469                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9470                 Self::from(res)
9471         }
9472 }
9473 #[repr(C)]
9474 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
9475 /// This corresponds to std::vector in C++
9476 pub struct CVec_NodeAnnouncementZ {
9477         /// The elements in the array.
9478         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9479         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
9480         /// The number of elements pointed to by `data`.
9481         pub datalen: usize
9482 }
9483 impl CVec_NodeAnnouncementZ {
9484         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
9485                 if self.datalen == 0 { return Vec::new(); }
9486                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9487                 self.data = std::ptr::null_mut();
9488                 self.datalen = 0;
9489                 ret
9490         }
9491         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
9492                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9493         }
9494 }
9495 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
9496         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
9497                 let datalen = v.len();
9498                 let data = Box::into_raw(v.into_boxed_slice());
9499                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9500         }
9501 }
9502 #[no_mangle]
9503 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9504 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
9505 impl Drop for CVec_NodeAnnouncementZ {
9506         fn drop(&mut self) {
9507                 if self.datalen == 0 { return; }
9508                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9509         }
9510 }
9511 impl Clone for CVec_NodeAnnouncementZ {
9512         fn clone(&self) -> Self {
9513                 let mut res = Vec::new();
9514                 if self.datalen == 0 { return Self::from(res); }
9515                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9516                 Self::from(res)
9517         }
9518 }
9519 #[repr(C)]
9520 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
9521 /// This corresponds to std::vector in C++
9522 pub struct CVec_PublicKeyZ {
9523         /// The elements in the array.
9524         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9525         pub data: *mut crate::c_types::PublicKey,
9526         /// The number of elements pointed to by `data`.
9527         pub datalen: usize
9528 }
9529 impl CVec_PublicKeyZ {
9530         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
9531                 if self.datalen == 0 { return Vec::new(); }
9532                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9533                 self.data = std::ptr::null_mut();
9534                 self.datalen = 0;
9535                 ret
9536         }
9537         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
9538                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9539         }
9540 }
9541 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
9542         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
9543                 let datalen = v.len();
9544                 let data = Box::into_raw(v.into_boxed_slice());
9545                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9546         }
9547 }
9548 #[no_mangle]
9549 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9550 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
9551 impl Drop for CVec_PublicKeyZ {
9552         fn drop(&mut self) {
9553                 if self.datalen == 0 { return; }
9554                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9555         }
9556 }
9557 impl Clone for CVec_PublicKeyZ {
9558         fn clone(&self) -> Self {
9559                 let mut res = Vec::new();
9560                 if self.datalen == 0 { return Self::from(res); }
9561                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9562                 Self::from(res)
9563         }
9564 }
9565 #[repr(C)]
9566 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
9567 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
9568         /// A pointer to the contents in the success state.
9569         /// Reading from this pointer when `result_ok` is not set is undefined.
9570         pub result: *mut crate::c_types::derived::CVec_u8Z,
9571         /// A pointer to the contents in the error state.
9572         /// Reading from this pointer when `result_ok` is set is undefined.
9573         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9574 }
9575 #[repr(C)]
9576 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9577 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9579 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
9580         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9581         /// `err` or `result` depending on the state of `result_ok`.
9582         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
9583         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9584         pub result_ok: bool,
9585 }
9586 #[no_mangle]
9587 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9588 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
9589         CResult_CVec_u8ZPeerHandleErrorZ {
9590                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9591                         result: Box::into_raw(Box::new(o)),
9592                 },
9593                 result_ok: true,
9594         }
9595 }
9596 #[no_mangle]
9597 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9598 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
9599         CResult_CVec_u8ZPeerHandleErrorZ {
9600                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9601                         err: Box::into_raw(Box::new(e)),
9602                 },
9603                 result_ok: false,
9604         }
9605 }
9606 /// Checks if the given object is currently in the success state
9607 #[no_mangle]
9608 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
9609         o.result_ok
9610 }
9611 #[no_mangle]
9612 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9613 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
9614 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
9615         fn drop(&mut self) {
9616                 if self.result_ok {
9617                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9618                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9619                         }
9620                 } else {
9621                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9622                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9623                         }
9624                 }
9625         }
9626 }
9627 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
9628         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9629                 let contents = if o.result_ok {
9630                         let result = unsafe { o.contents.result };
9631                         unsafe { o.contents.result = std::ptr::null_mut() };
9632                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
9633                 } else {
9634                         let err = unsafe { o.contents.err };
9635                         unsafe { o.contents.err = std::ptr::null_mut(); }
9636                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
9637                 };
9638                 Self {
9639                         contents,
9640                         result_ok: o.result_ok,
9641                 }
9642         }
9643 }
9644 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
9645         fn clone(&self) -> Self {
9646                 if self.result_ok {
9647                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9648                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
9649                         } }
9650                 } else {
9651                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9652                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9653                         } }
9654                 }
9655         }
9656 }
9657 #[no_mangle]
9658 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9659 /// but with all dynamically-allocated buffers duplicated in new buffers.
9660 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
9661 #[repr(C)]
9662 /// The contents of CResult_NonePeerHandleErrorZ
9663 pub union CResult_NonePeerHandleErrorZPtr {
9664         /// Note that this value is always NULL, as there are no contents in the OK variant
9665         pub result: *mut std::ffi::c_void,
9666         /// A pointer to the contents in the error state.
9667         /// Reading from this pointer when `result_ok` is set is undefined.
9668         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9669 }
9670 #[repr(C)]
9671 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9672 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9673 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9674 pub struct CResult_NonePeerHandleErrorZ {
9675         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9676         /// `err` or `result` depending on the state of `result_ok`.
9677         pub contents: CResult_NonePeerHandleErrorZPtr,
9678         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
9679         pub result_ok: bool,
9680 }
9681 #[no_mangle]
9682 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
9683 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
9684         CResult_NonePeerHandleErrorZ {
9685                 contents: CResult_NonePeerHandleErrorZPtr {
9686                         result: std::ptr::null_mut(),
9687                 },
9688                 result_ok: true,
9689         }
9690 }
9691 #[no_mangle]
9692 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
9693 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
9694         CResult_NonePeerHandleErrorZ {
9695                 contents: CResult_NonePeerHandleErrorZPtr {
9696                         err: Box::into_raw(Box::new(e)),
9697                 },
9698                 result_ok: false,
9699         }
9700 }
9701 /// Checks if the given object is currently in the success state
9702 #[no_mangle]
9703 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
9704         o.result_ok
9705 }
9706 #[no_mangle]
9707 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
9708 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
9709 impl Drop for CResult_NonePeerHandleErrorZ {
9710         fn drop(&mut self) {
9711                 if self.result_ok {
9712                 } else {
9713                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9714                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9715                         }
9716                 }
9717         }
9718 }
9719 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
9720         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9721                 let contents = if o.result_ok {
9722                         let _ = unsafe { Box::from_raw(o.contents.result) };
9723                         o.contents.result = std::ptr::null_mut();
9724                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
9725                 } else {
9726                         let err = unsafe { o.contents.err };
9727                         unsafe { o.contents.err = std::ptr::null_mut(); }
9728                         CResult_NonePeerHandleErrorZPtr { err }
9729                 };
9730                 Self {
9731                         contents,
9732                         result_ok: o.result_ok,
9733                 }
9734         }
9735 }
9736 impl Clone for CResult_NonePeerHandleErrorZ {
9737         fn clone(&self) -> Self {
9738                 if self.result_ok {
9739                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
9740                                 result: std::ptr::null_mut()
9741                         } }
9742                 } else {
9743                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
9744                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9745                         } }
9746                 }
9747         }
9748 }
9749 #[no_mangle]
9750 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9751 /// but with all dynamically-allocated buffers duplicated in new buffers.
9752 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
9753 #[repr(C)]
9754 /// The contents of CResult_boolPeerHandleErrorZ
9755 pub union CResult_boolPeerHandleErrorZPtr {
9756         /// A pointer to the contents in the success state.
9757         /// Reading from this pointer when `result_ok` is not set is undefined.
9758         pub result: *mut bool,
9759         /// A pointer to the contents in the error state.
9760         /// Reading from this pointer when `result_ok` is set is undefined.
9761         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9762 }
9763 #[repr(C)]
9764 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9765 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9767 pub struct CResult_boolPeerHandleErrorZ {
9768         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9769         /// `err` or `result` depending on the state of `result_ok`.
9770         pub contents: CResult_boolPeerHandleErrorZPtr,
9771         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
9772         pub result_ok: bool,
9773 }
9774 #[no_mangle]
9775 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
9776 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
9777         CResult_boolPeerHandleErrorZ {
9778                 contents: CResult_boolPeerHandleErrorZPtr {
9779                         result: Box::into_raw(Box::new(o)),
9780                 },
9781                 result_ok: true,
9782         }
9783 }
9784 #[no_mangle]
9785 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
9786 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
9787         CResult_boolPeerHandleErrorZ {
9788                 contents: CResult_boolPeerHandleErrorZPtr {
9789                         err: Box::into_raw(Box::new(e)),
9790                 },
9791                 result_ok: false,
9792         }
9793 }
9794 /// Checks if the given object is currently in the success state
9795 #[no_mangle]
9796 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
9797         o.result_ok
9798 }
9799 #[no_mangle]
9800 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
9801 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
9802 impl Drop for CResult_boolPeerHandleErrorZ {
9803         fn drop(&mut self) {
9804                 if self.result_ok {
9805                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9806                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9807                         }
9808                 } else {
9809                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9810                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9811                         }
9812                 }
9813         }
9814 }
9815 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
9816         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9817                 let contents = if o.result_ok {
9818                         let result = unsafe { o.contents.result };
9819                         unsafe { o.contents.result = std::ptr::null_mut() };
9820                         CResult_boolPeerHandleErrorZPtr { result }
9821                 } else {
9822                         let err = unsafe { o.contents.err };
9823                         unsafe { o.contents.err = std::ptr::null_mut(); }
9824                         CResult_boolPeerHandleErrorZPtr { err }
9825                 };
9826                 Self {
9827                         contents,
9828                         result_ok: o.result_ok,
9829                 }
9830         }
9831 }
9832 impl Clone for CResult_boolPeerHandleErrorZ {
9833         fn clone(&self) -> Self {
9834                 if self.result_ok {
9835                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
9836                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9837                         } }
9838                 } else {
9839                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
9840                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9841                         } }
9842                 }
9843         }
9844 }
9845 #[no_mangle]
9846 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9847 /// but with all dynamically-allocated buffers duplicated in new buffers.
9848 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
9849 #[repr(C)]
9850 /// The contents of CResult_NodeIdDecodeErrorZ
9851 pub union CResult_NodeIdDecodeErrorZPtr {
9852         /// A pointer to the contents in the success state.
9853         /// Reading from this pointer when `result_ok` is not set is undefined.
9854         pub result: *mut crate::lightning::routing::network_graph::NodeId,
9855         /// A pointer to the contents in the error state.
9856         /// Reading from this pointer when `result_ok` is set is undefined.
9857         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9858 }
9859 #[repr(C)]
9860 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
9861 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
9862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9863 pub struct CResult_NodeIdDecodeErrorZ {
9864         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
9865         /// `err` or `result` depending on the state of `result_ok`.
9866         pub contents: CResult_NodeIdDecodeErrorZPtr,
9867         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
9868         pub result_ok: bool,
9869 }
9870 #[no_mangle]
9871 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
9872 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
9873         CResult_NodeIdDecodeErrorZ {
9874                 contents: CResult_NodeIdDecodeErrorZPtr {
9875                         result: Box::into_raw(Box::new(o)),
9876                 },
9877                 result_ok: true,
9878         }
9879 }
9880 #[no_mangle]
9881 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
9882 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
9883         CResult_NodeIdDecodeErrorZ {
9884                 contents: CResult_NodeIdDecodeErrorZPtr {
9885                         err: Box::into_raw(Box::new(e)),
9886                 },
9887                 result_ok: false,
9888         }
9889 }
9890 /// Checks if the given object is currently in the success state
9891 #[no_mangle]
9892 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
9893         o.result_ok
9894 }
9895 #[no_mangle]
9896 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
9897 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
9898 impl Drop for CResult_NodeIdDecodeErrorZ {
9899         fn drop(&mut self) {
9900                 if self.result_ok {
9901                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9902                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9903                         }
9904                 } else {
9905                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9906                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9907                         }
9908                 }
9909         }
9910 }
9911 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
9912         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
9913                 let contents = if o.result_ok {
9914                         let result = unsafe { o.contents.result };
9915                         unsafe { o.contents.result = std::ptr::null_mut() };
9916                         CResult_NodeIdDecodeErrorZPtr { result }
9917                 } else {
9918                         let err = unsafe { o.contents.err };
9919                         unsafe { o.contents.err = std::ptr::null_mut(); }
9920                         CResult_NodeIdDecodeErrorZPtr { err }
9921                 };
9922                 Self {
9923                         contents,
9924                         result_ok: o.result_ok,
9925                 }
9926         }
9927 }
9928 impl Clone for CResult_NodeIdDecodeErrorZ {
9929         fn clone(&self) -> Self {
9930                 if self.result_ok {
9931                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
9932                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
9933                         } }
9934                 } else {
9935                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
9936                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9937                         } }
9938                 }
9939         }
9940 }
9941 #[no_mangle]
9942 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
9943 /// but with all dynamically-allocated buffers duplicated in new buffers.
9944 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
9945 #[repr(C)]
9946 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
9947 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9948         /// A pointer to the contents in the success state.
9949         /// Reading from this pointer when `result_ok` is not set is undefined.
9950         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
9951         /// A pointer to the contents in the error state.
9952         /// Reading from this pointer when `result_ok` is set is undefined.
9953         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9954 }
9955 #[repr(C)]
9956 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
9957 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9959 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
9960         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
9961         /// `err` or `result` depending on the state of `result_ok`.
9962         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
9963         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
9964         pub result_ok: bool,
9965 }
9966 #[no_mangle]
9967 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
9968 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9969         CResult_COption_NetworkUpdateZDecodeErrorZ {
9970                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9971                         result: Box::into_raw(Box::new(o)),
9972                 },
9973                 result_ok: true,
9974         }
9975 }
9976 #[no_mangle]
9977 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
9978 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9979         CResult_COption_NetworkUpdateZDecodeErrorZ {
9980                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9981                         err: Box::into_raw(Box::new(e)),
9982                 },
9983                 result_ok: false,
9984         }
9985 }
9986 /// Checks if the given object is currently in the success state
9987 #[no_mangle]
9988 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
9989         o.result_ok
9990 }
9991 #[no_mangle]
9992 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
9993 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
9994 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
9995         fn drop(&mut self) {
9996                 if self.result_ok {
9997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9999                         }
10000                 } else {
10001                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10002                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10003                         }
10004                 }
10005         }
10006 }
10007 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10008         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10009                 let contents = if o.result_ok {
10010                         let result = unsafe { o.contents.result };
10011                         unsafe { o.contents.result = std::ptr::null_mut() };
10012                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10013                 } else {
10014                         let err = unsafe { o.contents.err };
10015                         unsafe { o.contents.err = std::ptr::null_mut(); }
10016                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10017                 };
10018                 Self {
10019                         contents,
10020                         result_ok: o.result_ok,
10021                 }
10022         }
10023 }
10024 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10025         fn clone(&self) -> Self {
10026                 if self.result_ok {
10027                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10028                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10029                         } }
10030                 } else {
10031                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10032                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10033                         } }
10034                 }
10035         }
10036 }
10037 #[no_mangle]
10038 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10039 /// but with all dynamically-allocated buffers duplicated in new buffers.
10040 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10041 #[repr(C)]
10042 /// An enum which can either contain a crate::lightning::chain::Access or not
10043 pub enum COption_AccessZ {
10044         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
10045         Some(crate::lightning::chain::Access),
10046         /// When we're in this state, this COption_AccessZ contains nothing
10047         None
10048 }
10049 impl COption_AccessZ {
10050         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10051                 if let Self::None = self { false } else { true }
10052         }
10053         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10054                 !self.is_some()
10055         }
10056         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
10057                 if let Self::Some(v) = self { v } else { unreachable!() }
10058         }
10059 }
10060 #[no_mangle]
10061 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
10062 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
10063         COption_AccessZ::Some(o)
10064 }
10065 #[no_mangle]
10066 /// Constructs a new COption_AccessZ containing nothing
10067 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
10068         COption_AccessZ::None
10069 }
10070 #[no_mangle]
10071 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
10072 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
10073 #[repr(C)]
10074 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
10075 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
10076         /// A pointer to the contents in the success state.
10077         /// Reading from this pointer when `result_ok` is not set is undefined.
10078         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
10079         /// A pointer to the contents in the error state.
10080         /// Reading from this pointer when `result_ok` is set is undefined.
10081         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10082 }
10083 #[repr(C)]
10084 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
10085 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10087 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
10088         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
10089         /// `err` or `result` depending on the state of `result_ok`.
10090         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
10091         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
10092         pub result_ok: bool,
10093 }
10094 #[no_mangle]
10095 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10096 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10097         CResult_DirectionalChannelInfoDecodeErrorZ {
10098                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10099                         result: Box::into_raw(Box::new(o)),
10100                 },
10101                 result_ok: true,
10102         }
10103 }
10104 #[no_mangle]
10105 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10106 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10107         CResult_DirectionalChannelInfoDecodeErrorZ {
10108                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10109                         err: Box::into_raw(Box::new(e)),
10110                 },
10111                 result_ok: false,
10112         }
10113 }
10114 /// Checks if the given object is currently in the success state
10115 #[no_mangle]
10116 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o: &CResult_DirectionalChannelInfoDecodeErrorZ) -> bool {
10117         o.result_ok
10118 }
10119 #[no_mangle]
10120 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10121 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
10122 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
10123         fn drop(&mut self) {
10124                 if self.result_ok {
10125                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10126                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10127                         }
10128                 } else {
10129                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10130                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10131                         }
10132                 }
10133         }
10134 }
10135 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
10136         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10137                 let contents = if o.result_ok {
10138                         let result = unsafe { o.contents.result };
10139                         unsafe { o.contents.result = std::ptr::null_mut() };
10140                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
10141                 } else {
10142                         let err = unsafe { o.contents.err };
10143                         unsafe { o.contents.err = std::ptr::null_mut(); }
10144                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
10145                 };
10146                 Self {
10147                         contents,
10148                         result_ok: o.result_ok,
10149                 }
10150         }
10151 }
10152 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
10153         fn clone(&self) -> Self {
10154                 if self.result_ok {
10155                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10156                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
10157                         } }
10158                 } else {
10159                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10160                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10161                         } }
10162                 }
10163         }
10164 }
10165 #[no_mangle]
10166 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10167 /// but with all dynamically-allocated buffers duplicated in new buffers.
10168 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10169 #[repr(C)]
10170 /// The contents of CResult_ChannelInfoDecodeErrorZ
10171 pub union CResult_ChannelInfoDecodeErrorZPtr {
10172         /// A pointer to the contents in the success state.
10173         /// Reading from this pointer when `result_ok` is not set is undefined.
10174         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
10175         /// A pointer to the contents in the error state.
10176         /// Reading from this pointer when `result_ok` is set is undefined.
10177         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10178 }
10179 #[repr(C)]
10180 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
10181 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10183 pub struct CResult_ChannelInfoDecodeErrorZ {
10184         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
10185         /// `err` or `result` depending on the state of `result_ok`.
10186         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
10187         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
10188         pub result_ok: bool,
10189 }
10190 #[no_mangle]
10191 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10192 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
10193         CResult_ChannelInfoDecodeErrorZ {
10194                 contents: CResult_ChannelInfoDecodeErrorZPtr {
10195                         result: Box::into_raw(Box::new(o)),
10196                 },
10197                 result_ok: true,
10198         }
10199 }
10200 #[no_mangle]
10201 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10202 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
10203         CResult_ChannelInfoDecodeErrorZ {
10204                 contents: CResult_ChannelInfoDecodeErrorZPtr {
10205                         err: Box::into_raw(Box::new(e)),
10206                 },
10207                 result_ok: false,
10208         }
10209 }
10210 /// Checks if the given object is currently in the success state
10211 #[no_mangle]
10212 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
10213         o.result_ok
10214 }
10215 #[no_mangle]
10216 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10217 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
10218 impl Drop for CResult_ChannelInfoDecodeErrorZ {
10219         fn drop(&mut self) {
10220                 if self.result_ok {
10221                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10222                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10223                         }
10224                 } else {
10225                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10226                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10227                         }
10228                 }
10229         }
10230 }
10231 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
10232         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10233                 let contents = if o.result_ok {
10234                         let result = unsafe { o.contents.result };
10235                         unsafe { o.contents.result = std::ptr::null_mut() };
10236                         CResult_ChannelInfoDecodeErrorZPtr { result }
10237                 } else {
10238                         let err = unsafe { o.contents.err };
10239                         unsafe { o.contents.err = std::ptr::null_mut(); }
10240                         CResult_ChannelInfoDecodeErrorZPtr { err }
10241                 };
10242                 Self {
10243                         contents,
10244                         result_ok: o.result_ok,
10245                 }
10246         }
10247 }
10248 impl Clone for CResult_ChannelInfoDecodeErrorZ {
10249         fn clone(&self) -> Self {
10250                 if self.result_ok {
10251                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
10252                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
10253                         } }
10254                 } else {
10255                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
10256                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10257                         } }
10258                 }
10259         }
10260 }
10261 #[no_mangle]
10262 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10263 /// but with all dynamically-allocated buffers duplicated in new buffers.
10264 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10265 #[repr(C)]
10266 /// The contents of CResult_RoutingFeesDecodeErrorZ
10267 pub union CResult_RoutingFeesDecodeErrorZPtr {
10268         /// A pointer to the contents in the success state.
10269         /// Reading from this pointer when `result_ok` is not set is undefined.
10270         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
10271         /// A pointer to the contents in the error state.
10272         /// Reading from this pointer when `result_ok` is set is undefined.
10273         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10274 }
10275 #[repr(C)]
10276 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
10277 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
10278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10279 pub struct CResult_RoutingFeesDecodeErrorZ {
10280         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
10281         /// `err` or `result` depending on the state of `result_ok`.
10282         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
10283         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
10284         pub result_ok: bool,
10285 }
10286 #[no_mangle]
10287 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10288 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
10289         CResult_RoutingFeesDecodeErrorZ {
10290                 contents: CResult_RoutingFeesDecodeErrorZPtr {
10291                         result: Box::into_raw(Box::new(o)),
10292                 },
10293                 result_ok: true,
10294         }
10295 }
10296 #[no_mangle]
10297 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10298 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
10299         CResult_RoutingFeesDecodeErrorZ {
10300                 contents: CResult_RoutingFeesDecodeErrorZPtr {
10301                         err: Box::into_raw(Box::new(e)),
10302                 },
10303                 result_ok: false,
10304         }
10305 }
10306 /// Checks if the given object is currently in the success state
10307 #[no_mangle]
10308 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
10309         o.result_ok
10310 }
10311 #[no_mangle]
10312 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10313 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
10314 impl Drop for CResult_RoutingFeesDecodeErrorZ {
10315         fn drop(&mut self) {
10316                 if self.result_ok {
10317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10319                         }
10320                 } else {
10321                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10322                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10323                         }
10324                 }
10325         }
10326 }
10327 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
10328         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
10329                 let contents = if o.result_ok {
10330                         let result = unsafe { o.contents.result };
10331                         unsafe { o.contents.result = std::ptr::null_mut() };
10332                         CResult_RoutingFeesDecodeErrorZPtr { result }
10333                 } else {
10334                         let err = unsafe { o.contents.err };
10335                         unsafe { o.contents.err = std::ptr::null_mut(); }
10336                         CResult_RoutingFeesDecodeErrorZPtr { err }
10337                 };
10338                 Self {
10339                         contents,
10340                         result_ok: o.result_ok,
10341                 }
10342         }
10343 }
10344 impl Clone for CResult_RoutingFeesDecodeErrorZ {
10345         fn clone(&self) -> Self {
10346                 if self.result_ok {
10347                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
10348                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
10349                         } }
10350                 } else {
10351                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
10352                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10353                         } }
10354                 }
10355         }
10356 }
10357 #[no_mangle]
10358 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10359 /// but with all dynamically-allocated buffers duplicated in new buffers.
10360 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
10361 #[repr(C)]
10362 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
10363 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10364         /// A pointer to the contents in the success state.
10365         /// Reading from this pointer when `result_ok` is not set is undefined.
10366         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
10367         /// A pointer to the contents in the error state.
10368         /// Reading from this pointer when `result_ok` is set is undefined.
10369         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10370 }
10371 #[repr(C)]
10372 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
10373 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10375 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
10376         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
10377         /// `err` or `result` depending on the state of `result_ok`.
10378         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
10379         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
10380         pub result_ok: bool,
10381 }
10382 #[no_mangle]
10383 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10384 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10385         CResult_NodeAnnouncementInfoDecodeErrorZ {
10386                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10387                         result: Box::into_raw(Box::new(o)),
10388                 },
10389                 result_ok: true,
10390         }
10391 }
10392 #[no_mangle]
10393 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10394 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10395         CResult_NodeAnnouncementInfoDecodeErrorZ {
10396                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10397                         err: Box::into_raw(Box::new(e)),
10398                 },
10399                 result_ok: false,
10400         }
10401 }
10402 /// Checks if the given object is currently in the success state
10403 #[no_mangle]
10404 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
10405         o.result_ok
10406 }
10407 #[no_mangle]
10408 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10409 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
10410 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
10411         fn drop(&mut self) {
10412                 if self.result_ok {
10413                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10414                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10415                         }
10416                 } else {
10417                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10418                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10419                         }
10420                 }
10421         }
10422 }
10423 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
10424         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10425                 let contents = if o.result_ok {
10426                         let result = unsafe { o.contents.result };
10427                         unsafe { o.contents.result = std::ptr::null_mut() };
10428                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
10429                 } else {
10430                         let err = unsafe { o.contents.err };
10431                         unsafe { o.contents.err = std::ptr::null_mut(); }
10432                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
10433                 };
10434                 Self {
10435                         contents,
10436                         result_ok: o.result_ok,
10437                 }
10438         }
10439 }
10440 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
10441         fn clone(&self) -> Self {
10442                 if self.result_ok {
10443                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10444                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
10445                         } }
10446                 } else {
10447                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10448                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10449                         } }
10450                 }
10451         }
10452 }
10453 #[no_mangle]
10454 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10455 /// but with all dynamically-allocated buffers duplicated in new buffers.
10456 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
10457 #[repr(C)]
10458 /// A dynamically-allocated array of u64s of arbitrary size.
10459 /// This corresponds to std::vector in C++
10460 pub struct CVec_u64Z {
10461         /// The elements in the array.
10462         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10463         pub data: *mut u64,
10464         /// The number of elements pointed to by `data`.
10465         pub datalen: usize
10466 }
10467 impl CVec_u64Z {
10468         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
10469                 if self.datalen == 0 { return Vec::new(); }
10470                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10471                 self.data = std::ptr::null_mut();
10472                 self.datalen = 0;
10473                 ret
10474         }
10475         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
10476                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10477         }
10478 }
10479 impl From<Vec<u64>> for CVec_u64Z {
10480         fn from(v: Vec<u64>) -> Self {
10481                 let datalen = v.len();
10482                 let data = Box::into_raw(v.into_boxed_slice());
10483                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10484         }
10485 }
10486 #[no_mangle]
10487 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10488 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
10489 impl Drop for CVec_u64Z {
10490         fn drop(&mut self) {
10491                 if self.datalen == 0 { return; }
10492                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10493         }
10494 }
10495 impl Clone for CVec_u64Z {
10496         fn clone(&self) -> Self {
10497                 let mut res = Vec::new();
10498                 if self.datalen == 0 { return Self::from(res); }
10499                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10500                 Self::from(res)
10501         }
10502 }
10503 #[repr(C)]
10504 /// The contents of CResult_NodeInfoDecodeErrorZ
10505 pub union CResult_NodeInfoDecodeErrorZPtr {
10506         /// A pointer to the contents in the success state.
10507         /// Reading from this pointer when `result_ok` is not set is undefined.
10508         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
10509         /// A pointer to the contents in the error state.
10510         /// Reading from this pointer when `result_ok` is set is undefined.
10511         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10512 }
10513 #[repr(C)]
10514 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
10515 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10517 pub struct CResult_NodeInfoDecodeErrorZ {
10518         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
10519         /// `err` or `result` depending on the state of `result_ok`.
10520         pub contents: CResult_NodeInfoDecodeErrorZPtr,
10521         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
10522         pub result_ok: bool,
10523 }
10524 #[no_mangle]
10525 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10526 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
10527         CResult_NodeInfoDecodeErrorZ {
10528                 contents: CResult_NodeInfoDecodeErrorZPtr {
10529                         result: Box::into_raw(Box::new(o)),
10530                 },
10531                 result_ok: true,
10532         }
10533 }
10534 #[no_mangle]
10535 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10536 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
10537         CResult_NodeInfoDecodeErrorZ {
10538                 contents: CResult_NodeInfoDecodeErrorZPtr {
10539                         err: Box::into_raw(Box::new(e)),
10540                 },
10541                 result_ok: false,
10542         }
10543 }
10544 /// Checks if the given object is currently in the success state
10545 #[no_mangle]
10546 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
10547         o.result_ok
10548 }
10549 #[no_mangle]
10550 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10551 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
10552 impl Drop for CResult_NodeInfoDecodeErrorZ {
10553         fn drop(&mut self) {
10554                 if self.result_ok {
10555                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10556                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10557                         }
10558                 } else {
10559                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10560                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10561                         }
10562                 }
10563         }
10564 }
10565 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
10566         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10567                 let contents = if o.result_ok {
10568                         let result = unsafe { o.contents.result };
10569                         unsafe { o.contents.result = std::ptr::null_mut() };
10570                         CResult_NodeInfoDecodeErrorZPtr { result }
10571                 } else {
10572                         let err = unsafe { o.contents.err };
10573                         unsafe { o.contents.err = std::ptr::null_mut(); }
10574                         CResult_NodeInfoDecodeErrorZPtr { err }
10575                 };
10576                 Self {
10577                         contents,
10578                         result_ok: o.result_ok,
10579                 }
10580         }
10581 }
10582 impl Clone for CResult_NodeInfoDecodeErrorZ {
10583         fn clone(&self) -> Self {
10584                 if self.result_ok {
10585                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
10586                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
10587                         } }
10588                 } else {
10589                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
10590                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10591                         } }
10592                 }
10593         }
10594 }
10595 #[no_mangle]
10596 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10597 /// but with all dynamically-allocated buffers duplicated in new buffers.
10598 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
10599 #[repr(C)]
10600 /// The contents of CResult_NetworkGraphDecodeErrorZ
10601 pub union CResult_NetworkGraphDecodeErrorZPtr {
10602         /// A pointer to the contents in the success state.
10603         /// Reading from this pointer when `result_ok` is not set is undefined.
10604         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
10605         /// A pointer to the contents in the error state.
10606         /// Reading from this pointer when `result_ok` is set is undefined.
10607         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10608 }
10609 #[repr(C)]
10610 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
10611 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
10612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10613 pub struct CResult_NetworkGraphDecodeErrorZ {
10614         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
10615         /// `err` or `result` depending on the state of `result_ok`.
10616         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
10617         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
10618         pub result_ok: bool,
10619 }
10620 #[no_mangle]
10621 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10622 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
10623         CResult_NetworkGraphDecodeErrorZ {
10624                 contents: CResult_NetworkGraphDecodeErrorZPtr {
10625                         result: Box::into_raw(Box::new(o)),
10626                 },
10627                 result_ok: true,
10628         }
10629 }
10630 #[no_mangle]
10631 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10632 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
10633         CResult_NetworkGraphDecodeErrorZ {
10634                 contents: CResult_NetworkGraphDecodeErrorZPtr {
10635                         err: Box::into_raw(Box::new(e)),
10636                 },
10637                 result_ok: false,
10638         }
10639 }
10640 /// Checks if the given object is currently in the success state
10641 #[no_mangle]
10642 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
10643         o.result_ok
10644 }
10645 #[no_mangle]
10646 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10647 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
10648 impl Drop for CResult_NetworkGraphDecodeErrorZ {
10649         fn drop(&mut self) {
10650                 if self.result_ok {
10651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10653                         }
10654                 } else {
10655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10657                         }
10658                 }
10659         }
10660 }
10661 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
10662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
10663                 let contents = if o.result_ok {
10664                         let result = unsafe { o.contents.result };
10665                         unsafe { o.contents.result = std::ptr::null_mut() };
10666                         CResult_NetworkGraphDecodeErrorZPtr { result }
10667                 } else {
10668                         let err = unsafe { o.contents.err };
10669                         unsafe { o.contents.err = std::ptr::null_mut(); }
10670                         CResult_NetworkGraphDecodeErrorZPtr { err }
10671                 };
10672                 Self {
10673                         contents,
10674                         result_ok: o.result_ok,
10675                 }
10676         }
10677 }
10678 impl Clone for CResult_NetworkGraphDecodeErrorZ {
10679         fn clone(&self) -> Self {
10680                 if self.result_ok {
10681                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
10682                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
10683                         } }
10684                 } else {
10685                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
10686                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10687                         } }
10688                 }
10689         }
10690 }
10691 #[no_mangle]
10692 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10693 /// but with all dynamically-allocated buffers duplicated in new buffers.
10694 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
10695 #[repr(C)]
10696 #[derive(Clone)]
10697 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
10698 pub enum COption_CVec_NetAddressZZ {
10699         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
10700         Some(crate::c_types::derived::CVec_NetAddressZ),
10701         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
10702         None
10703 }
10704 impl COption_CVec_NetAddressZZ {
10705         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10706                 if let Self::None = self { false } else { true }
10707         }
10708         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10709                 !self.is_some()
10710         }
10711         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
10712                 if let Self::Some(v) = self { v } else { unreachable!() }
10713         }
10714 }
10715 #[no_mangle]
10716 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
10717 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
10718         COption_CVec_NetAddressZZ::Some(o)
10719 }
10720 #[no_mangle]
10721 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
10722 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
10723         COption_CVec_NetAddressZZ::None
10724 }
10725 #[no_mangle]
10726 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
10727 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
10728 #[no_mangle]
10729 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
10730 /// but with all dynamically-allocated buffers duplicated in new buffers.
10731 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
10732 #[repr(C)]
10733 /// The contents of CResult_NetAddressDecodeErrorZ
10734 pub union CResult_NetAddressDecodeErrorZPtr {
10735         /// A pointer to the contents in the success state.
10736         /// Reading from this pointer when `result_ok` is not set is undefined.
10737         pub result: *mut crate::lightning::ln::msgs::NetAddress,
10738         /// A pointer to the contents in the error state.
10739         /// Reading from this pointer when `result_ok` is set is undefined.
10740         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10741 }
10742 #[repr(C)]
10743 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10744 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10745 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10746 pub struct CResult_NetAddressDecodeErrorZ {
10747         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10748         /// `err` or `result` depending on the state of `result_ok`.
10749         pub contents: CResult_NetAddressDecodeErrorZPtr,
10750         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10751         pub result_ok: bool,
10752 }
10753 #[no_mangle]
10754 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10755 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
10756         CResult_NetAddressDecodeErrorZ {
10757                 contents: CResult_NetAddressDecodeErrorZPtr {
10758                         result: Box::into_raw(Box::new(o)),
10759                 },
10760                 result_ok: true,
10761         }
10762 }
10763 #[no_mangle]
10764 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10765 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
10766         CResult_NetAddressDecodeErrorZ {
10767                 contents: CResult_NetAddressDecodeErrorZPtr {
10768                         err: Box::into_raw(Box::new(e)),
10769                 },
10770                 result_ok: false,
10771         }
10772 }
10773 /// Checks if the given object is currently in the success state
10774 #[no_mangle]
10775 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
10776         o.result_ok
10777 }
10778 #[no_mangle]
10779 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10780 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
10781 impl Drop for CResult_NetAddressDecodeErrorZ {
10782         fn drop(&mut self) {
10783                 if self.result_ok {
10784                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10785                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10786                         }
10787                 } else {
10788                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10789                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10790                         }
10791                 }
10792         }
10793 }
10794 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
10795         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
10796                 let contents = if o.result_ok {
10797                         let result = unsafe { o.contents.result };
10798                         unsafe { o.contents.result = std::ptr::null_mut() };
10799                         CResult_NetAddressDecodeErrorZPtr { result }
10800                 } else {
10801                         let err = unsafe { o.contents.err };
10802                         unsafe { o.contents.err = std::ptr::null_mut(); }
10803                         CResult_NetAddressDecodeErrorZPtr { err }
10804                 };
10805                 Self {
10806                         contents,
10807                         result_ok: o.result_ok,
10808                 }
10809         }
10810 }
10811 impl Clone for CResult_NetAddressDecodeErrorZ {
10812         fn clone(&self) -> Self {
10813                 if self.result_ok {
10814                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
10815                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
10816                         } }
10817                 } else {
10818                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
10819                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10820                         } }
10821                 }
10822         }
10823 }
10824 #[no_mangle]
10825 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10826 /// but with all dynamically-allocated buffers duplicated in new buffers.
10827 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
10828 #[repr(C)]
10829 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10830 /// This corresponds to std::vector in C++
10831 pub struct CVec_UpdateAddHTLCZ {
10832         /// The elements in the array.
10833         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10834         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10835         /// The number of elements pointed to by `data`.
10836         pub datalen: usize
10837 }
10838 impl CVec_UpdateAddHTLCZ {
10839         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
10840                 if self.datalen == 0 { return Vec::new(); }
10841                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10842                 self.data = std::ptr::null_mut();
10843                 self.datalen = 0;
10844                 ret
10845         }
10846         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
10847                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10848         }
10849 }
10850 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
10851         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
10852                 let datalen = v.len();
10853                 let data = Box::into_raw(v.into_boxed_slice());
10854                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10855         }
10856 }
10857 #[no_mangle]
10858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10859 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
10860 impl Drop for CVec_UpdateAddHTLCZ {
10861         fn drop(&mut self) {
10862                 if self.datalen == 0 { return; }
10863                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10864         }
10865 }
10866 impl Clone for CVec_UpdateAddHTLCZ {
10867         fn clone(&self) -> Self {
10868                 let mut res = Vec::new();
10869                 if self.datalen == 0 { return Self::from(res); }
10870                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10871                 Self::from(res)
10872         }
10873 }
10874 #[repr(C)]
10875 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10876 /// This corresponds to std::vector in C++
10877 pub struct CVec_UpdateFulfillHTLCZ {
10878         /// The elements in the array.
10879         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10880         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10881         /// The number of elements pointed to by `data`.
10882         pub datalen: usize
10883 }
10884 impl CVec_UpdateFulfillHTLCZ {
10885         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
10886                 if self.datalen == 0 { return Vec::new(); }
10887                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10888                 self.data = std::ptr::null_mut();
10889                 self.datalen = 0;
10890                 ret
10891         }
10892         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
10893                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10894         }
10895 }
10896 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
10897         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
10898                 let datalen = v.len();
10899                 let data = Box::into_raw(v.into_boxed_slice());
10900                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10901         }
10902 }
10903 #[no_mangle]
10904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10905 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
10906 impl Drop for CVec_UpdateFulfillHTLCZ {
10907         fn drop(&mut self) {
10908                 if self.datalen == 0 { return; }
10909                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10910         }
10911 }
10912 impl Clone for CVec_UpdateFulfillHTLCZ {
10913         fn clone(&self) -> Self {
10914                 let mut res = Vec::new();
10915                 if self.datalen == 0 { return Self::from(res); }
10916                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10917                 Self::from(res)
10918         }
10919 }
10920 #[repr(C)]
10921 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10922 /// This corresponds to std::vector in C++
10923 pub struct CVec_UpdateFailHTLCZ {
10924         /// The elements in the array.
10925         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10926         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10927         /// The number of elements pointed to by `data`.
10928         pub datalen: usize
10929 }
10930 impl CVec_UpdateFailHTLCZ {
10931         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
10932                 if self.datalen == 0 { return Vec::new(); }
10933                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10934                 self.data = std::ptr::null_mut();
10935                 self.datalen = 0;
10936                 ret
10937         }
10938         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
10939                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10940         }
10941 }
10942 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
10943         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
10944                 let datalen = v.len();
10945                 let data = Box::into_raw(v.into_boxed_slice());
10946                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10947         }
10948 }
10949 #[no_mangle]
10950 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10951 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
10952 impl Drop for CVec_UpdateFailHTLCZ {
10953         fn drop(&mut self) {
10954                 if self.datalen == 0 { return; }
10955                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10956         }
10957 }
10958 impl Clone for CVec_UpdateFailHTLCZ {
10959         fn clone(&self) -> Self {
10960                 let mut res = Vec::new();
10961                 if self.datalen == 0 { return Self::from(res); }
10962                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10963                 Self::from(res)
10964         }
10965 }
10966 #[repr(C)]
10967 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10968 /// This corresponds to std::vector in C++
10969 pub struct CVec_UpdateFailMalformedHTLCZ {
10970         /// The elements in the array.
10971         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10972         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10973         /// The number of elements pointed to by `data`.
10974         pub datalen: usize
10975 }
10976 impl CVec_UpdateFailMalformedHTLCZ {
10977         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
10978                 if self.datalen == 0 { return Vec::new(); }
10979                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10980                 self.data = std::ptr::null_mut();
10981                 self.datalen = 0;
10982                 ret
10983         }
10984         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
10985                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10986         }
10987 }
10988 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
10989         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
10990                 let datalen = v.len();
10991                 let data = Box::into_raw(v.into_boxed_slice());
10992                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10993         }
10994 }
10995 #[no_mangle]
10996 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10997 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
10998 impl Drop for CVec_UpdateFailMalformedHTLCZ {
10999         fn drop(&mut self) {
11000                 if self.datalen == 0 { return; }
11001                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
11002         }
11003 }
11004 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11005         fn clone(&self) -> Self {
11006                 let mut res = Vec::new();
11007                 if self.datalen == 0 { return Self::from(res); }
11008                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
11009                 Self::from(res)
11010         }
11011 }
11012 #[repr(C)]
11013 /// The contents of CResult_AcceptChannelDecodeErrorZ
11014 pub union CResult_AcceptChannelDecodeErrorZPtr {
11015         /// A pointer to the contents in the success state.
11016         /// Reading from this pointer when `result_ok` is not set is undefined.
11017         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11018         /// A pointer to the contents in the error state.
11019         /// Reading from this pointer when `result_ok` is set is undefined.
11020         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11021 }
11022 #[repr(C)]
11023 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11024 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11025 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11026 pub struct CResult_AcceptChannelDecodeErrorZ {
11027         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11028         /// `err` or `result` depending on the state of `result_ok`.
11029         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11030         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11031         pub result_ok: bool,
11032 }
11033 #[no_mangle]
11034 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11035 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11036         CResult_AcceptChannelDecodeErrorZ {
11037                 contents: CResult_AcceptChannelDecodeErrorZPtr {
11038                         result: Box::into_raw(Box::new(o)),
11039                 },
11040                 result_ok: true,
11041         }
11042 }
11043 #[no_mangle]
11044 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11045 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
11046         CResult_AcceptChannelDecodeErrorZ {
11047                 contents: CResult_AcceptChannelDecodeErrorZPtr {
11048                         err: Box::into_raw(Box::new(e)),
11049                 },
11050                 result_ok: false,
11051         }
11052 }
11053 /// Checks if the given object is currently in the success state
11054 #[no_mangle]
11055 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
11056         o.result_ok
11057 }
11058 #[no_mangle]
11059 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11060 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
11061 impl Drop for CResult_AcceptChannelDecodeErrorZ {
11062         fn drop(&mut self) {
11063                 if self.result_ok {
11064                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11065                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11066                         }
11067                 } else {
11068                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11069                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11070                         }
11071                 }
11072         }
11073 }
11074 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
11075         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11076                 let contents = if o.result_ok {
11077                         let result = unsafe { o.contents.result };
11078                         unsafe { o.contents.result = std::ptr::null_mut() };
11079                         CResult_AcceptChannelDecodeErrorZPtr { result }
11080                 } else {
11081                         let err = unsafe { o.contents.err };
11082                         unsafe { o.contents.err = std::ptr::null_mut(); }
11083                         CResult_AcceptChannelDecodeErrorZPtr { err }
11084                 };
11085                 Self {
11086                         contents,
11087                         result_ok: o.result_ok,
11088                 }
11089         }
11090 }
11091 impl Clone for CResult_AcceptChannelDecodeErrorZ {
11092         fn clone(&self) -> Self {
11093                 if self.result_ok {
11094                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
11095                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
11096                         } }
11097                 } else {
11098                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
11099                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11100                         } }
11101                 }
11102         }
11103 }
11104 #[no_mangle]
11105 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11106 /// but with all dynamically-allocated buffers duplicated in new buffers.
11107 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
11108 #[repr(C)]
11109 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11110 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
11111         /// A pointer to the contents in the success state.
11112         /// Reading from this pointer when `result_ok` is not set is undefined.
11113         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
11114         /// A pointer to the contents in the error state.
11115         /// Reading from this pointer when `result_ok` is set is undefined.
11116         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11117 }
11118 #[repr(C)]
11119 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11120 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11122 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
11123         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11124         /// `err` or `result` depending on the state of `result_ok`.
11125         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
11126         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11127         pub result_ok: bool,
11128 }
11129 #[no_mangle]
11130 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11131 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11132         CResult_AnnouncementSignaturesDecodeErrorZ {
11133                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11134                         result: Box::into_raw(Box::new(o)),
11135                 },
11136                 result_ok: true,
11137         }
11138 }
11139 #[no_mangle]
11140 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11141 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11142         CResult_AnnouncementSignaturesDecodeErrorZ {
11143                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11144                         err: Box::into_raw(Box::new(e)),
11145                 },
11146                 result_ok: false,
11147         }
11148 }
11149 /// Checks if the given object is currently in the success state
11150 #[no_mangle]
11151 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
11152         o.result_ok
11153 }
11154 #[no_mangle]
11155 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
11156 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
11157 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
11158         fn drop(&mut self) {
11159                 if self.result_ok {
11160                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11161                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11162                         }
11163                 } else {
11164                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11165                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11166                         }
11167                 }
11168         }
11169 }
11170 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
11171         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
11172                 let contents = if o.result_ok {
11173                         let result = unsafe { o.contents.result };
11174                         unsafe { o.contents.result = std::ptr::null_mut() };
11175                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
11176                 } else {
11177                         let err = unsafe { o.contents.err };
11178                         unsafe { o.contents.err = std::ptr::null_mut(); }
11179                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
11180                 };
11181                 Self {
11182                         contents,
11183                         result_ok: o.result_ok,
11184                 }
11185         }
11186 }
11187 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
11188         fn clone(&self) -> Self {
11189                 if self.result_ok {
11190                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11191                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
11192                         } }
11193                 } else {
11194                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11195                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11196                         } }
11197                 }
11198         }
11199 }
11200 #[no_mangle]
11201 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
11202 /// but with all dynamically-allocated buffers duplicated in new buffers.
11203 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
11204 #[repr(C)]
11205 /// The contents of CResult_ChannelReestablishDecodeErrorZ
11206 pub union CResult_ChannelReestablishDecodeErrorZPtr {
11207         /// A pointer to the contents in the success state.
11208         /// Reading from this pointer when `result_ok` is not set is undefined.
11209         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
11210         /// A pointer to the contents in the error state.
11211         /// Reading from this pointer when `result_ok` is set is undefined.
11212         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11213 }
11214 #[repr(C)]
11215 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
11216 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
11217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11218 pub struct CResult_ChannelReestablishDecodeErrorZ {
11219         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
11220         /// `err` or `result` depending on the state of `result_ok`.
11221         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
11222         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
11223         pub result_ok: bool,
11224 }
11225 #[no_mangle]
11226 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
11227 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
11228         CResult_ChannelReestablishDecodeErrorZ {
11229                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11230                         result: Box::into_raw(Box::new(o)),
11231                 },
11232                 result_ok: true,
11233         }
11234 }
11235 #[no_mangle]
11236 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
11237 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
11238         CResult_ChannelReestablishDecodeErrorZ {
11239                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11240                         err: Box::into_raw(Box::new(e)),
11241                 },
11242                 result_ok: false,
11243         }
11244 }
11245 /// Checks if the given object is currently in the success state
11246 #[no_mangle]
11247 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
11248         o.result_ok
11249 }
11250 #[no_mangle]
11251 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
11252 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
11253 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
11254         fn drop(&mut self) {
11255                 if self.result_ok {
11256                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11257                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11258                         }
11259                 } else {
11260                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11261                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11262                         }
11263                 }
11264         }
11265 }
11266 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
11267         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
11268                 let contents = if o.result_ok {
11269                         let result = unsafe { o.contents.result };
11270                         unsafe { o.contents.result = std::ptr::null_mut() };
11271                         CResult_ChannelReestablishDecodeErrorZPtr { result }
11272                 } else {
11273                         let err = unsafe { o.contents.err };
11274                         unsafe { o.contents.err = std::ptr::null_mut(); }
11275                         CResult_ChannelReestablishDecodeErrorZPtr { err }
11276                 };
11277                 Self {
11278                         contents,
11279                         result_ok: o.result_ok,
11280                 }
11281         }
11282 }
11283 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
11284         fn clone(&self) -> Self {
11285                 if self.result_ok {
11286                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11287                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
11288                         } }
11289                 } else {
11290                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11291                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11292                         } }
11293                 }
11294         }
11295 }
11296 #[no_mangle]
11297 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
11298 /// but with all dynamically-allocated buffers duplicated in new buffers.
11299 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
11300 #[repr(C)]
11301 /// The contents of CResult_ClosingSignedDecodeErrorZ
11302 pub union CResult_ClosingSignedDecodeErrorZPtr {
11303         /// A pointer to the contents in the success state.
11304         /// Reading from this pointer when `result_ok` is not set is undefined.
11305         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
11306         /// A pointer to the contents in the error state.
11307         /// Reading from this pointer when `result_ok` is set is undefined.
11308         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11309 }
11310 #[repr(C)]
11311 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
11312 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11314 pub struct CResult_ClosingSignedDecodeErrorZ {
11315         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
11316         /// `err` or `result` depending on the state of `result_ok`.
11317         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
11318         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
11319         pub result_ok: bool,
11320 }
11321 #[no_mangle]
11322 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
11323 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
11324         CResult_ClosingSignedDecodeErrorZ {
11325                 contents: CResult_ClosingSignedDecodeErrorZPtr {
11326                         result: Box::into_raw(Box::new(o)),
11327                 },
11328                 result_ok: true,
11329         }
11330 }
11331 #[no_mangle]
11332 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
11333 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
11334         CResult_ClosingSignedDecodeErrorZ {
11335                 contents: CResult_ClosingSignedDecodeErrorZPtr {
11336                         err: Box::into_raw(Box::new(e)),
11337                 },
11338                 result_ok: false,
11339         }
11340 }
11341 /// Checks if the given object is currently in the success state
11342 #[no_mangle]
11343 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
11344         o.result_ok
11345 }
11346 #[no_mangle]
11347 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
11348 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
11349 impl Drop for CResult_ClosingSignedDecodeErrorZ {
11350         fn drop(&mut self) {
11351                 if self.result_ok {
11352                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11353                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11354                         }
11355                 } else {
11356                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11357                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11358                         }
11359                 }
11360         }
11361 }
11362 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
11363         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11364                 let contents = if o.result_ok {
11365                         let result = unsafe { o.contents.result };
11366                         unsafe { o.contents.result = std::ptr::null_mut() };
11367                         CResult_ClosingSignedDecodeErrorZPtr { result }
11368                 } else {
11369                         let err = unsafe { o.contents.err };
11370                         unsafe { o.contents.err = std::ptr::null_mut(); }
11371                         CResult_ClosingSignedDecodeErrorZPtr { err }
11372                 };
11373                 Self {
11374                         contents,
11375                         result_ok: o.result_ok,
11376                 }
11377         }
11378 }
11379 impl Clone for CResult_ClosingSignedDecodeErrorZ {
11380         fn clone(&self) -> Self {
11381                 if self.result_ok {
11382                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
11383                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
11384                         } }
11385                 } else {
11386                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
11387                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11388                         } }
11389                 }
11390         }
11391 }
11392 #[no_mangle]
11393 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
11394 /// but with all dynamically-allocated buffers duplicated in new buffers.
11395 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
11396 #[repr(C)]
11397 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
11398 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11399         /// A pointer to the contents in the success state.
11400         /// Reading from this pointer when `result_ok` is not set is undefined.
11401         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
11402         /// A pointer to the contents in the error state.
11403         /// Reading from this pointer when `result_ok` is set is undefined.
11404         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11405 }
11406 #[repr(C)]
11407 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
11408 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11410 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
11411         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11412         /// `err` or `result` depending on the state of `result_ok`.
11413         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
11414         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11415         pub result_ok: bool,
11416 }
11417 #[no_mangle]
11418 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
11419 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11420         CResult_ClosingSignedFeeRangeDecodeErrorZ {
11421                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11422                         result: Box::into_raw(Box::new(o)),
11423                 },
11424                 result_ok: true,
11425         }
11426 }
11427 #[no_mangle]
11428 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
11429 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11430         CResult_ClosingSignedFeeRangeDecodeErrorZ {
11431                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11432                         err: Box::into_raw(Box::new(e)),
11433                 },
11434                 result_ok: false,
11435         }
11436 }
11437 /// Checks if the given object is currently in the success state
11438 #[no_mangle]
11439 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
11440         o.result_ok
11441 }
11442 #[no_mangle]
11443 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
11444 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
11445 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11446         fn drop(&mut self) {
11447                 if self.result_ok {
11448                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11449                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11450                         }
11451                 } else {
11452                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11453                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11454                         }
11455                 }
11456         }
11457 }
11458 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11459         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11460                 let contents = if o.result_ok {
11461                         let result = unsafe { o.contents.result };
11462                         unsafe { o.contents.result = std::ptr::null_mut() };
11463                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
11464                 } else {
11465                         let err = unsafe { o.contents.err };
11466                         unsafe { o.contents.err = std::ptr::null_mut(); }
11467                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
11468                 };
11469                 Self {
11470                         contents,
11471                         result_ok: o.result_ok,
11472                 }
11473         }
11474 }
11475 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11476         fn clone(&self) -> Self {
11477                 if self.result_ok {
11478                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11479                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
11480                         } }
11481                 } else {
11482                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11483                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11484                         } }
11485                 }
11486         }
11487 }
11488 #[no_mangle]
11489 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
11490 /// but with all dynamically-allocated buffers duplicated in new buffers.
11491 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
11492 #[repr(C)]
11493 /// The contents of CResult_CommitmentSignedDecodeErrorZ
11494 pub union CResult_CommitmentSignedDecodeErrorZPtr {
11495         /// A pointer to the contents in the success state.
11496         /// Reading from this pointer when `result_ok` is not set is undefined.
11497         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
11498         /// A pointer to the contents in the error state.
11499         /// Reading from this pointer when `result_ok` is set is undefined.
11500         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11501 }
11502 #[repr(C)]
11503 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11504 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11506 pub struct CResult_CommitmentSignedDecodeErrorZ {
11507         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11508         /// `err` or `result` depending on the state of `result_ok`.
11509         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
11510         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11511         pub result_ok: bool,
11512 }
11513 #[no_mangle]
11514 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11515 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
11516         CResult_CommitmentSignedDecodeErrorZ {
11517                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11518                         result: Box::into_raw(Box::new(o)),
11519                 },
11520                 result_ok: true,
11521         }
11522 }
11523 #[no_mangle]
11524 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11525 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
11526         CResult_CommitmentSignedDecodeErrorZ {
11527                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11528                         err: Box::into_raw(Box::new(e)),
11529                 },
11530                 result_ok: false,
11531         }
11532 }
11533 /// Checks if the given object is currently in the success state
11534 #[no_mangle]
11535 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
11536         o.result_ok
11537 }
11538 #[no_mangle]
11539 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11540 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
11541 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
11542         fn drop(&mut self) {
11543                 if self.result_ok {
11544                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11545                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11546                         }
11547                 } else {
11548                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11549                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11550                         }
11551                 }
11552         }
11553 }
11554 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
11555         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11556                 let contents = if o.result_ok {
11557                         let result = unsafe { o.contents.result };
11558                         unsafe { o.contents.result = std::ptr::null_mut() };
11559                         CResult_CommitmentSignedDecodeErrorZPtr { result }
11560                 } else {
11561                         let err = unsafe { o.contents.err };
11562                         unsafe { o.contents.err = std::ptr::null_mut(); }
11563                         CResult_CommitmentSignedDecodeErrorZPtr { err }
11564                 };
11565                 Self {
11566                         contents,
11567                         result_ok: o.result_ok,
11568                 }
11569         }
11570 }
11571 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
11572         fn clone(&self) -> Self {
11573                 if self.result_ok {
11574                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11575                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
11576                         } }
11577                 } else {
11578                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11579                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11580                         } }
11581                 }
11582         }
11583 }
11584 #[no_mangle]
11585 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11586 /// but with all dynamically-allocated buffers duplicated in new buffers.
11587 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
11588 #[repr(C)]
11589 /// The contents of CResult_FundingCreatedDecodeErrorZ
11590 pub union CResult_FundingCreatedDecodeErrorZPtr {
11591         /// A pointer to the contents in the success state.
11592         /// Reading from this pointer when `result_ok` is not set is undefined.
11593         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
11594         /// A pointer to the contents in the error state.
11595         /// Reading from this pointer when `result_ok` is set is undefined.
11596         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11597 }
11598 #[repr(C)]
11599 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11600 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11602 pub struct CResult_FundingCreatedDecodeErrorZ {
11603         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11604         /// `err` or `result` depending on the state of `result_ok`.
11605         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
11606         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11607         pub result_ok: bool,
11608 }
11609 #[no_mangle]
11610 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11611 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
11612         CResult_FundingCreatedDecodeErrorZ {
11613                 contents: CResult_FundingCreatedDecodeErrorZPtr {
11614                         result: Box::into_raw(Box::new(o)),
11615                 },
11616                 result_ok: true,
11617         }
11618 }
11619 #[no_mangle]
11620 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11621 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
11622         CResult_FundingCreatedDecodeErrorZ {
11623                 contents: CResult_FundingCreatedDecodeErrorZPtr {
11624                         err: Box::into_raw(Box::new(e)),
11625                 },
11626                 result_ok: false,
11627         }
11628 }
11629 /// Checks if the given object is currently in the success state
11630 #[no_mangle]
11631 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
11632         o.result_ok
11633 }
11634 #[no_mangle]
11635 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11636 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
11637 impl Drop for CResult_FundingCreatedDecodeErrorZ {
11638         fn drop(&mut self) {
11639                 if self.result_ok {
11640                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11641                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11642                         }
11643                 } else {
11644                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11645                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11646                         }
11647                 }
11648         }
11649 }
11650 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
11651         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
11652                 let contents = if o.result_ok {
11653                         let result = unsafe { o.contents.result };
11654                         unsafe { o.contents.result = std::ptr::null_mut() };
11655                         CResult_FundingCreatedDecodeErrorZPtr { result }
11656                 } else {
11657                         let err = unsafe { o.contents.err };
11658                         unsafe { o.contents.err = std::ptr::null_mut(); }
11659                         CResult_FundingCreatedDecodeErrorZPtr { err }
11660                 };
11661                 Self {
11662                         contents,
11663                         result_ok: o.result_ok,
11664                 }
11665         }
11666 }
11667 impl Clone for CResult_FundingCreatedDecodeErrorZ {
11668         fn clone(&self) -> Self {
11669                 if self.result_ok {
11670                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
11671                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
11672                         } }
11673                 } else {
11674                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
11675                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11676                         } }
11677                 }
11678         }
11679 }
11680 #[no_mangle]
11681 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11682 /// but with all dynamically-allocated buffers duplicated in new buffers.
11683 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
11684 #[repr(C)]
11685 /// The contents of CResult_FundingSignedDecodeErrorZ
11686 pub union CResult_FundingSignedDecodeErrorZPtr {
11687         /// A pointer to the contents in the success state.
11688         /// Reading from this pointer when `result_ok` is not set is undefined.
11689         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
11690         /// A pointer to the contents in the error state.
11691         /// Reading from this pointer when `result_ok` is set is undefined.
11692         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11693 }
11694 #[repr(C)]
11695 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11696 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11698 pub struct CResult_FundingSignedDecodeErrorZ {
11699         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11700         /// `err` or `result` depending on the state of `result_ok`.
11701         pub contents: CResult_FundingSignedDecodeErrorZPtr,
11702         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11703         pub result_ok: bool,
11704 }
11705 #[no_mangle]
11706 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11707 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
11708         CResult_FundingSignedDecodeErrorZ {
11709                 contents: CResult_FundingSignedDecodeErrorZPtr {
11710                         result: Box::into_raw(Box::new(o)),
11711                 },
11712                 result_ok: true,
11713         }
11714 }
11715 #[no_mangle]
11716 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11717 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
11718         CResult_FundingSignedDecodeErrorZ {
11719                 contents: CResult_FundingSignedDecodeErrorZPtr {
11720                         err: Box::into_raw(Box::new(e)),
11721                 },
11722                 result_ok: false,
11723         }
11724 }
11725 /// Checks if the given object is currently in the success state
11726 #[no_mangle]
11727 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
11728         o.result_ok
11729 }
11730 #[no_mangle]
11731 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11732 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
11733 impl Drop for CResult_FundingSignedDecodeErrorZ {
11734         fn drop(&mut self) {
11735                 if self.result_ok {
11736                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11737                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11738                         }
11739                 } else {
11740                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11741                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11742                         }
11743                 }
11744         }
11745 }
11746 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
11747         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11748                 let contents = if o.result_ok {
11749                         let result = unsafe { o.contents.result };
11750                         unsafe { o.contents.result = std::ptr::null_mut() };
11751                         CResult_FundingSignedDecodeErrorZPtr { result }
11752                 } else {
11753                         let err = unsafe { o.contents.err };
11754                         unsafe { o.contents.err = std::ptr::null_mut(); }
11755                         CResult_FundingSignedDecodeErrorZPtr { err }
11756                 };
11757                 Self {
11758                         contents,
11759                         result_ok: o.result_ok,
11760                 }
11761         }
11762 }
11763 impl Clone for CResult_FundingSignedDecodeErrorZ {
11764         fn clone(&self) -> Self {
11765                 if self.result_ok {
11766                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
11767                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
11768                         } }
11769                 } else {
11770                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
11771                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11772                         } }
11773                 }
11774         }
11775 }
11776 #[no_mangle]
11777 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11778 /// but with all dynamically-allocated buffers duplicated in new buffers.
11779 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
11780 #[repr(C)]
11781 /// The contents of CResult_FundingLockedDecodeErrorZ
11782 pub union CResult_FundingLockedDecodeErrorZPtr {
11783         /// A pointer to the contents in the success state.
11784         /// Reading from this pointer when `result_ok` is not set is undefined.
11785         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
11786         /// A pointer to the contents in the error state.
11787         /// Reading from this pointer when `result_ok` is set is undefined.
11788         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11789 }
11790 #[repr(C)]
11791 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
11792 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
11793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11794 pub struct CResult_FundingLockedDecodeErrorZ {
11795         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
11796         /// `err` or `result` depending on the state of `result_ok`.
11797         pub contents: CResult_FundingLockedDecodeErrorZPtr,
11798         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
11799         pub result_ok: bool,
11800 }
11801 #[no_mangle]
11802 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11803 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
11804         CResult_FundingLockedDecodeErrorZ {
11805                 contents: CResult_FundingLockedDecodeErrorZPtr {
11806                         result: Box::into_raw(Box::new(o)),
11807                 },
11808                 result_ok: true,
11809         }
11810 }
11811 #[no_mangle]
11812 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11813 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
11814         CResult_FundingLockedDecodeErrorZ {
11815                 contents: CResult_FundingLockedDecodeErrorZPtr {
11816                         err: Box::into_raw(Box::new(e)),
11817                 },
11818                 result_ok: false,
11819         }
11820 }
11821 /// Checks if the given object is currently in the success state
11822 #[no_mangle]
11823 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
11824         o.result_ok
11825 }
11826 #[no_mangle]
11827 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11828 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
11829 impl Drop for CResult_FundingLockedDecodeErrorZ {
11830         fn drop(&mut self) {
11831                 if self.result_ok {
11832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11834                         }
11835                 } else {
11836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11838                         }
11839                 }
11840         }
11841 }
11842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
11843         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
11844                 let contents = if o.result_ok {
11845                         let result = unsafe { o.contents.result };
11846                         unsafe { o.contents.result = std::ptr::null_mut() };
11847                         CResult_FundingLockedDecodeErrorZPtr { result }
11848                 } else {
11849                         let err = unsafe { o.contents.err };
11850                         unsafe { o.contents.err = std::ptr::null_mut(); }
11851                         CResult_FundingLockedDecodeErrorZPtr { err }
11852                 };
11853                 Self {
11854                         contents,
11855                         result_ok: o.result_ok,
11856                 }
11857         }
11858 }
11859 impl Clone for CResult_FundingLockedDecodeErrorZ {
11860         fn clone(&self) -> Self {
11861                 if self.result_ok {
11862                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
11863                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
11864                         } }
11865                 } else {
11866                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
11867                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11868                         } }
11869                 }
11870         }
11871 }
11872 #[no_mangle]
11873 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11874 /// but with all dynamically-allocated buffers duplicated in new buffers.
11875 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
11876 #[repr(C)]
11877 /// The contents of CResult_InitDecodeErrorZ
11878 pub union CResult_InitDecodeErrorZPtr {
11879         /// A pointer to the contents in the success state.
11880         /// Reading from this pointer when `result_ok` is not set is undefined.
11881         pub result: *mut crate::lightning::ln::msgs::Init,
11882         /// A pointer to the contents in the error state.
11883         /// Reading from this pointer when `result_ok` is set is undefined.
11884         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11885 }
11886 #[repr(C)]
11887 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11888 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11890 pub struct CResult_InitDecodeErrorZ {
11891         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
11892         /// `err` or `result` depending on the state of `result_ok`.
11893         pub contents: CResult_InitDecodeErrorZPtr,
11894         /// Whether this CResult_InitDecodeErrorZ represents a success state.
11895         pub result_ok: bool,
11896 }
11897 #[no_mangle]
11898 /// Creates a new CResult_InitDecodeErrorZ in the success state.
11899 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
11900         CResult_InitDecodeErrorZ {
11901                 contents: CResult_InitDecodeErrorZPtr {
11902                         result: Box::into_raw(Box::new(o)),
11903                 },
11904                 result_ok: true,
11905         }
11906 }
11907 #[no_mangle]
11908 /// Creates a new CResult_InitDecodeErrorZ in the error state.
11909 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
11910         CResult_InitDecodeErrorZ {
11911                 contents: CResult_InitDecodeErrorZPtr {
11912                         err: Box::into_raw(Box::new(e)),
11913                 },
11914                 result_ok: false,
11915         }
11916 }
11917 /// Checks if the given object is currently in the success state
11918 #[no_mangle]
11919 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
11920         o.result_ok
11921 }
11922 #[no_mangle]
11923 /// Frees any resources used by the CResult_InitDecodeErrorZ.
11924 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
11925 impl Drop for CResult_InitDecodeErrorZ {
11926         fn drop(&mut self) {
11927                 if self.result_ok {
11928                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11929                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11930                         }
11931                 } else {
11932                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11933                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11934                         }
11935                 }
11936         }
11937 }
11938 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
11939         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
11940                 let contents = if o.result_ok {
11941                         let result = unsafe { o.contents.result };
11942                         unsafe { o.contents.result = std::ptr::null_mut() };
11943                         CResult_InitDecodeErrorZPtr { result }
11944                 } else {
11945                         let err = unsafe { o.contents.err };
11946                         unsafe { o.contents.err = std::ptr::null_mut(); }
11947                         CResult_InitDecodeErrorZPtr { err }
11948                 };
11949                 Self {
11950                         contents,
11951                         result_ok: o.result_ok,
11952                 }
11953         }
11954 }
11955 impl Clone for CResult_InitDecodeErrorZ {
11956         fn clone(&self) -> Self {
11957                 if self.result_ok {
11958                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
11959                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
11960                         } }
11961                 } else {
11962                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
11963                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11964                         } }
11965                 }
11966         }
11967 }
11968 #[no_mangle]
11969 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11970 /// but with all dynamically-allocated buffers duplicated in new buffers.
11971 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
11972 #[repr(C)]
11973 /// The contents of CResult_OpenChannelDecodeErrorZ
11974 pub union CResult_OpenChannelDecodeErrorZPtr {
11975         /// A pointer to the contents in the success state.
11976         /// Reading from this pointer when `result_ok` is not set is undefined.
11977         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
11978         /// A pointer to the contents in the error state.
11979         /// Reading from this pointer when `result_ok` is set is undefined.
11980         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11981 }
11982 #[repr(C)]
11983 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11984 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11986 pub struct CResult_OpenChannelDecodeErrorZ {
11987         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11988         /// `err` or `result` depending on the state of `result_ok`.
11989         pub contents: CResult_OpenChannelDecodeErrorZPtr,
11990         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
11991         pub result_ok: bool,
11992 }
11993 #[no_mangle]
11994 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11995 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
11996         CResult_OpenChannelDecodeErrorZ {
11997                 contents: CResult_OpenChannelDecodeErrorZPtr {
11998                         result: Box::into_raw(Box::new(o)),
11999                 },
12000                 result_ok: true,
12001         }
12002 }
12003 #[no_mangle]
12004 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12005 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12006         CResult_OpenChannelDecodeErrorZ {
12007                 contents: CResult_OpenChannelDecodeErrorZPtr {
12008                         err: Box::into_raw(Box::new(e)),
12009                 },
12010                 result_ok: false,
12011         }
12012 }
12013 /// Checks if the given object is currently in the success state
12014 #[no_mangle]
12015 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12016         o.result_ok
12017 }
12018 #[no_mangle]
12019 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12020 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12021 impl Drop for CResult_OpenChannelDecodeErrorZ {
12022         fn drop(&mut self) {
12023                 if self.result_ok {
12024                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12025                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12026                         }
12027                 } else {
12028                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12029                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12030                         }
12031                 }
12032         }
12033 }
12034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12035         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12036                 let contents = if o.result_ok {
12037                         let result = unsafe { o.contents.result };
12038                         unsafe { o.contents.result = std::ptr::null_mut() };
12039                         CResult_OpenChannelDecodeErrorZPtr { result }
12040                 } else {
12041                         let err = unsafe { o.contents.err };
12042                         unsafe { o.contents.err = std::ptr::null_mut(); }
12043                         CResult_OpenChannelDecodeErrorZPtr { err }
12044                 };
12045                 Self {
12046                         contents,
12047                         result_ok: o.result_ok,
12048                 }
12049         }
12050 }
12051 impl Clone for CResult_OpenChannelDecodeErrorZ {
12052         fn clone(&self) -> Self {
12053                 if self.result_ok {
12054                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
12055                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
12056                         } }
12057                 } else {
12058                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
12059                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12060                         } }
12061                 }
12062         }
12063 }
12064 #[no_mangle]
12065 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12066 /// but with all dynamically-allocated buffers duplicated in new buffers.
12067 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
12068 #[repr(C)]
12069 /// The contents of CResult_RevokeAndACKDecodeErrorZ
12070 pub union CResult_RevokeAndACKDecodeErrorZPtr {
12071         /// A pointer to the contents in the success state.
12072         /// Reading from this pointer when `result_ok` is not set is undefined.
12073         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
12074         /// A pointer to the contents in the error state.
12075         /// Reading from this pointer when `result_ok` is set is undefined.
12076         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12077 }
12078 #[repr(C)]
12079 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
12080 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
12081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12082 pub struct CResult_RevokeAndACKDecodeErrorZ {
12083         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
12084         /// `err` or `result` depending on the state of `result_ok`.
12085         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
12086         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
12087         pub result_ok: bool,
12088 }
12089 #[no_mangle]
12090 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12091 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
12092         CResult_RevokeAndACKDecodeErrorZ {
12093                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12094                         result: Box::into_raw(Box::new(o)),
12095                 },
12096                 result_ok: true,
12097         }
12098 }
12099 #[no_mangle]
12100 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12101 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
12102         CResult_RevokeAndACKDecodeErrorZ {
12103                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12104                         err: Box::into_raw(Box::new(e)),
12105                 },
12106                 result_ok: false,
12107         }
12108 }
12109 /// Checks if the given object is currently in the success state
12110 #[no_mangle]
12111 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
12112         o.result_ok
12113 }
12114 #[no_mangle]
12115 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12116 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
12117 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
12118         fn drop(&mut self) {
12119                 if self.result_ok {
12120                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12121                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12122                         }
12123                 } else {
12124                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12125                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12126                         }
12127                 }
12128         }
12129 }
12130 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
12131         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
12132                 let contents = if o.result_ok {
12133                         let result = unsafe { o.contents.result };
12134                         unsafe { o.contents.result = std::ptr::null_mut() };
12135                         CResult_RevokeAndACKDecodeErrorZPtr { result }
12136                 } else {
12137                         let err = unsafe { o.contents.err };
12138                         unsafe { o.contents.err = std::ptr::null_mut(); }
12139                         CResult_RevokeAndACKDecodeErrorZPtr { err }
12140                 };
12141                 Self {
12142                         contents,
12143                         result_ok: o.result_ok,
12144                 }
12145         }
12146 }
12147 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
12148         fn clone(&self) -> Self {
12149                 if self.result_ok {
12150                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12151                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
12152                         } }
12153                 } else {
12154                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12155                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12156                         } }
12157                 }
12158         }
12159 }
12160 #[no_mangle]
12161 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
12162 /// but with all dynamically-allocated buffers duplicated in new buffers.
12163 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
12164 #[repr(C)]
12165 /// The contents of CResult_ShutdownDecodeErrorZ
12166 pub union CResult_ShutdownDecodeErrorZPtr {
12167         /// A pointer to the contents in the success state.
12168         /// Reading from this pointer when `result_ok` is not set is undefined.
12169         pub result: *mut crate::lightning::ln::msgs::Shutdown,
12170         /// A pointer to the contents in the error state.
12171         /// Reading from this pointer when `result_ok` is set is undefined.
12172         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12173 }
12174 #[repr(C)]
12175 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
12176 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
12177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12178 pub struct CResult_ShutdownDecodeErrorZ {
12179         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
12180         /// `err` or `result` depending on the state of `result_ok`.
12181         pub contents: CResult_ShutdownDecodeErrorZPtr,
12182         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
12183         pub result_ok: bool,
12184 }
12185 #[no_mangle]
12186 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
12187 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
12188         CResult_ShutdownDecodeErrorZ {
12189                 contents: CResult_ShutdownDecodeErrorZPtr {
12190                         result: Box::into_raw(Box::new(o)),
12191                 },
12192                 result_ok: true,
12193         }
12194 }
12195 #[no_mangle]
12196 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
12197 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
12198         CResult_ShutdownDecodeErrorZ {
12199                 contents: CResult_ShutdownDecodeErrorZPtr {
12200                         err: Box::into_raw(Box::new(e)),
12201                 },
12202                 result_ok: false,
12203         }
12204 }
12205 /// Checks if the given object is currently in the success state
12206 #[no_mangle]
12207 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
12208         o.result_ok
12209 }
12210 #[no_mangle]
12211 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
12212 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
12213 impl Drop for CResult_ShutdownDecodeErrorZ {
12214         fn drop(&mut self) {
12215                 if self.result_ok {
12216                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12217                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12218                         }
12219                 } else {
12220                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12221                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12222                         }
12223                 }
12224         }
12225 }
12226 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
12227         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
12228                 let contents = if o.result_ok {
12229                         let result = unsafe { o.contents.result };
12230                         unsafe { o.contents.result = std::ptr::null_mut() };
12231                         CResult_ShutdownDecodeErrorZPtr { result }
12232                 } else {
12233                         let err = unsafe { o.contents.err };
12234                         unsafe { o.contents.err = std::ptr::null_mut(); }
12235                         CResult_ShutdownDecodeErrorZPtr { err }
12236                 };
12237                 Self {
12238                         contents,
12239                         result_ok: o.result_ok,
12240                 }
12241         }
12242 }
12243 impl Clone for CResult_ShutdownDecodeErrorZ {
12244         fn clone(&self) -> Self {
12245                 if self.result_ok {
12246                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
12247                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
12248                         } }
12249                 } else {
12250                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
12251                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12252                         } }
12253                 }
12254         }
12255 }
12256 #[no_mangle]
12257 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
12258 /// but with all dynamically-allocated buffers duplicated in new buffers.
12259 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
12260 #[repr(C)]
12261 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
12262 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
12263         /// A pointer to the contents in the success state.
12264         /// Reading from this pointer when `result_ok` is not set is undefined.
12265         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12266         /// A pointer to the contents in the error state.
12267         /// Reading from this pointer when `result_ok` is set is undefined.
12268         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12269 }
12270 #[repr(C)]
12271 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
12272 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12274 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
12275         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
12276         /// `err` or `result` depending on the state of `result_ok`.
12277         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
12278         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
12279         pub result_ok: bool,
12280 }
12281 #[no_mangle]
12282 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
12283 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
12284         CResult_UpdateFailHTLCDecodeErrorZ {
12285                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12286                         result: Box::into_raw(Box::new(o)),
12287                 },
12288                 result_ok: true,
12289         }
12290 }
12291 #[no_mangle]
12292 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
12293 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
12294         CResult_UpdateFailHTLCDecodeErrorZ {
12295                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12296                         err: Box::into_raw(Box::new(e)),
12297                 },
12298                 result_ok: false,
12299         }
12300 }
12301 /// Checks if the given object is currently in the success state
12302 #[no_mangle]
12303 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
12304         o.result_ok
12305 }
12306 #[no_mangle]
12307 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
12308 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
12309 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
12310         fn drop(&mut self) {
12311                 if self.result_ok {
12312                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12313                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12314                         }
12315                 } else {
12316                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12317                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12318                         }
12319                 }
12320         }
12321 }
12322 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
12323         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12324                 let contents = if o.result_ok {
12325                         let result = unsafe { o.contents.result };
12326                         unsafe { o.contents.result = std::ptr::null_mut() };
12327                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
12328                 } else {
12329                         let err = unsafe { o.contents.err };
12330                         unsafe { o.contents.err = std::ptr::null_mut(); }
12331                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
12332                 };
12333                 Self {
12334                         contents,
12335                         result_ok: o.result_ok,
12336                 }
12337         }
12338 }
12339 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
12340         fn clone(&self) -> Self {
12341                 if self.result_ok {
12342                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12343                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
12344                         } }
12345                 } else {
12346                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12347                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12348                         } }
12349                 }
12350         }
12351 }
12352 #[no_mangle]
12353 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
12354 /// but with all dynamically-allocated buffers duplicated in new buffers.
12355 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
12356 #[repr(C)]
12357 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
12358 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12359         /// A pointer to the contents in the success state.
12360         /// Reading from this pointer when `result_ok` is not set is undefined.
12361         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12362         /// A pointer to the contents in the error state.
12363         /// Reading from this pointer when `result_ok` is set is undefined.
12364         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12365 }
12366 #[repr(C)]
12367 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
12368 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12370 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12371         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
12372         /// `err` or `result` depending on the state of `result_ok`.
12373         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
12374         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
12375         pub result_ok: bool,
12376 }
12377 #[no_mangle]
12378 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
12379 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12380         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12381                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12382                         result: Box::into_raw(Box::new(o)),
12383                 },
12384                 result_ok: true,
12385         }
12386 }
12387 #[no_mangle]
12388 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
12389 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12390         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12391                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12392                         err: Box::into_raw(Box::new(e)),
12393                 },
12394                 result_ok: false,
12395         }
12396 }
12397 /// Checks if the given object is currently in the success state
12398 #[no_mangle]
12399 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
12400         o.result_ok
12401 }
12402 #[no_mangle]
12403 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
12404 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
12405 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12406         fn drop(&mut self) {
12407                 if self.result_ok {
12408                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12409                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12410                         }
12411                 } else {
12412                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12413                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12414                         }
12415                 }
12416         }
12417 }
12418 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12419         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12420                 let contents = if o.result_ok {
12421                         let result = unsafe { o.contents.result };
12422                         unsafe { o.contents.result = std::ptr::null_mut() };
12423                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
12424                 } else {
12425                         let err = unsafe { o.contents.err };
12426                         unsafe { o.contents.err = std::ptr::null_mut(); }
12427                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
12428                 };
12429                 Self {
12430                         contents,
12431                         result_ok: o.result_ok,
12432                 }
12433         }
12434 }
12435 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12436         fn clone(&self) -> Self {
12437                 if self.result_ok {
12438                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12439                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
12440                         } }
12441                 } else {
12442                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12443                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12444                         } }
12445                 }
12446         }
12447 }
12448 #[no_mangle]
12449 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12450 /// but with all dynamically-allocated buffers duplicated in new buffers.
12451 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
12452 #[repr(C)]
12453 /// The contents of CResult_UpdateFeeDecodeErrorZ
12454 pub union CResult_UpdateFeeDecodeErrorZPtr {
12455         /// A pointer to the contents in the success state.
12456         /// Reading from this pointer when `result_ok` is not set is undefined.
12457         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
12458         /// A pointer to the contents in the error state.
12459         /// Reading from this pointer when `result_ok` is set is undefined.
12460         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12461 }
12462 #[repr(C)]
12463 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12464 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
12465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12466 pub struct CResult_UpdateFeeDecodeErrorZ {
12467         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12468         /// `err` or `result` depending on the state of `result_ok`.
12469         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
12470         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12471         pub result_ok: bool,
12472 }
12473 #[no_mangle]
12474 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12475 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
12476         CResult_UpdateFeeDecodeErrorZ {
12477                 contents: CResult_UpdateFeeDecodeErrorZPtr {
12478                         result: Box::into_raw(Box::new(o)),
12479                 },
12480                 result_ok: true,
12481         }
12482 }
12483 #[no_mangle]
12484 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12485 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
12486         CResult_UpdateFeeDecodeErrorZ {
12487                 contents: CResult_UpdateFeeDecodeErrorZPtr {
12488                         err: Box::into_raw(Box::new(e)),
12489                 },
12490                 result_ok: false,
12491         }
12492 }
12493 /// Checks if the given object is currently in the success state
12494 #[no_mangle]
12495 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
12496         o.result_ok
12497 }
12498 #[no_mangle]
12499 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12500 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
12501 impl Drop for CResult_UpdateFeeDecodeErrorZ {
12502         fn drop(&mut self) {
12503                 if self.result_ok {
12504                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12505                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12506                         }
12507                 } else {
12508                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12509                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12510                         }
12511                 }
12512         }
12513 }
12514 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
12515         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
12516                 let contents = if o.result_ok {
12517                         let result = unsafe { o.contents.result };
12518                         unsafe { o.contents.result = std::ptr::null_mut() };
12519                         CResult_UpdateFeeDecodeErrorZPtr { result }
12520                 } else {
12521                         let err = unsafe { o.contents.err };
12522                         unsafe { o.contents.err = std::ptr::null_mut(); }
12523                         CResult_UpdateFeeDecodeErrorZPtr { err }
12524                 };
12525                 Self {
12526                         contents,
12527                         result_ok: o.result_ok,
12528                 }
12529         }
12530 }
12531 impl Clone for CResult_UpdateFeeDecodeErrorZ {
12532         fn clone(&self) -> Self {
12533                 if self.result_ok {
12534                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
12535                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
12536                         } }
12537                 } else {
12538                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
12539                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12540                         } }
12541                 }
12542         }
12543 }
12544 #[no_mangle]
12545 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12546 /// but with all dynamically-allocated buffers duplicated in new buffers.
12547 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
12548 #[repr(C)]
12549 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12550 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12551         /// A pointer to the contents in the success state.
12552         /// Reading from this pointer when `result_ok` is not set is undefined.
12553         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12554         /// A pointer to the contents in the error state.
12555         /// Reading from this pointer when `result_ok` is set is undefined.
12556         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12557 }
12558 #[repr(C)]
12559 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12560 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12561 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12562 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
12563         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12564         /// `err` or `result` depending on the state of `result_ok`.
12565         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
12566         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12567         pub result_ok: bool,
12568 }
12569 #[no_mangle]
12570 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12571 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12572         CResult_UpdateFulfillHTLCDecodeErrorZ {
12573                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12574                         result: Box::into_raw(Box::new(o)),
12575                 },
12576                 result_ok: true,
12577         }
12578 }
12579 #[no_mangle]
12580 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12581 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12582         CResult_UpdateFulfillHTLCDecodeErrorZ {
12583                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12584                         err: Box::into_raw(Box::new(e)),
12585                 },
12586                 result_ok: false,
12587         }
12588 }
12589 /// Checks if the given object is currently in the success state
12590 #[no_mangle]
12591 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
12592         o.result_ok
12593 }
12594 #[no_mangle]
12595 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12596 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
12597 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
12598         fn drop(&mut self) {
12599                 if self.result_ok {
12600                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12601                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12602                         }
12603                 } else {
12604                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12605                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12606                         }
12607                 }
12608         }
12609 }
12610 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
12611         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12612                 let contents = if o.result_ok {
12613                         let result = unsafe { o.contents.result };
12614                         unsafe { o.contents.result = std::ptr::null_mut() };
12615                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
12616                 } else {
12617                         let err = unsafe { o.contents.err };
12618                         unsafe { o.contents.err = std::ptr::null_mut(); }
12619                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
12620                 };
12621                 Self {
12622                         contents,
12623                         result_ok: o.result_ok,
12624                 }
12625         }
12626 }
12627 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
12628         fn clone(&self) -> Self {
12629                 if self.result_ok {
12630                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12631                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
12632                         } }
12633                 } else {
12634                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12635                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12636                         } }
12637                 }
12638         }
12639 }
12640 #[no_mangle]
12641 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12642 /// but with all dynamically-allocated buffers duplicated in new buffers.
12643 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
12644 #[repr(C)]
12645 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
12646 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
12647         /// A pointer to the contents in the success state.
12648         /// Reading from this pointer when `result_ok` is not set is undefined.
12649         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12650         /// A pointer to the contents in the error state.
12651         /// Reading from this pointer when `result_ok` is set is undefined.
12652         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12653 }
12654 #[repr(C)]
12655 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12656 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12658 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
12659         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12660         /// `err` or `result` depending on the state of `result_ok`.
12661         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
12662         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12663         pub result_ok: bool,
12664 }
12665 #[no_mangle]
12666 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12667 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
12668         CResult_UpdateAddHTLCDecodeErrorZ {
12669                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12670                         result: Box::into_raw(Box::new(o)),
12671                 },
12672                 result_ok: true,
12673         }
12674 }
12675 #[no_mangle]
12676 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12677 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
12678         CResult_UpdateAddHTLCDecodeErrorZ {
12679                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12680                         err: Box::into_raw(Box::new(e)),
12681                 },
12682                 result_ok: false,
12683         }
12684 }
12685 /// Checks if the given object is currently in the success state
12686 #[no_mangle]
12687 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
12688         o.result_ok
12689 }
12690 #[no_mangle]
12691 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12692 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
12693 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
12694         fn drop(&mut self) {
12695                 if self.result_ok {
12696                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12697                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12698                         }
12699                 } else {
12700                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12701                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12702                         }
12703                 }
12704         }
12705 }
12706 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
12707         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12708                 let contents = if o.result_ok {
12709                         let result = unsafe { o.contents.result };
12710                         unsafe { o.contents.result = std::ptr::null_mut() };
12711                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
12712                 } else {
12713                         let err = unsafe { o.contents.err };
12714                         unsafe { o.contents.err = std::ptr::null_mut(); }
12715                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
12716                 };
12717                 Self {
12718                         contents,
12719                         result_ok: o.result_ok,
12720                 }
12721         }
12722 }
12723 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
12724         fn clone(&self) -> Self {
12725                 if self.result_ok {
12726                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12727                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
12728                         } }
12729                 } else {
12730                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12731                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12732                         } }
12733                 }
12734         }
12735 }
12736 #[no_mangle]
12737 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12738 /// but with all dynamically-allocated buffers duplicated in new buffers.
12739 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
12740 #[repr(C)]
12741 /// The contents of CResult_PingDecodeErrorZ
12742 pub union CResult_PingDecodeErrorZPtr {
12743         /// A pointer to the contents in the success state.
12744         /// Reading from this pointer when `result_ok` is not set is undefined.
12745         pub result: *mut crate::lightning::ln::msgs::Ping,
12746         /// A pointer to the contents in the error state.
12747         /// Reading from this pointer when `result_ok` is set is undefined.
12748         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12749 }
12750 #[repr(C)]
12751 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12752 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12754 pub struct CResult_PingDecodeErrorZ {
12755         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
12756         /// `err` or `result` depending on the state of `result_ok`.
12757         pub contents: CResult_PingDecodeErrorZPtr,
12758         /// Whether this CResult_PingDecodeErrorZ represents a success state.
12759         pub result_ok: bool,
12760 }
12761 #[no_mangle]
12762 /// Creates a new CResult_PingDecodeErrorZ in the success state.
12763 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
12764         CResult_PingDecodeErrorZ {
12765                 contents: CResult_PingDecodeErrorZPtr {
12766                         result: Box::into_raw(Box::new(o)),
12767                 },
12768                 result_ok: true,
12769         }
12770 }
12771 #[no_mangle]
12772 /// Creates a new CResult_PingDecodeErrorZ in the error state.
12773 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
12774         CResult_PingDecodeErrorZ {
12775                 contents: CResult_PingDecodeErrorZPtr {
12776                         err: Box::into_raw(Box::new(e)),
12777                 },
12778                 result_ok: false,
12779         }
12780 }
12781 /// Checks if the given object is currently in the success state
12782 #[no_mangle]
12783 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
12784         o.result_ok
12785 }
12786 #[no_mangle]
12787 /// Frees any resources used by the CResult_PingDecodeErrorZ.
12788 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
12789 impl Drop for CResult_PingDecodeErrorZ {
12790         fn drop(&mut self) {
12791                 if self.result_ok {
12792                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12793                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12794                         }
12795                 } else {
12796                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12797                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12798                         }
12799                 }
12800         }
12801 }
12802 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
12803         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
12804                 let contents = if o.result_ok {
12805                         let result = unsafe { o.contents.result };
12806                         unsafe { o.contents.result = std::ptr::null_mut() };
12807                         CResult_PingDecodeErrorZPtr { result }
12808                 } else {
12809                         let err = unsafe { o.contents.err };
12810                         unsafe { o.contents.err = std::ptr::null_mut(); }
12811                         CResult_PingDecodeErrorZPtr { err }
12812                 };
12813                 Self {
12814                         contents,
12815                         result_ok: o.result_ok,
12816                 }
12817         }
12818 }
12819 impl Clone for CResult_PingDecodeErrorZ {
12820         fn clone(&self) -> Self {
12821                 if self.result_ok {
12822                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
12823                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
12824                         } }
12825                 } else {
12826                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
12827                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12828                         } }
12829                 }
12830         }
12831 }
12832 #[no_mangle]
12833 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12834 /// but with all dynamically-allocated buffers duplicated in new buffers.
12835 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
12836 #[repr(C)]
12837 /// The contents of CResult_PongDecodeErrorZ
12838 pub union CResult_PongDecodeErrorZPtr {
12839         /// A pointer to the contents in the success state.
12840         /// Reading from this pointer when `result_ok` is not set is undefined.
12841         pub result: *mut crate::lightning::ln::msgs::Pong,
12842         /// A pointer to the contents in the error state.
12843         /// Reading from this pointer when `result_ok` is set is undefined.
12844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12845 }
12846 #[repr(C)]
12847 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12848 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12850 pub struct CResult_PongDecodeErrorZ {
12851         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
12852         /// `err` or `result` depending on the state of `result_ok`.
12853         pub contents: CResult_PongDecodeErrorZPtr,
12854         /// Whether this CResult_PongDecodeErrorZ represents a success state.
12855         pub result_ok: bool,
12856 }
12857 #[no_mangle]
12858 /// Creates a new CResult_PongDecodeErrorZ in the success state.
12859 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
12860         CResult_PongDecodeErrorZ {
12861                 contents: CResult_PongDecodeErrorZPtr {
12862                         result: Box::into_raw(Box::new(o)),
12863                 },
12864                 result_ok: true,
12865         }
12866 }
12867 #[no_mangle]
12868 /// Creates a new CResult_PongDecodeErrorZ in the error state.
12869 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
12870         CResult_PongDecodeErrorZ {
12871                 contents: CResult_PongDecodeErrorZPtr {
12872                         err: Box::into_raw(Box::new(e)),
12873                 },
12874                 result_ok: false,
12875         }
12876 }
12877 /// Checks if the given object is currently in the success state
12878 #[no_mangle]
12879 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
12880         o.result_ok
12881 }
12882 #[no_mangle]
12883 /// Frees any resources used by the CResult_PongDecodeErrorZ.
12884 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
12885 impl Drop for CResult_PongDecodeErrorZ {
12886         fn drop(&mut self) {
12887                 if self.result_ok {
12888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12890                         }
12891                 } else {
12892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12894                         }
12895                 }
12896         }
12897 }
12898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
12899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
12900                 let contents = if o.result_ok {
12901                         let result = unsafe { o.contents.result };
12902                         unsafe { o.contents.result = std::ptr::null_mut() };
12903                         CResult_PongDecodeErrorZPtr { result }
12904                 } else {
12905                         let err = unsafe { o.contents.err };
12906                         unsafe { o.contents.err = std::ptr::null_mut(); }
12907                         CResult_PongDecodeErrorZPtr { err }
12908                 };
12909                 Self {
12910                         contents,
12911                         result_ok: o.result_ok,
12912                 }
12913         }
12914 }
12915 impl Clone for CResult_PongDecodeErrorZ {
12916         fn clone(&self) -> Self {
12917                 if self.result_ok {
12918                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
12919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
12920                         } }
12921                 } else {
12922                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
12923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12924                         } }
12925                 }
12926         }
12927 }
12928 #[no_mangle]
12929 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
12930 /// but with all dynamically-allocated buffers duplicated in new buffers.
12931 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
12932 #[repr(C)]
12933 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12934 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12935         /// A pointer to the contents in the success state.
12936         /// Reading from this pointer when `result_ok` is not set is undefined.
12937         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
12938         /// A pointer to the contents in the error state.
12939         /// Reading from this pointer when `result_ok` is set is undefined.
12940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12941 }
12942 #[repr(C)]
12943 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12944 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12946 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12947         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12948         /// `err` or `result` depending on the state of `result_ok`.
12949         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
12950         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12951         pub result_ok: bool,
12952 }
12953 #[no_mangle]
12954 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
12955 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12956         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12957                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12958                         result: Box::into_raw(Box::new(o)),
12959                 },
12960                 result_ok: true,
12961         }
12962 }
12963 #[no_mangle]
12964 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
12965 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12966         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12967                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12968                         err: Box::into_raw(Box::new(e)),
12969                 },
12970                 result_ok: false,
12971         }
12972 }
12973 /// Checks if the given object is currently in the success state
12974 #[no_mangle]
12975 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
12976         o.result_ok
12977 }
12978 #[no_mangle]
12979 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
12980 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
12981 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12982         fn drop(&mut self) {
12983                 if self.result_ok {
12984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12986                         }
12987                 } else {
12988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12990                         }
12991                 }
12992         }
12993 }
12994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
12996                 let contents = if o.result_ok {
12997                         let result = unsafe { o.contents.result };
12998                         unsafe { o.contents.result = std::ptr::null_mut() };
12999                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13000                 } else {
13001                         let err = unsafe { o.contents.err };
13002                         unsafe { o.contents.err = std::ptr::null_mut(); }
13003                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13004                 };
13005                 Self {
13006                         contents,
13007                         result_ok: o.result_ok,
13008                 }
13009         }
13010 }
13011 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13012         fn clone(&self) -> Self {
13013                 if self.result_ok {
13014                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13016                         } }
13017                 } else {
13018                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13020                         } }
13021                 }
13022         }
13023 }
13024 #[no_mangle]
13025 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13026 /// but with all dynamically-allocated buffers duplicated in new buffers.
13027 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13028 #[repr(C)]
13029 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13030 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13031         /// A pointer to the contents in the success state.
13032         /// Reading from this pointer when `result_ok` is not set is undefined.
13033         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13034         /// A pointer to the contents in the error state.
13035         /// Reading from this pointer when `result_ok` is set is undefined.
13036         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13037 }
13038 #[repr(C)]
13039 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13040 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13041 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13042 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
13043         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
13044         /// `err` or `result` depending on the state of `result_ok`.
13045         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
13046         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
13047         pub result_ok: bool,
13048 }
13049 #[no_mangle]
13050 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13051 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
13052         CResult_ChannelAnnouncementDecodeErrorZ {
13053                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13054                         result: Box::into_raw(Box::new(o)),
13055                 },
13056                 result_ok: true,
13057         }
13058 }
13059 #[no_mangle]
13060 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13061 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
13062         CResult_ChannelAnnouncementDecodeErrorZ {
13063                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13064                         err: Box::into_raw(Box::new(e)),
13065                 },
13066                 result_ok: false,
13067         }
13068 }
13069 /// Checks if the given object is currently in the success state
13070 #[no_mangle]
13071 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
13072         o.result_ok
13073 }
13074 #[no_mangle]
13075 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13076 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
13077 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
13078         fn drop(&mut self) {
13079                 if self.result_ok {
13080                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13081                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13082                         }
13083                 } else {
13084                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13085                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13086                         }
13087                 }
13088         }
13089 }
13090 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
13091         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13092                 let contents = if o.result_ok {
13093                         let result = unsafe { o.contents.result };
13094                         unsafe { o.contents.result = std::ptr::null_mut() };
13095                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
13096                 } else {
13097                         let err = unsafe { o.contents.err };
13098                         unsafe { o.contents.err = std::ptr::null_mut(); }
13099                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
13100                 };
13101                 Self {
13102                         contents,
13103                         result_ok: o.result_ok,
13104                 }
13105         }
13106 }
13107 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
13108         fn clone(&self) -> Self {
13109                 if self.result_ok {
13110                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13111                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13112                         } }
13113                 } else {
13114                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13115                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13116                         } }
13117                 }
13118         }
13119 }
13120 #[no_mangle]
13121 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13122 /// but with all dynamically-allocated buffers duplicated in new buffers.
13123 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13124 #[repr(C)]
13125 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
13126 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13127         /// A pointer to the contents in the success state.
13128         /// Reading from this pointer when `result_ok` is not set is undefined.
13129         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
13130         /// A pointer to the contents in the error state.
13131         /// Reading from this pointer when `result_ok` is set is undefined.
13132         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13133 }
13134 #[repr(C)]
13135 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13136 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13138 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
13139         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
13140         /// `err` or `result` depending on the state of `result_ok`.
13141         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
13142         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
13143         pub result_ok: bool,
13144 }
13145 #[no_mangle]
13146 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13147 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13148         CResult_UnsignedChannelUpdateDecodeErrorZ {
13149                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13150                         result: Box::into_raw(Box::new(o)),
13151                 },
13152                 result_ok: true,
13153         }
13154 }
13155 #[no_mangle]
13156 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
13157 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13158         CResult_UnsignedChannelUpdateDecodeErrorZ {
13159                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13160                         err: Box::into_raw(Box::new(e)),
13161                 },
13162                 result_ok: false,
13163         }
13164 }
13165 /// Checks if the given object is currently in the success state
13166 #[no_mangle]
13167 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
13168         o.result_ok
13169 }
13170 #[no_mangle]
13171 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
13172 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
13173 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
13174         fn drop(&mut self) {
13175                 if self.result_ok {
13176                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13177                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13178                         }
13179                 } else {
13180                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13181                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13182                         }
13183                 }
13184         }
13185 }
13186 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
13187         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13188                 let contents = if o.result_ok {
13189                         let result = unsafe { o.contents.result };
13190                         unsafe { o.contents.result = std::ptr::null_mut() };
13191                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
13192                 } else {
13193                         let err = unsafe { o.contents.err };
13194                         unsafe { o.contents.err = std::ptr::null_mut(); }
13195                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
13196                 };
13197                 Self {
13198                         contents,
13199                         result_ok: o.result_ok,
13200                 }
13201         }
13202 }
13203 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
13204         fn clone(&self) -> Self {
13205                 if self.result_ok {
13206                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13207                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
13208                         } }
13209                 } else {
13210                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13211                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13212                         } }
13213                 }
13214         }
13215 }
13216 #[no_mangle]
13217 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
13218 /// but with all dynamically-allocated buffers duplicated in new buffers.
13219 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13220 #[repr(C)]
13221 /// The contents of CResult_ChannelUpdateDecodeErrorZ
13222 pub union CResult_ChannelUpdateDecodeErrorZPtr {
13223         /// A pointer to the contents in the success state.
13224         /// Reading from this pointer when `result_ok` is not set is undefined.
13225         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
13226         /// A pointer to the contents in the error state.
13227         /// Reading from this pointer when `result_ok` is set is undefined.
13228         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13229 }
13230 #[repr(C)]
13231 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13232 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13234 pub struct CResult_ChannelUpdateDecodeErrorZ {
13235         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
13236         /// `err` or `result` depending on the state of `result_ok`.
13237         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
13238         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
13239         pub result_ok: bool,
13240 }
13241 #[no_mangle]
13242 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
13243 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
13244         CResult_ChannelUpdateDecodeErrorZ {
13245                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13246                         result: Box::into_raw(Box::new(o)),
13247                 },
13248                 result_ok: true,
13249         }
13250 }
13251 #[no_mangle]
13252 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
13253 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
13254         CResult_ChannelUpdateDecodeErrorZ {
13255                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13256                         err: Box::into_raw(Box::new(e)),
13257                 },
13258                 result_ok: false,
13259         }
13260 }
13261 /// Checks if the given object is currently in the success state
13262 #[no_mangle]
13263 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
13264         o.result_ok
13265 }
13266 #[no_mangle]
13267 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
13268 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
13269 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
13270         fn drop(&mut self) {
13271                 if self.result_ok {
13272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13274                         }
13275                 } else {
13276                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13277                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13278                         }
13279                 }
13280         }
13281 }
13282 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
13283         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13284                 let contents = if o.result_ok {
13285                         let result = unsafe { o.contents.result };
13286                         unsafe { o.contents.result = std::ptr::null_mut() };
13287                         CResult_ChannelUpdateDecodeErrorZPtr { result }
13288                 } else {
13289                         let err = unsafe { o.contents.err };
13290                         unsafe { o.contents.err = std::ptr::null_mut(); }
13291                         CResult_ChannelUpdateDecodeErrorZPtr { err }
13292                 };
13293                 Self {
13294                         contents,
13295                         result_ok: o.result_ok,
13296                 }
13297         }
13298 }
13299 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
13300         fn clone(&self) -> Self {
13301                 if self.result_ok {
13302                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13303                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
13304                         } }
13305                 } else {
13306                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13307                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13308                         } }
13309                 }
13310         }
13311 }
13312 #[no_mangle]
13313 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
13314 /// but with all dynamically-allocated buffers duplicated in new buffers.
13315 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13316 #[repr(C)]
13317 /// The contents of CResult_ErrorMessageDecodeErrorZ
13318 pub union CResult_ErrorMessageDecodeErrorZPtr {
13319         /// A pointer to the contents in the success state.
13320         /// Reading from this pointer when `result_ok` is not set is undefined.
13321         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
13322         /// A pointer to the contents in the error state.
13323         /// Reading from this pointer when `result_ok` is set is undefined.
13324         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13325 }
13326 #[repr(C)]
13327 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
13328 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
13329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13330 pub struct CResult_ErrorMessageDecodeErrorZ {
13331         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
13332         /// `err` or `result` depending on the state of `result_ok`.
13333         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
13334         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
13335         pub result_ok: bool,
13336 }
13337 #[no_mangle]
13338 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
13339 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
13340         CResult_ErrorMessageDecodeErrorZ {
13341                 contents: CResult_ErrorMessageDecodeErrorZPtr {
13342                         result: Box::into_raw(Box::new(o)),
13343                 },
13344                 result_ok: true,
13345         }
13346 }
13347 #[no_mangle]
13348 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
13349 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
13350         CResult_ErrorMessageDecodeErrorZ {
13351                 contents: CResult_ErrorMessageDecodeErrorZPtr {
13352                         err: Box::into_raw(Box::new(e)),
13353                 },
13354                 result_ok: false,
13355         }
13356 }
13357 /// Checks if the given object is currently in the success state
13358 #[no_mangle]
13359 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
13360         o.result_ok
13361 }
13362 #[no_mangle]
13363 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
13364 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
13365 impl Drop for CResult_ErrorMessageDecodeErrorZ {
13366         fn drop(&mut self) {
13367                 if self.result_ok {
13368                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13369                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13370                         }
13371                 } else {
13372                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13373                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13374                         }
13375                 }
13376         }
13377 }
13378 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
13379         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
13380                 let contents = if o.result_ok {
13381                         let result = unsafe { o.contents.result };
13382                         unsafe { o.contents.result = std::ptr::null_mut() };
13383                         CResult_ErrorMessageDecodeErrorZPtr { result }
13384                 } else {
13385                         let err = unsafe { o.contents.err };
13386                         unsafe { o.contents.err = std::ptr::null_mut(); }
13387                         CResult_ErrorMessageDecodeErrorZPtr { err }
13388                 };
13389                 Self {
13390                         contents,
13391                         result_ok: o.result_ok,
13392                 }
13393         }
13394 }
13395 impl Clone for CResult_ErrorMessageDecodeErrorZ {
13396         fn clone(&self) -> Self {
13397                 if self.result_ok {
13398                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
13399                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
13400                         } }
13401                 } else {
13402                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
13403                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13404                         } }
13405                 }
13406         }
13407 }
13408 #[no_mangle]
13409 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13410 /// but with all dynamically-allocated buffers duplicated in new buffers.
13411 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
13412 #[repr(C)]
13413 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
13414 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13415         /// A pointer to the contents in the success state.
13416         /// Reading from this pointer when `result_ok` is not set is undefined.
13417         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
13418         /// A pointer to the contents in the error state.
13419         /// Reading from this pointer when `result_ok` is set is undefined.
13420         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13421 }
13422 #[repr(C)]
13423 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13424 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13426 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13427         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
13428         /// `err` or `result` depending on the state of `result_ok`.
13429         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
13430         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
13431         pub result_ok: bool,
13432 }
13433 #[no_mangle]
13434 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13435 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13436         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13437                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13438                         result: Box::into_raw(Box::new(o)),
13439                 },
13440                 result_ok: true,
13441         }
13442 }
13443 #[no_mangle]
13444 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13445 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13446         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13447                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13448                         err: Box::into_raw(Box::new(e)),
13449                 },
13450                 result_ok: false,
13451         }
13452 }
13453 /// Checks if the given object is currently in the success state
13454 #[no_mangle]
13455 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
13456         o.result_ok
13457 }
13458 #[no_mangle]
13459 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13460 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
13461 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13462         fn drop(&mut self) {
13463                 if self.result_ok {
13464                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13465                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13466                         }
13467                 } else {
13468                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13469                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13470                         }
13471                 }
13472         }
13473 }
13474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13475         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13476                 let contents = if o.result_ok {
13477                         let result = unsafe { o.contents.result };
13478                         unsafe { o.contents.result = std::ptr::null_mut() };
13479                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
13480                 } else {
13481                         let err = unsafe { o.contents.err };
13482                         unsafe { o.contents.err = std::ptr::null_mut(); }
13483                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
13484                 };
13485                 Self {
13486                         contents,
13487                         result_ok: o.result_ok,
13488                 }
13489         }
13490 }
13491 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13492         fn clone(&self) -> Self {
13493                 if self.result_ok {
13494                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13495                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13496                         } }
13497                 } else {
13498                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13499                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13500                         } }
13501                 }
13502         }
13503 }
13504 #[no_mangle]
13505 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13506 /// but with all dynamically-allocated buffers duplicated in new buffers.
13507 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13508 #[repr(C)]
13509 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
13510 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
13511         /// A pointer to the contents in the success state.
13512         /// Reading from this pointer when `result_ok` is not set is undefined.
13513         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
13514         /// A pointer to the contents in the error state.
13515         /// Reading from this pointer when `result_ok` is set is undefined.
13516         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13517 }
13518 #[repr(C)]
13519 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13520 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13522 pub struct CResult_NodeAnnouncementDecodeErrorZ {
13523         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
13524         /// `err` or `result` depending on the state of `result_ok`.
13525         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
13526         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
13527         pub result_ok: bool,
13528 }
13529 #[no_mangle]
13530 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13531 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
13532         CResult_NodeAnnouncementDecodeErrorZ {
13533                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13534                         result: Box::into_raw(Box::new(o)),
13535                 },
13536                 result_ok: true,
13537         }
13538 }
13539 #[no_mangle]
13540 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13541 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
13542         CResult_NodeAnnouncementDecodeErrorZ {
13543                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13544                         err: Box::into_raw(Box::new(e)),
13545                 },
13546                 result_ok: false,
13547         }
13548 }
13549 /// Checks if the given object is currently in the success state
13550 #[no_mangle]
13551 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
13552         o.result_ok
13553 }
13554 #[no_mangle]
13555 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13556 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
13557 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
13558         fn drop(&mut self) {
13559                 if self.result_ok {
13560                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13561                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13562                         }
13563                 } else {
13564                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13565                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13566                         }
13567                 }
13568         }
13569 }
13570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
13571         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13572                 let contents = if o.result_ok {
13573                         let result = unsafe { o.contents.result };
13574                         unsafe { o.contents.result = std::ptr::null_mut() };
13575                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
13576                 } else {
13577                         let err = unsafe { o.contents.err };
13578                         unsafe { o.contents.err = std::ptr::null_mut(); }
13579                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
13580                 };
13581                 Self {
13582                         contents,
13583                         result_ok: o.result_ok,
13584                 }
13585         }
13586 }
13587 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
13588         fn clone(&self) -> Self {
13589                 if self.result_ok {
13590                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13591                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13592                         } }
13593                 } else {
13594                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13595                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13596                         } }
13597                 }
13598         }
13599 }
13600 #[no_mangle]
13601 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13602 /// but with all dynamically-allocated buffers duplicated in new buffers.
13603 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13604 #[repr(C)]
13605 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
13606 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
13607         /// A pointer to the contents in the success state.
13608         /// Reading from this pointer when `result_ok` is not set is undefined.
13609         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
13610         /// A pointer to the contents in the error state.
13611         /// Reading from this pointer when `result_ok` is set is undefined.
13612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13613 }
13614 #[repr(C)]
13615 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
13616 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
13617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13618 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
13619         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
13620         /// `err` or `result` depending on the state of `result_ok`.
13621         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
13622         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
13623         pub result_ok: bool,
13624 }
13625 #[no_mangle]
13626 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13627 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13628         CResult_QueryShortChannelIdsDecodeErrorZ {
13629                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13630                         result: Box::into_raw(Box::new(o)),
13631                 },
13632                 result_ok: true,
13633         }
13634 }
13635 #[no_mangle]
13636 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13637 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13638         CResult_QueryShortChannelIdsDecodeErrorZ {
13639                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13640                         err: Box::into_raw(Box::new(e)),
13641                 },
13642                 result_ok: false,
13643         }
13644 }
13645 /// Checks if the given object is currently in the success state
13646 #[no_mangle]
13647 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
13648         o.result_ok
13649 }
13650 #[no_mangle]
13651 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13652 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
13653 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
13654         fn drop(&mut self) {
13655                 if self.result_ok {
13656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13658                         }
13659                 } else {
13660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13662                         }
13663                 }
13664         }
13665 }
13666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
13667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
13668                 let contents = if o.result_ok {
13669                         let result = unsafe { o.contents.result };
13670                         unsafe { o.contents.result = std::ptr::null_mut() };
13671                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
13672                 } else {
13673                         let err = unsafe { o.contents.err };
13674                         unsafe { o.contents.err = std::ptr::null_mut(); }
13675                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
13676                 };
13677                 Self {
13678                         contents,
13679                         result_ok: o.result_ok,
13680                 }
13681         }
13682 }
13683 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
13684         fn clone(&self) -> Self {
13685                 if self.result_ok {
13686                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
13688                         } }
13689                 } else {
13690                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13692                         } }
13693                 }
13694         }
13695 }
13696 #[no_mangle]
13697 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13698 /// but with all dynamically-allocated buffers duplicated in new buffers.
13699 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
13700 #[repr(C)]
13701 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
13702 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13703         /// A pointer to the contents in the success state.
13704         /// Reading from this pointer when `result_ok` is not set is undefined.
13705         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
13706         /// A pointer to the contents in the error state.
13707         /// Reading from this pointer when `result_ok` is set is undefined.
13708         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13709 }
13710 #[repr(C)]
13711 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
13712 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
13713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13714 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13715         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
13716         /// `err` or `result` depending on the state of `result_ok`.
13717         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
13718         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
13719         pub result_ok: bool,
13720 }
13721 #[no_mangle]
13722 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13723 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13724         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13725                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13726                         result: Box::into_raw(Box::new(o)),
13727                 },
13728                 result_ok: true,
13729         }
13730 }
13731 #[no_mangle]
13732 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13733 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13734         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13735                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13736                         err: Box::into_raw(Box::new(e)),
13737                 },
13738                 result_ok: false,
13739         }
13740 }
13741 /// Checks if the given object is currently in the success state
13742 #[no_mangle]
13743 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
13744         o.result_ok
13745 }
13746 #[no_mangle]
13747 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13748 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
13749 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13750         fn drop(&mut self) {
13751                 if self.result_ok {
13752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13754                         }
13755                 } else {
13756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13758                         }
13759                 }
13760         }
13761 }
13762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
13764                 let contents = if o.result_ok {
13765                         let result = unsafe { o.contents.result };
13766                         unsafe { o.contents.result = std::ptr::null_mut() };
13767                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
13768                 } else {
13769                         let err = unsafe { o.contents.err };
13770                         unsafe { o.contents.err = std::ptr::null_mut(); }
13771                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
13772                 };
13773                 Self {
13774                         contents,
13775                         result_ok: o.result_ok,
13776                 }
13777         }
13778 }
13779 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13780         fn clone(&self) -> Self {
13781                 if self.result_ok {
13782                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
13784                         } }
13785                 } else {
13786                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13788                         } }
13789                 }
13790         }
13791 }
13792 #[no_mangle]
13793 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13794 /// but with all dynamically-allocated buffers duplicated in new buffers.
13795 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
13796 #[repr(C)]
13797 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
13798 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
13799         /// A pointer to the contents in the success state.
13800         /// Reading from this pointer when `result_ok` is not set is undefined.
13801         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
13802         /// A pointer to the contents in the error state.
13803         /// Reading from this pointer when `result_ok` is set is undefined.
13804         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13805 }
13806 #[repr(C)]
13807 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
13808 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13809 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13810 pub struct CResult_QueryChannelRangeDecodeErrorZ {
13811         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
13812         /// `err` or `result` depending on the state of `result_ok`.
13813         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
13814         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
13815         pub result_ok: bool,
13816 }
13817 #[no_mangle]
13818 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13819 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
13820         CResult_QueryChannelRangeDecodeErrorZ {
13821                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13822                         result: Box::into_raw(Box::new(o)),
13823                 },
13824                 result_ok: true,
13825         }
13826 }
13827 #[no_mangle]
13828 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13829 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
13830         CResult_QueryChannelRangeDecodeErrorZ {
13831                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13832                         err: Box::into_raw(Box::new(e)),
13833                 },
13834                 result_ok: false,
13835         }
13836 }
13837 /// Checks if the given object is currently in the success state
13838 #[no_mangle]
13839 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
13840         o.result_ok
13841 }
13842 #[no_mangle]
13843 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13844 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
13845 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
13846         fn drop(&mut self) {
13847                 if self.result_ok {
13848                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13849                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13850                         }
13851                 } else {
13852                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13853                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13854                         }
13855                 }
13856         }
13857 }
13858 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
13859         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13860                 let contents = if o.result_ok {
13861                         let result = unsafe { o.contents.result };
13862                         unsafe { o.contents.result = std::ptr::null_mut() };
13863                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
13864                 } else {
13865                         let err = unsafe { o.contents.err };
13866                         unsafe { o.contents.err = std::ptr::null_mut(); }
13867                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
13868                 };
13869                 Self {
13870                         contents,
13871                         result_ok: o.result_ok,
13872                 }
13873         }
13874 }
13875 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
13876         fn clone(&self) -> Self {
13877                 if self.result_ok {
13878                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13879                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
13880                         } }
13881                 } else {
13882                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13883                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13884                         } }
13885                 }
13886         }
13887 }
13888 #[no_mangle]
13889 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13890 /// but with all dynamically-allocated buffers duplicated in new buffers.
13891 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13892 #[repr(C)]
13893 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
13894 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
13895         /// A pointer to the contents in the success state.
13896         /// Reading from this pointer when `result_ok` is not set is undefined.
13897         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
13898         /// A pointer to the contents in the error state.
13899         /// Reading from this pointer when `result_ok` is set is undefined.
13900         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13901 }
13902 #[repr(C)]
13903 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
13904 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13906 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
13907         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
13908         /// `err` or `result` depending on the state of `result_ok`.
13909         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
13910         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
13911         pub result_ok: bool,
13912 }
13913 #[no_mangle]
13914 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13915 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
13916         CResult_ReplyChannelRangeDecodeErrorZ {
13917                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13918                         result: Box::into_raw(Box::new(o)),
13919                 },
13920                 result_ok: true,
13921         }
13922 }
13923 #[no_mangle]
13924 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13925 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
13926         CResult_ReplyChannelRangeDecodeErrorZ {
13927                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13928                         err: Box::into_raw(Box::new(e)),
13929                 },
13930                 result_ok: false,
13931         }
13932 }
13933 /// Checks if the given object is currently in the success state
13934 #[no_mangle]
13935 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
13936         o.result_ok
13937 }
13938 #[no_mangle]
13939 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13940 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
13941 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
13942         fn drop(&mut self) {
13943                 if self.result_ok {
13944                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13945                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13946                         }
13947                 } else {
13948                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13949                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13950                         }
13951                 }
13952         }
13953 }
13954 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
13955         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13956                 let contents = if o.result_ok {
13957                         let result = unsafe { o.contents.result };
13958                         unsafe { o.contents.result = std::ptr::null_mut() };
13959                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
13960                 } else {
13961                         let err = unsafe { o.contents.err };
13962                         unsafe { o.contents.err = std::ptr::null_mut(); }
13963                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
13964                 };
13965                 Self {
13966                         contents,
13967                         result_ok: o.result_ok,
13968                 }
13969         }
13970 }
13971 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
13972         fn clone(&self) -> Self {
13973                 if self.result_ok {
13974                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13975                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
13976                         } }
13977                 } else {
13978                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13979                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13980                         } }
13981                 }
13982         }
13983 }
13984 #[no_mangle]
13985 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13986 /// but with all dynamically-allocated buffers duplicated in new buffers.
13987 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13988 #[repr(C)]
13989 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
13990 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
13991         /// A pointer to the contents in the success state.
13992         /// Reading from this pointer when `result_ok` is not set is undefined.
13993         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
13994         /// A pointer to the contents in the error state.
13995         /// Reading from this pointer when `result_ok` is set is undefined.
13996         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13997 }
13998 #[repr(C)]
13999 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
14000 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
14001 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14002 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
14003         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
14004         /// `err` or `result` depending on the state of `result_ok`.
14005         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
14006         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
14007         pub result_ok: bool,
14008 }
14009 #[no_mangle]
14010 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
14011 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
14012         CResult_GossipTimestampFilterDecodeErrorZ {
14013                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14014                         result: Box::into_raw(Box::new(o)),
14015                 },
14016                 result_ok: true,
14017         }
14018 }
14019 #[no_mangle]
14020 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
14021 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
14022         CResult_GossipTimestampFilterDecodeErrorZ {
14023                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14024                         err: Box::into_raw(Box::new(e)),
14025                 },
14026                 result_ok: false,
14027         }
14028 }
14029 /// Checks if the given object is currently in the success state
14030 #[no_mangle]
14031 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
14032         o.result_ok
14033 }
14034 #[no_mangle]
14035 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
14036 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
14037 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
14038         fn drop(&mut self) {
14039                 if self.result_ok {
14040                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14041                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14042                         }
14043                 } else {
14044                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14045                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14046                         }
14047                 }
14048         }
14049 }
14050 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
14051         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
14052                 let contents = if o.result_ok {
14053                         let result = unsafe { o.contents.result };
14054                         unsafe { o.contents.result = std::ptr::null_mut() };
14055                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
14056                 } else {
14057                         let err = unsafe { o.contents.err };
14058                         unsafe { o.contents.err = std::ptr::null_mut(); }
14059                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
14060                 };
14061                 Self {
14062                         contents,
14063                         result_ok: o.result_ok,
14064                 }
14065         }
14066 }
14067 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
14068         fn clone(&self) -> Self {
14069                 if self.result_ok {
14070                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14071                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
14072                         } }
14073                 } else {
14074                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14075                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14076                         } }
14077                 }
14078         }
14079 }
14080 #[no_mangle]
14081 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
14082 /// but with all dynamically-allocated buffers duplicated in new buffers.
14083 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
14084 #[repr(C)]
14085 /// The contents of CResult_InvoiceSignOrCreationErrorZ
14086 pub union CResult_InvoiceSignOrCreationErrorZPtr {
14087         /// A pointer to the contents in the success state.
14088         /// Reading from this pointer when `result_ok` is not set is undefined.
14089         pub result: *mut crate::lightning_invoice::Invoice,
14090         /// A pointer to the contents in the error state.
14091         /// Reading from this pointer when `result_ok` is set is undefined.
14092         pub err: *mut crate::lightning_invoice::SignOrCreationError,
14093 }
14094 #[repr(C)]
14095 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
14096 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
14097 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14098 pub struct CResult_InvoiceSignOrCreationErrorZ {
14099         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
14100         /// `err` or `result` depending on the state of `result_ok`.
14101         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
14102         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
14103         pub result_ok: bool,
14104 }
14105 #[no_mangle]
14106 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
14107 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
14108         CResult_InvoiceSignOrCreationErrorZ {
14109                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14110                         result: Box::into_raw(Box::new(o)),
14111                 },
14112                 result_ok: true,
14113         }
14114 }
14115 #[no_mangle]
14116 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
14117 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
14118         CResult_InvoiceSignOrCreationErrorZ {
14119                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14120                         err: Box::into_raw(Box::new(e)),
14121                 },
14122                 result_ok: false,
14123         }
14124 }
14125 /// Checks if the given object is currently in the success state
14126 #[no_mangle]
14127 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
14128         o.result_ok
14129 }
14130 #[no_mangle]
14131 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
14132 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
14133 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
14134         fn drop(&mut self) {
14135                 if self.result_ok {
14136                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14137                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14138                         }
14139                 } else {
14140                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14141                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14142                         }
14143                 }
14144         }
14145 }
14146 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
14147         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
14148                 let contents = if o.result_ok {
14149                         let result = unsafe { o.contents.result };
14150                         unsafe { o.contents.result = std::ptr::null_mut() };
14151                         CResult_InvoiceSignOrCreationErrorZPtr { result }
14152                 } else {
14153                         let err = unsafe { o.contents.err };
14154                         unsafe { o.contents.err = std::ptr::null_mut(); }
14155                         CResult_InvoiceSignOrCreationErrorZPtr { err }
14156                 };
14157                 Self {
14158                         contents,
14159                         result_ok: o.result_ok,
14160                 }
14161         }
14162 }
14163 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
14164         fn clone(&self) -> Self {
14165                 if self.result_ok {
14166                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14167                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14168                         } }
14169                 } else {
14170                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14171                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
14172                         } }
14173                 }
14174         }
14175 }
14176 #[no_mangle]
14177 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
14178 /// but with all dynamically-allocated buffers duplicated in new buffers.
14179 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
14180 #[repr(C)]
14181 /// An enum which can either contain a crate::lightning::chain::Filter or not
14182 pub enum COption_FilterZ {
14183         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
14184         Some(crate::lightning::chain::Filter),
14185         /// When we're in this state, this COption_FilterZ contains nothing
14186         None
14187 }
14188 impl COption_FilterZ {
14189         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14190                 if let Self::None = self { false } else { true }
14191         }
14192         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14193                 !self.is_some()
14194         }
14195         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
14196                 if let Self::Some(v) = self { v } else { unreachable!() }
14197         }
14198 }
14199 #[no_mangle]
14200 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
14201 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
14202         COption_FilterZ::Some(o)
14203 }
14204 #[no_mangle]
14205 /// Constructs a new COption_FilterZ containing nothing
14206 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
14207         COption_FilterZ::None
14208 }
14209 #[no_mangle]
14210 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
14211 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
14212 #[repr(C)]
14213 /// The contents of CResult_LockedChannelMonitorNoneZ
14214 pub union CResult_LockedChannelMonitorNoneZPtr {
14215         /// A pointer to the contents in the success state.
14216         /// Reading from this pointer when `result_ok` is not set is undefined.
14217         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
14218         /// Note that this value is always NULL, as there are no contents in the Err variant
14219         pub err: *mut std::ffi::c_void,
14220 }
14221 #[repr(C)]
14222 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
14223 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
14224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14225 pub struct CResult_LockedChannelMonitorNoneZ {
14226         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
14227         /// `err` or `result` depending on the state of `result_ok`.
14228         pub contents: CResult_LockedChannelMonitorNoneZPtr,
14229         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
14230         pub result_ok: bool,
14231 }
14232 #[no_mangle]
14233 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
14234 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
14235         CResult_LockedChannelMonitorNoneZ {
14236                 contents: CResult_LockedChannelMonitorNoneZPtr {
14237                         result: Box::into_raw(Box::new(o)),
14238                 },
14239                 result_ok: true,
14240         }
14241 }
14242 #[no_mangle]
14243 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
14244 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
14245         CResult_LockedChannelMonitorNoneZ {
14246                 contents: CResult_LockedChannelMonitorNoneZPtr {
14247                         err: std::ptr::null_mut(),
14248                 },
14249                 result_ok: false,
14250         }
14251 }
14252 /// Checks if the given object is currently in the success state
14253 #[no_mangle]
14254 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
14255         o.result_ok
14256 }
14257 #[no_mangle]
14258 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
14259 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
14260 impl Drop for CResult_LockedChannelMonitorNoneZ {
14261         fn drop(&mut self) {
14262                 if self.result_ok {
14263                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14264                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14265                         }
14266                 } else {
14267                 }
14268         }
14269 }
14270 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
14271         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
14272                 let contents = if o.result_ok {
14273                         let result = unsafe { o.contents.result };
14274                         unsafe { o.contents.result = std::ptr::null_mut() };
14275                         CResult_LockedChannelMonitorNoneZPtr { result }
14276                 } else {
14277                         let _ = unsafe { Box::from_raw(o.contents.err) };
14278                         o.contents.err = std::ptr::null_mut();
14279                         CResult_LockedChannelMonitorNoneZPtr { err: std::ptr::null_mut() }
14280                 };
14281                 Self {
14282                         contents,
14283                         result_ok: o.result_ok,
14284                 }
14285         }
14286 }
14287 #[repr(C)]
14288 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
14289 /// This corresponds to std::vector in C++
14290 pub struct CVec_OutPointZ {
14291         /// The elements in the array.
14292         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14293         pub data: *mut crate::lightning::chain::transaction::OutPoint,
14294         /// The number of elements pointed to by `data`.
14295         pub datalen: usize
14296 }
14297 impl CVec_OutPointZ {
14298         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
14299                 if self.datalen == 0 { return Vec::new(); }
14300                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14301                 self.data = std::ptr::null_mut();
14302                 self.datalen = 0;
14303                 ret
14304         }
14305         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
14306                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
14307         }
14308 }
14309 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
14310         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
14311                 let datalen = v.len();
14312                 let data = Box::into_raw(v.into_boxed_slice());
14313                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14314         }
14315 }
14316 #[no_mangle]
14317 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14318 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
14319 impl Drop for CVec_OutPointZ {
14320         fn drop(&mut self) {
14321                 if self.datalen == 0 { return; }
14322                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
14323         }
14324 }
14325 impl Clone for CVec_OutPointZ {
14326         fn clone(&self) -> Self {
14327                 let mut res = Vec::new();
14328                 if self.datalen == 0 { return Self::from(res); }
14329                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
14330                 Self::from(res)
14331         }
14332 }