08052dbd2ac72523568cbe534df0f9e318233dac
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 /// The contents of CResult_ChannelConfigDecodeErrorZ
3 pub union CResult_ChannelConfigDecodeErrorZPtr {
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::lightning::util::config::ChannelConfig,
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::lightning::ln::msgs::DecodeError,
10 }
11 #[repr(C)]
12 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
13 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_ChannelConfigDecodeErrorZ {
16         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
17         /// `err` or `result` depending on the state of `result_ok`.
18         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
19         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
20         pub result_ok: bool,
21 }
22 #[no_mangle]
23 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
24 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
25         CResult_ChannelConfigDecodeErrorZ {
26                 contents: CResult_ChannelConfigDecodeErrorZPtr {
27                         result: Box::into_raw(Box::new(o)),
28                 },
29                 result_ok: true,
30         }
31 }
32 #[no_mangle]
33 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
34 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
35         CResult_ChannelConfigDecodeErrorZ {
36                 contents: CResult_ChannelConfigDecodeErrorZPtr {
37                         err: Box::into_raw(Box::new(e)),
38                 },
39                 result_ok: false,
40         }
41 }
42 #[no_mangle]
43 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
44 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
45 impl Drop for CResult_ChannelConfigDecodeErrorZ {
46         fn drop(&mut self) {
47                 if self.result_ok {
48                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
49                                 let _ = unsafe { Box::from_raw(self.contents.result) };
50                         }
51                 } else {
52                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
53                                 let _ = unsafe { Box::from_raw(self.contents.err) };
54                         }
55                 }
56         }
57 }
58 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
59         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
60                 let contents = if o.result_ok {
61                         let result = unsafe { o.contents.result };
62                         unsafe { o.contents.result = std::ptr::null_mut() };
63                         CResult_ChannelConfigDecodeErrorZPtr { result }
64                 } else {
65                         let err = unsafe { o.contents.err };
66                         unsafe { o.contents.err = std::ptr::null_mut(); }
67                         CResult_ChannelConfigDecodeErrorZPtr { err }
68                 };
69                 Self {
70                         contents,
71                         result_ok: o.result_ok,
72                 }
73         }
74 }
75 impl Clone for CResult_ChannelConfigDecodeErrorZ {
76         fn clone(&self) -> Self {
77                 if self.result_ok {
78                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
79                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
80                         } }
81                 } else {
82                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
83                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
84                         } }
85                 }
86         }
87 }
88 #[no_mangle]
89 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
90 /// but with all dynamically-allocated buffers duplicated in new buffers.
91 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
92 #[repr(C)]
93 /// The contents of CResult_OutPointDecodeErrorZ
94 pub union CResult_OutPointDecodeErrorZPtr {
95         /// A pointer to the contents in the success state.
96         /// Reading from this pointer when `result_ok` is not set is undefined.
97         pub result: *mut crate::lightning::chain::transaction::OutPoint,
98         /// A pointer to the contents in the error state.
99         /// Reading from this pointer when `result_ok` is set is undefined.
100         pub err: *mut crate::lightning::ln::msgs::DecodeError,
101 }
102 #[repr(C)]
103 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
104 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
106 pub struct CResult_OutPointDecodeErrorZ {
107         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
108         /// `err` or `result` depending on the state of `result_ok`.
109         pub contents: CResult_OutPointDecodeErrorZPtr,
110         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
111         pub result_ok: bool,
112 }
113 #[no_mangle]
114 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
115 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
116         CResult_OutPointDecodeErrorZ {
117                 contents: CResult_OutPointDecodeErrorZPtr {
118                         result: Box::into_raw(Box::new(o)),
119                 },
120                 result_ok: true,
121         }
122 }
123 #[no_mangle]
124 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
125 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
126         CResult_OutPointDecodeErrorZ {
127                 contents: CResult_OutPointDecodeErrorZPtr {
128                         err: Box::into_raw(Box::new(e)),
129                 },
130                 result_ok: false,
131         }
132 }
133 #[no_mangle]
134 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
135 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
136 impl Drop for CResult_OutPointDecodeErrorZ {
137         fn drop(&mut self) {
138                 if self.result_ok {
139                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
140                                 let _ = unsafe { Box::from_raw(self.contents.result) };
141                         }
142                 } else {
143                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
144                                 let _ = unsafe { Box::from_raw(self.contents.err) };
145                         }
146                 }
147         }
148 }
149 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
150         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
151                 let contents = if o.result_ok {
152                         let result = unsafe { o.contents.result };
153                         unsafe { o.contents.result = std::ptr::null_mut() };
154                         CResult_OutPointDecodeErrorZPtr { result }
155                 } else {
156                         let err = unsafe { o.contents.err };
157                         unsafe { o.contents.err = std::ptr::null_mut(); }
158                         CResult_OutPointDecodeErrorZPtr { err }
159                 };
160                 Self {
161                         contents,
162                         result_ok: o.result_ok,
163                 }
164         }
165 }
166 impl Clone for CResult_OutPointDecodeErrorZ {
167         fn clone(&self) -> Self {
168                 if self.result_ok {
169                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
170                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
171                         } }
172                 } else {
173                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
174                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
175                         } }
176                 }
177         }
178 }
179 #[no_mangle]
180 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
181 /// but with all dynamically-allocated buffers duplicated in new buffers.
182 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
183 #[repr(C)]
184 /// The contents of CResult_SecretKeyErrorZ
185 pub union CResult_SecretKeyErrorZPtr {
186         /// A pointer to the contents in the success state.
187         /// Reading from this pointer when `result_ok` is not set is undefined.
188         pub result: *mut crate::c_types::SecretKey,
189         /// A pointer to the contents in the error state.
190         /// Reading from this pointer when `result_ok` is set is undefined.
191         pub err: *mut crate::c_types::Secp256k1Error,
192 }
193 #[repr(C)]
194 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
195 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
197 pub struct CResult_SecretKeyErrorZ {
198         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
199         /// `err` or `result` depending on the state of `result_ok`.
200         pub contents: CResult_SecretKeyErrorZPtr,
201         /// Whether this CResult_SecretKeyErrorZ represents a success state.
202         pub result_ok: bool,
203 }
204 #[no_mangle]
205 /// Creates a new CResult_SecretKeyErrorZ in the success state.
206 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
207         CResult_SecretKeyErrorZ {
208                 contents: CResult_SecretKeyErrorZPtr {
209                         result: Box::into_raw(Box::new(o)),
210                 },
211                 result_ok: true,
212         }
213 }
214 #[no_mangle]
215 /// Creates a new CResult_SecretKeyErrorZ in the error state.
216 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
217         CResult_SecretKeyErrorZ {
218                 contents: CResult_SecretKeyErrorZPtr {
219                         err: Box::into_raw(Box::new(e)),
220                 },
221                 result_ok: false,
222         }
223 }
224 #[no_mangle]
225 /// Frees any resources used by the CResult_SecretKeyErrorZ.
226 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
227 impl Drop for CResult_SecretKeyErrorZ {
228         fn drop(&mut self) {
229                 if self.result_ok {
230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
232                         }
233                 } else {
234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
236                         }
237                 }
238         }
239 }
240 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
241         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
242                 let contents = if o.result_ok {
243                         let result = unsafe { o.contents.result };
244                         unsafe { o.contents.result = std::ptr::null_mut() };
245                         CResult_SecretKeyErrorZPtr { result }
246                 } else {
247                         let err = unsafe { o.contents.err };
248                         unsafe { o.contents.err = std::ptr::null_mut(); }
249                         CResult_SecretKeyErrorZPtr { err }
250                 };
251                 Self {
252                         contents,
253                         result_ok: o.result_ok,
254                 }
255         }
256 }
257 #[repr(C)]
258 /// The contents of CResult_PublicKeyErrorZ
259 pub union CResult_PublicKeyErrorZPtr {
260         /// A pointer to the contents in the success state.
261         /// Reading from this pointer when `result_ok` is not set is undefined.
262         pub result: *mut crate::c_types::PublicKey,
263         /// A pointer to the contents in the error state.
264         /// Reading from this pointer when `result_ok` is set is undefined.
265         pub err: *mut crate::c_types::Secp256k1Error,
266 }
267 #[repr(C)]
268 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
269 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
271 pub struct CResult_PublicKeyErrorZ {
272         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
273         /// `err` or `result` depending on the state of `result_ok`.
274         pub contents: CResult_PublicKeyErrorZPtr,
275         /// Whether this CResult_PublicKeyErrorZ represents a success state.
276         pub result_ok: bool,
277 }
278 #[no_mangle]
279 /// Creates a new CResult_PublicKeyErrorZ in the success state.
280 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
281         CResult_PublicKeyErrorZ {
282                 contents: CResult_PublicKeyErrorZPtr {
283                         result: Box::into_raw(Box::new(o)),
284                 },
285                 result_ok: true,
286         }
287 }
288 #[no_mangle]
289 /// Creates a new CResult_PublicKeyErrorZ in the error state.
290 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
291         CResult_PublicKeyErrorZ {
292                 contents: CResult_PublicKeyErrorZPtr {
293                         err: Box::into_raw(Box::new(e)),
294                 },
295                 result_ok: false,
296         }
297 }
298 #[no_mangle]
299 /// Frees any resources used by the CResult_PublicKeyErrorZ.
300 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
301 impl Drop for CResult_PublicKeyErrorZ {
302         fn drop(&mut self) {
303                 if self.result_ok {
304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
306                         }
307                 } else {
308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
310                         }
311                 }
312         }
313 }
314 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
315         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
316                 let contents = if o.result_ok {
317                         let result = unsafe { o.contents.result };
318                         unsafe { o.contents.result = std::ptr::null_mut() };
319                         CResult_PublicKeyErrorZPtr { result }
320                 } else {
321                         let err = unsafe { o.contents.err };
322                         unsafe { o.contents.err = std::ptr::null_mut(); }
323                         CResult_PublicKeyErrorZPtr { err }
324                 };
325                 Self {
326                         contents,
327                         result_ok: o.result_ok,
328                 }
329         }
330 }
331 #[repr(C)]
332 /// The contents of CResult_TxCreationKeysDecodeErrorZ
333 pub union CResult_TxCreationKeysDecodeErrorZPtr {
334         /// A pointer to the contents in the success state.
335         /// Reading from this pointer when `result_ok` is not set is undefined.
336         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
337         /// A pointer to the contents in the error state.
338         /// Reading from this pointer when `result_ok` is set is undefined.
339         pub err: *mut crate::lightning::ln::msgs::DecodeError,
340 }
341 #[repr(C)]
342 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
343 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
345 pub struct CResult_TxCreationKeysDecodeErrorZ {
346         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
347         /// `err` or `result` depending on the state of `result_ok`.
348         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
349         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
350         pub result_ok: bool,
351 }
352 #[no_mangle]
353 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
354 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
355         CResult_TxCreationKeysDecodeErrorZ {
356                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
357                         result: Box::into_raw(Box::new(o)),
358                 },
359                 result_ok: true,
360         }
361 }
362 #[no_mangle]
363 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
364 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
365         CResult_TxCreationKeysDecodeErrorZ {
366                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
367                         err: Box::into_raw(Box::new(e)),
368                 },
369                 result_ok: false,
370         }
371 }
372 #[no_mangle]
373 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
374 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
375 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
376         fn drop(&mut self) {
377                 if self.result_ok {
378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
380                         }
381                 } else {
382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
384                         }
385                 }
386         }
387 }
388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
389         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
390                 let contents = if o.result_ok {
391                         let result = unsafe { o.contents.result };
392                         unsafe { o.contents.result = std::ptr::null_mut() };
393                         CResult_TxCreationKeysDecodeErrorZPtr { result }
394                 } else {
395                         let err = unsafe { o.contents.err };
396                         unsafe { o.contents.err = std::ptr::null_mut(); }
397                         CResult_TxCreationKeysDecodeErrorZPtr { err }
398                 };
399                 Self {
400                         contents,
401                         result_ok: o.result_ok,
402                 }
403         }
404 }
405 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
406         fn clone(&self) -> Self {
407                 if self.result_ok {
408                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
409                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
410                         } }
411                 } else {
412                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
413                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
414                         } }
415                 }
416         }
417 }
418 #[no_mangle]
419 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
420 /// but with all dynamically-allocated buffers duplicated in new buffers.
421 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
422 #[repr(C)]
423 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
424 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
425         /// A pointer to the contents in the success state.
426         /// Reading from this pointer when `result_ok` is not set is undefined.
427         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
428         /// A pointer to the contents in the error state.
429         /// Reading from this pointer when `result_ok` is set is undefined.
430         pub err: *mut crate::lightning::ln::msgs::DecodeError,
431 }
432 #[repr(C)]
433 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
434 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
436 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
437         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
438         /// `err` or `result` depending on the state of `result_ok`.
439         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
440         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
441         pub result_ok: bool,
442 }
443 #[no_mangle]
444 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
445 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
446         CResult_ChannelPublicKeysDecodeErrorZ {
447                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
448                         result: Box::into_raw(Box::new(o)),
449                 },
450                 result_ok: true,
451         }
452 }
453 #[no_mangle]
454 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
455 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
456         CResult_ChannelPublicKeysDecodeErrorZ {
457                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
458                         err: Box::into_raw(Box::new(e)),
459                 },
460                 result_ok: false,
461         }
462 }
463 #[no_mangle]
464 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
465 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
466 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
467         fn drop(&mut self) {
468                 if self.result_ok {
469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
471                         }
472                 } else {
473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
475                         }
476                 }
477         }
478 }
479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
481                 let contents = if o.result_ok {
482                         let result = unsafe { o.contents.result };
483                         unsafe { o.contents.result = std::ptr::null_mut() };
484                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
485                 } else {
486                         let err = unsafe { o.contents.err };
487                         unsafe { o.contents.err = std::ptr::null_mut(); }
488                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
489                 };
490                 Self {
491                         contents,
492                         result_ok: o.result_ok,
493                 }
494         }
495 }
496 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
497         fn clone(&self) -> Self {
498                 if self.result_ok {
499                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
501                         } }
502                 } else {
503                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
505                         } }
506                 }
507         }
508 }
509 #[no_mangle]
510 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
511 /// but with all dynamically-allocated buffers duplicated in new buffers.
512 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
513 #[repr(C)]
514 /// The contents of CResult_TxCreationKeysErrorZ
515 pub union CResult_TxCreationKeysErrorZPtr {
516         /// A pointer to the contents in the success state.
517         /// Reading from this pointer when `result_ok` is not set is undefined.
518         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
519         /// A pointer to the contents in the error state.
520         /// Reading from this pointer when `result_ok` is set is undefined.
521         pub err: *mut crate::c_types::Secp256k1Error,
522 }
523 #[repr(C)]
524 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
525 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
527 pub struct CResult_TxCreationKeysErrorZ {
528         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
529         /// `err` or `result` depending on the state of `result_ok`.
530         pub contents: CResult_TxCreationKeysErrorZPtr,
531         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
532         pub result_ok: bool,
533 }
534 #[no_mangle]
535 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
536 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
537         CResult_TxCreationKeysErrorZ {
538                 contents: CResult_TxCreationKeysErrorZPtr {
539                         result: Box::into_raw(Box::new(o)),
540                 },
541                 result_ok: true,
542         }
543 }
544 #[no_mangle]
545 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
546 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
547         CResult_TxCreationKeysErrorZ {
548                 contents: CResult_TxCreationKeysErrorZPtr {
549                         err: Box::into_raw(Box::new(e)),
550                 },
551                 result_ok: false,
552         }
553 }
554 #[no_mangle]
555 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
556 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
557 impl Drop for CResult_TxCreationKeysErrorZ {
558         fn drop(&mut self) {
559                 if self.result_ok {
560                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
561                                 let _ = unsafe { Box::from_raw(self.contents.result) };
562                         }
563                 } else {
564                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
565                                 let _ = unsafe { Box::from_raw(self.contents.err) };
566                         }
567                 }
568         }
569 }
570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
571         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
572                 let contents = if o.result_ok {
573                         let result = unsafe { o.contents.result };
574                         unsafe { o.contents.result = std::ptr::null_mut() };
575                         CResult_TxCreationKeysErrorZPtr { result }
576                 } else {
577                         let err = unsafe { o.contents.err };
578                         unsafe { o.contents.err = std::ptr::null_mut(); }
579                         CResult_TxCreationKeysErrorZPtr { err }
580                 };
581                 Self {
582                         contents,
583                         result_ok: o.result_ok,
584                 }
585         }
586 }
587 #[repr(C)]
588 #[derive(Clone)]
589 /// An enum which can either contain a u32 or not
590 pub enum COption_u32Z {
591         /// When we're in this state, this COption_u32Z contains a u32
592         Some(u32),
593         /// When we're in this state, this COption_u32Z contains nothing
594         None
595 }
596 impl COption_u32Z {
597         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
598                 if let Self::Some(_) = self { true } else { false }
599         }
600         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
601                 if let Self::Some(v) = self { v } else { unreachable!() }
602         }
603 }
604 #[no_mangle]
605 /// Constructs a new COption_u32Z containing a u32
606 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
607         COption_u32Z::Some(o)
608 }
609 #[no_mangle]
610 /// Constructs a new COption_u32Z containing nothing
611 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
612         COption_u32Z::None
613 }
614 #[no_mangle]
615 /// Frees any resources associated with the u32, if we are in the Some state
616 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
617 #[no_mangle]
618 /// Creates a new COption_u32Z which has the same data as `orig`
619 /// but with all dynamically-allocated buffers duplicated in new buffers.
620 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { orig.clone() }
621 #[repr(C)]
622 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
623 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
624         /// A pointer to the contents in the success state.
625         /// Reading from this pointer when `result_ok` is not set is undefined.
626         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
627         /// A pointer to the contents in the error state.
628         /// Reading from this pointer when `result_ok` is set is undefined.
629         pub err: *mut crate::lightning::ln::msgs::DecodeError,
630 }
631 #[repr(C)]
632 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
633 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
635 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
636         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
637         /// `err` or `result` depending on the state of `result_ok`.
638         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
639         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
640         pub result_ok: bool,
641 }
642 #[no_mangle]
643 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
644 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
645         CResult_HTLCOutputInCommitmentDecodeErrorZ {
646                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
647                         result: Box::into_raw(Box::new(o)),
648                 },
649                 result_ok: true,
650         }
651 }
652 #[no_mangle]
653 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
654 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
655         CResult_HTLCOutputInCommitmentDecodeErrorZ {
656                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
657                         err: Box::into_raw(Box::new(e)),
658                 },
659                 result_ok: false,
660         }
661 }
662 #[no_mangle]
663 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
664 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
665 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
666         fn drop(&mut self) {
667                 if self.result_ok {
668                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
669                                 let _ = unsafe { Box::from_raw(self.contents.result) };
670                         }
671                 } else {
672                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
673                                 let _ = unsafe { Box::from_raw(self.contents.err) };
674                         }
675                 }
676         }
677 }
678 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
679         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
680                 let contents = if o.result_ok {
681                         let result = unsafe { o.contents.result };
682                         unsafe { o.contents.result = std::ptr::null_mut() };
683                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
684                 } else {
685                         let err = unsafe { o.contents.err };
686                         unsafe { o.contents.err = std::ptr::null_mut(); }
687                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
688                 };
689                 Self {
690                         contents,
691                         result_ok: o.result_ok,
692                 }
693         }
694 }
695 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
696         fn clone(&self) -> Self {
697                 if self.result_ok {
698                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
699                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
700                         } }
701                 } else {
702                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
703                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
704                         } }
705                 }
706         }
707 }
708 #[no_mangle]
709 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
710 /// but with all dynamically-allocated buffers duplicated in new buffers.
711 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
712 #[repr(C)]
713 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
714 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
715         /// A pointer to the contents in the success state.
716         /// Reading from this pointer when `result_ok` is not set is undefined.
717         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
718         /// A pointer to the contents in the error state.
719         /// Reading from this pointer when `result_ok` is set is undefined.
720         pub err: *mut crate::lightning::ln::msgs::DecodeError,
721 }
722 #[repr(C)]
723 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
724 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
725 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
726 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
727         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
728         /// `err` or `result` depending on the state of `result_ok`.
729         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
730         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
731         pub result_ok: bool,
732 }
733 #[no_mangle]
734 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
735 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
736         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
737                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
738                         result: Box::into_raw(Box::new(o)),
739                 },
740                 result_ok: true,
741         }
742 }
743 #[no_mangle]
744 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
745 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
746         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
747                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
748                         err: Box::into_raw(Box::new(e)),
749                 },
750                 result_ok: false,
751         }
752 }
753 #[no_mangle]
754 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
755 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
756 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
757         fn drop(&mut self) {
758                 if self.result_ok {
759                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
760                                 let _ = unsafe { Box::from_raw(self.contents.result) };
761                         }
762                 } else {
763                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
764                                 let _ = unsafe { Box::from_raw(self.contents.err) };
765                         }
766                 }
767         }
768 }
769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
770         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
771                 let contents = if o.result_ok {
772                         let result = unsafe { o.contents.result };
773                         unsafe { o.contents.result = std::ptr::null_mut() };
774                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
775                 } else {
776                         let err = unsafe { o.contents.err };
777                         unsafe { o.contents.err = std::ptr::null_mut(); }
778                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
779                 };
780                 Self {
781                         contents,
782                         result_ok: o.result_ok,
783                 }
784         }
785 }
786 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
787         fn clone(&self) -> Self {
788                 if self.result_ok {
789                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
790                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
791                         } }
792                 } else {
793                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
794                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
795                         } }
796                 }
797         }
798 }
799 #[no_mangle]
800 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
801 /// but with all dynamically-allocated buffers duplicated in new buffers.
802 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
803 #[repr(C)]
804 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
805 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
806         /// A pointer to the contents in the success state.
807         /// Reading from this pointer when `result_ok` is not set is undefined.
808         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
809         /// A pointer to the contents in the error state.
810         /// Reading from this pointer when `result_ok` is set is undefined.
811         pub err: *mut crate::lightning::ln::msgs::DecodeError,
812 }
813 #[repr(C)]
814 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
815 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
816 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
817 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
818         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
819         /// `err` or `result` depending on the state of `result_ok`.
820         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
821         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
822         pub result_ok: bool,
823 }
824 #[no_mangle]
825 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
826 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
827         CResult_ChannelTransactionParametersDecodeErrorZ {
828                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
829                         result: Box::into_raw(Box::new(o)),
830                 },
831                 result_ok: true,
832         }
833 }
834 #[no_mangle]
835 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
836 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
837         CResult_ChannelTransactionParametersDecodeErrorZ {
838                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
839                         err: Box::into_raw(Box::new(e)),
840                 },
841                 result_ok: false,
842         }
843 }
844 #[no_mangle]
845 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
846 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
847 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
848         fn drop(&mut self) {
849                 if self.result_ok {
850                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
851                                 let _ = unsafe { Box::from_raw(self.contents.result) };
852                         }
853                 } else {
854                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
855                                 let _ = unsafe { Box::from_raw(self.contents.err) };
856                         }
857                 }
858         }
859 }
860 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
861         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
862                 let contents = if o.result_ok {
863                         let result = unsafe { o.contents.result };
864                         unsafe { o.contents.result = std::ptr::null_mut() };
865                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
866                 } else {
867                         let err = unsafe { o.contents.err };
868                         unsafe { o.contents.err = std::ptr::null_mut(); }
869                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
870                 };
871                 Self {
872                         contents,
873                         result_ok: o.result_ok,
874                 }
875         }
876 }
877 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
878         fn clone(&self) -> Self {
879                 if self.result_ok {
880                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
881                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
882                         } }
883                 } else {
884                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
885                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
886                         } }
887                 }
888         }
889 }
890 #[no_mangle]
891 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
892 /// but with all dynamically-allocated buffers duplicated in new buffers.
893 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
894 #[repr(C)]
895 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
896 /// This corresponds to std::vector in C++
897 pub struct CVec_SignatureZ {
898         /// The elements in the array.
899         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
900         pub data: *mut crate::c_types::Signature,
901         /// The number of elements pointed to by `data`.
902         pub datalen: usize
903 }
904 impl CVec_SignatureZ {
905         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
906                 if self.datalen == 0 { return Vec::new(); }
907                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
908                 self.data = std::ptr::null_mut();
909                 self.datalen = 0;
910                 ret
911         }
912         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
913                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
914         }
915 }
916 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
917         fn from(v: Vec<crate::c_types::Signature>) -> Self {
918                 let datalen = v.len();
919                 let data = Box::into_raw(v.into_boxed_slice());
920                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
921         }
922 }
923 #[no_mangle]
924 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
925 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
926 impl Drop for CVec_SignatureZ {
927         fn drop(&mut self) {
928                 if self.datalen == 0 { return; }
929                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
930         }
931 }
932 impl Clone for CVec_SignatureZ {
933         fn clone(&self) -> Self {
934                 let mut res = Vec::new();
935                 if self.datalen == 0 { return Self::from(res); }
936                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
937                 Self::from(res)
938         }
939 }
940 #[repr(C)]
941 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
942 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
943         /// A pointer to the contents in the success state.
944         /// Reading from this pointer when `result_ok` is not set is undefined.
945         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
946         /// A pointer to the contents in the error state.
947         /// Reading from this pointer when `result_ok` is set is undefined.
948         pub err: *mut crate::lightning::ln::msgs::DecodeError,
949 }
950 #[repr(C)]
951 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
952 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
953 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
954 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
955         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
956         /// `err` or `result` depending on the state of `result_ok`.
957         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
958         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
959         pub result_ok: bool,
960 }
961 #[no_mangle]
962 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
963 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
964         CResult_HolderCommitmentTransactionDecodeErrorZ {
965                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
966                         result: Box::into_raw(Box::new(o)),
967                 },
968                 result_ok: true,
969         }
970 }
971 #[no_mangle]
972 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
973 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
974         CResult_HolderCommitmentTransactionDecodeErrorZ {
975                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
976                         err: Box::into_raw(Box::new(e)),
977                 },
978                 result_ok: false,
979         }
980 }
981 #[no_mangle]
982 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
983 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
984 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
985         fn drop(&mut self) {
986                 if self.result_ok {
987                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
988                                 let _ = unsafe { Box::from_raw(self.contents.result) };
989                         }
990                 } else {
991                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
992                                 let _ = unsafe { Box::from_raw(self.contents.err) };
993                         }
994                 }
995         }
996 }
997 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
998         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
999                 let contents = if o.result_ok {
1000                         let result = unsafe { o.contents.result };
1001                         unsafe { o.contents.result = std::ptr::null_mut() };
1002                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1003                 } else {
1004                         let err = unsafe { o.contents.err };
1005                         unsafe { o.contents.err = std::ptr::null_mut(); }
1006                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1007                 };
1008                 Self {
1009                         contents,
1010                         result_ok: o.result_ok,
1011                 }
1012         }
1013 }
1014 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1015         fn clone(&self) -> Self {
1016                 if self.result_ok {
1017                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1018                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1019                         } }
1020                 } else {
1021                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1022                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1023                         } }
1024                 }
1025         }
1026 }
1027 #[no_mangle]
1028 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1029 /// but with all dynamically-allocated buffers duplicated in new buffers.
1030 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
1031 #[repr(C)]
1032 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1033 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1034         /// A pointer to the contents in the success state.
1035         /// Reading from this pointer when `result_ok` is not set is undefined.
1036         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1037         /// A pointer to the contents in the error state.
1038         /// Reading from this pointer when `result_ok` is set is undefined.
1039         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1040 }
1041 #[repr(C)]
1042 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1043 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1045 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1046         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1047         /// `err` or `result` depending on the state of `result_ok`.
1048         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1049         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1050         pub result_ok: bool,
1051 }
1052 #[no_mangle]
1053 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1054 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1055         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1056                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1057                         result: Box::into_raw(Box::new(o)),
1058                 },
1059                 result_ok: true,
1060         }
1061 }
1062 #[no_mangle]
1063 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1064 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1065         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1066                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1067                         err: Box::into_raw(Box::new(e)),
1068                 },
1069                 result_ok: false,
1070         }
1071 }
1072 #[no_mangle]
1073 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1074 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1075 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1076         fn drop(&mut self) {
1077                 if self.result_ok {
1078                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1079                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1080                         }
1081                 } else {
1082                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1083                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1084                         }
1085                 }
1086         }
1087 }
1088 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1089         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1090                 let contents = if o.result_ok {
1091                         let result = unsafe { o.contents.result };
1092                         unsafe { o.contents.result = std::ptr::null_mut() };
1093                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1094                 } else {
1095                         let err = unsafe { o.contents.err };
1096                         unsafe { o.contents.err = std::ptr::null_mut(); }
1097                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1098                 };
1099                 Self {
1100                         contents,
1101                         result_ok: o.result_ok,
1102                 }
1103         }
1104 }
1105 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1106         fn clone(&self) -> Self {
1107                 if self.result_ok {
1108                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1109                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1110                         } }
1111                 } else {
1112                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1113                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1114                         } }
1115                 }
1116         }
1117 }
1118 #[no_mangle]
1119 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1120 /// but with all dynamically-allocated buffers duplicated in new buffers.
1121 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
1122 #[repr(C)]
1123 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1124 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1125         /// A pointer to the contents in the success state.
1126         /// Reading from this pointer when `result_ok` is not set is undefined.
1127         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1128         /// A pointer to the contents in the error state.
1129         /// Reading from this pointer when `result_ok` is set is undefined.
1130         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1131 }
1132 #[repr(C)]
1133 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1134 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1136 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1137         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1138         /// `err` or `result` depending on the state of `result_ok`.
1139         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1140         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1141         pub result_ok: bool,
1142 }
1143 #[no_mangle]
1144 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1145 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1146         CResult_CommitmentTransactionDecodeErrorZ {
1147                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1148                         result: Box::into_raw(Box::new(o)),
1149                 },
1150                 result_ok: true,
1151         }
1152 }
1153 #[no_mangle]
1154 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1155 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1156         CResult_CommitmentTransactionDecodeErrorZ {
1157                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1158                         err: Box::into_raw(Box::new(e)),
1159                 },
1160                 result_ok: false,
1161         }
1162 }
1163 #[no_mangle]
1164 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1165 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1166 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1167         fn drop(&mut self) {
1168                 if self.result_ok {
1169                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1170                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1171                         }
1172                 } else {
1173                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1174                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1175                         }
1176                 }
1177         }
1178 }
1179 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1180         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1181                 let contents = if o.result_ok {
1182                         let result = unsafe { o.contents.result };
1183                         unsafe { o.contents.result = std::ptr::null_mut() };
1184                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1185                 } else {
1186                         let err = unsafe { o.contents.err };
1187                         unsafe { o.contents.err = std::ptr::null_mut(); }
1188                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1189                 };
1190                 Self {
1191                         contents,
1192                         result_ok: o.result_ok,
1193                 }
1194         }
1195 }
1196 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1197         fn clone(&self) -> Self {
1198                 if self.result_ok {
1199                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1200                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1201                         } }
1202                 } else {
1203                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1204                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1205                         } }
1206                 }
1207         }
1208 }
1209 #[no_mangle]
1210 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1211 /// but with all dynamically-allocated buffers duplicated in new buffers.
1212 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
1213 #[repr(C)]
1214 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1215 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1216         /// A pointer to the contents in the success state.
1217         /// Reading from this pointer when `result_ok` is not set is undefined.
1218         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1219         /// Note that this value is always NULL, as there are no contents in the Err variant
1220         pub err: *mut std::ffi::c_void,
1221 }
1222 #[repr(C)]
1223 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1224 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1225 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1226 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1227         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1228         /// `err` or `result` depending on the state of `result_ok`.
1229         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1230         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1231         pub result_ok: bool,
1232 }
1233 #[no_mangle]
1234 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1235 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1236         CResult_TrustedCommitmentTransactionNoneZ {
1237                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1238                         result: Box::into_raw(Box::new(o)),
1239                 },
1240                 result_ok: true,
1241         }
1242 }
1243 #[no_mangle]
1244 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1245 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1246         CResult_TrustedCommitmentTransactionNoneZ {
1247                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1248                         err: std::ptr::null_mut(),
1249                 },
1250                 result_ok: false,
1251         }
1252 }
1253 #[no_mangle]
1254 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1255 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1256 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1257         fn drop(&mut self) {
1258                 if self.result_ok {
1259                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1260                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1261                         }
1262                 } else {
1263                 }
1264         }
1265 }
1266 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1267         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1268                 let contents = if o.result_ok {
1269                         let result = unsafe { o.contents.result };
1270                         unsafe { o.contents.result = std::ptr::null_mut() };
1271                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1272                 } else {
1273                         let _ = unsafe { Box::from_raw(o.contents.err) };
1274                         o.contents.err = std::ptr::null_mut();
1275                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1276                 };
1277                 Self {
1278                         contents,
1279                         result_ok: o.result_ok,
1280                 }
1281         }
1282 }
1283 #[repr(C)]
1284 /// The contents of CResult_CVec_SignatureZNoneZ
1285 pub union CResult_CVec_SignatureZNoneZPtr {
1286         /// A pointer to the contents in the success state.
1287         /// Reading from this pointer when `result_ok` is not set is undefined.
1288         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1289         /// Note that this value is always NULL, as there are no contents in the Err variant
1290         pub err: *mut std::ffi::c_void,
1291 }
1292 #[repr(C)]
1293 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1294 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1296 pub struct CResult_CVec_SignatureZNoneZ {
1297         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1298         /// `err` or `result` depending on the state of `result_ok`.
1299         pub contents: CResult_CVec_SignatureZNoneZPtr,
1300         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1301         pub result_ok: bool,
1302 }
1303 #[no_mangle]
1304 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1305 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1306         CResult_CVec_SignatureZNoneZ {
1307                 contents: CResult_CVec_SignatureZNoneZPtr {
1308                         result: Box::into_raw(Box::new(o)),
1309                 },
1310                 result_ok: true,
1311         }
1312 }
1313 #[no_mangle]
1314 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1315 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1316         CResult_CVec_SignatureZNoneZ {
1317                 contents: CResult_CVec_SignatureZNoneZPtr {
1318                         err: std::ptr::null_mut(),
1319                 },
1320                 result_ok: false,
1321         }
1322 }
1323 #[no_mangle]
1324 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1325 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1326 impl Drop for CResult_CVec_SignatureZNoneZ {
1327         fn drop(&mut self) {
1328                 if self.result_ok {
1329                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1330                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1331                         }
1332                 } else {
1333                 }
1334         }
1335 }
1336 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1337         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1338                 let contents = if o.result_ok {
1339                         let result = unsafe { o.contents.result };
1340                         unsafe { o.contents.result = std::ptr::null_mut() };
1341                         CResult_CVec_SignatureZNoneZPtr { result }
1342                 } else {
1343                         let _ = unsafe { Box::from_raw(o.contents.err) };
1344                         o.contents.err = std::ptr::null_mut();
1345                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1346                 };
1347                 Self {
1348                         contents,
1349                         result_ok: o.result_ok,
1350                 }
1351         }
1352 }
1353 impl Clone for CResult_CVec_SignatureZNoneZ {
1354         fn clone(&self) -> Self {
1355                 if self.result_ok {
1356                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1357                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1358                         } }
1359                 } else {
1360                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1361                                 err: std::ptr::null_mut()
1362                         } }
1363                 }
1364         }
1365 }
1366 #[no_mangle]
1367 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1368 /// but with all dynamically-allocated buffers duplicated in new buffers.
1369 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
1370 #[repr(C)]
1371 /// The contents of CResult_SiPrefixNoneZ
1372 pub union CResult_SiPrefixNoneZPtr {
1373         /// A pointer to the contents in the success state.
1374         /// Reading from this pointer when `result_ok` is not set is undefined.
1375         pub result: *mut crate::lightning_invoice::SiPrefix,
1376         /// Note that this value is always NULL, as there are no contents in the Err variant
1377         pub err: *mut std::ffi::c_void,
1378 }
1379 #[repr(C)]
1380 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
1381 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
1382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1383 pub struct CResult_SiPrefixNoneZ {
1384         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
1385         /// `err` or `result` depending on the state of `result_ok`.
1386         pub contents: CResult_SiPrefixNoneZPtr,
1387         /// Whether this CResult_SiPrefixNoneZ represents a success state.
1388         pub result_ok: bool,
1389 }
1390 #[no_mangle]
1391 /// Creates a new CResult_SiPrefixNoneZ in the success state.
1392 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
1393         CResult_SiPrefixNoneZ {
1394                 contents: CResult_SiPrefixNoneZPtr {
1395                         result: Box::into_raw(Box::new(o)),
1396                 },
1397                 result_ok: true,
1398         }
1399 }
1400 #[no_mangle]
1401 /// Creates a new CResult_SiPrefixNoneZ in the error state.
1402 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
1403         CResult_SiPrefixNoneZ {
1404                 contents: CResult_SiPrefixNoneZPtr {
1405                         err: std::ptr::null_mut(),
1406                 },
1407                 result_ok: false,
1408         }
1409 }
1410 #[no_mangle]
1411 /// Frees any resources used by the CResult_SiPrefixNoneZ.
1412 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
1413 impl Drop for CResult_SiPrefixNoneZ {
1414         fn drop(&mut self) {
1415                 if self.result_ok {
1416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1418                         }
1419                 } else {
1420                 }
1421         }
1422 }
1423 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
1424         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
1425                 let contents = if o.result_ok {
1426                         let result = unsafe { o.contents.result };
1427                         unsafe { o.contents.result = std::ptr::null_mut() };
1428                         CResult_SiPrefixNoneZPtr { result }
1429                 } else {
1430                         let _ = unsafe { Box::from_raw(o.contents.err) };
1431                         o.contents.err = std::ptr::null_mut();
1432                         CResult_SiPrefixNoneZPtr { err: std::ptr::null_mut() }
1433                 };
1434                 Self {
1435                         contents,
1436                         result_ok: o.result_ok,
1437                 }
1438         }
1439 }
1440 impl Clone for CResult_SiPrefixNoneZ {
1441         fn clone(&self) -> Self {
1442                 if self.result_ok {
1443                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
1444                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
1445                         } }
1446                 } else {
1447                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
1448                                 err: std::ptr::null_mut()
1449                         } }
1450                 }
1451         }
1452 }
1453 #[no_mangle]
1454 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
1455 /// but with all dynamically-allocated buffers duplicated in new buffers.
1456 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { orig.clone() }
1457 #[repr(C)]
1458 /// The contents of CResult_InvoiceNoneZ
1459 pub union CResult_InvoiceNoneZPtr {
1460         /// A pointer to the contents in the success state.
1461         /// Reading from this pointer when `result_ok` is not set is undefined.
1462         pub result: *mut crate::lightning_invoice::Invoice,
1463         /// Note that this value is always NULL, as there are no contents in the Err variant
1464         pub err: *mut std::ffi::c_void,
1465 }
1466 #[repr(C)]
1467 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
1468 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
1469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1470 pub struct CResult_InvoiceNoneZ {
1471         /// The contents of this CResult_InvoiceNoneZ, accessible via either
1472         /// `err` or `result` depending on the state of `result_ok`.
1473         pub contents: CResult_InvoiceNoneZPtr,
1474         /// Whether this CResult_InvoiceNoneZ represents a success state.
1475         pub result_ok: bool,
1476 }
1477 #[no_mangle]
1478 /// Creates a new CResult_InvoiceNoneZ in the success state.
1479 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
1480         CResult_InvoiceNoneZ {
1481                 contents: CResult_InvoiceNoneZPtr {
1482                         result: Box::into_raw(Box::new(o)),
1483                 },
1484                 result_ok: true,
1485         }
1486 }
1487 #[no_mangle]
1488 /// Creates a new CResult_InvoiceNoneZ in the error state.
1489 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
1490         CResult_InvoiceNoneZ {
1491                 contents: CResult_InvoiceNoneZPtr {
1492                         err: std::ptr::null_mut(),
1493                 },
1494                 result_ok: false,
1495         }
1496 }
1497 #[no_mangle]
1498 /// Frees any resources used by the CResult_InvoiceNoneZ.
1499 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
1500 impl Drop for CResult_InvoiceNoneZ {
1501         fn drop(&mut self) {
1502                 if self.result_ok {
1503                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1504                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1505                         }
1506                 } else {
1507                 }
1508         }
1509 }
1510 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
1511         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
1512                 let contents = if o.result_ok {
1513                         let result = unsafe { o.contents.result };
1514                         unsafe { o.contents.result = std::ptr::null_mut() };
1515                         CResult_InvoiceNoneZPtr { result }
1516                 } else {
1517                         let _ = unsafe { Box::from_raw(o.contents.err) };
1518                         o.contents.err = std::ptr::null_mut();
1519                         CResult_InvoiceNoneZPtr { err: std::ptr::null_mut() }
1520                 };
1521                 Self {
1522                         contents,
1523                         result_ok: o.result_ok,
1524                 }
1525         }
1526 }
1527 impl Clone for CResult_InvoiceNoneZ {
1528         fn clone(&self) -> Self {
1529                 if self.result_ok {
1530                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
1531                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
1532                         } }
1533                 } else {
1534                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
1535                                 err: std::ptr::null_mut()
1536                         } }
1537                 }
1538         }
1539 }
1540 #[no_mangle]
1541 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
1542 /// but with all dynamically-allocated buffers duplicated in new buffers.
1543 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { orig.clone() }
1544 #[repr(C)]
1545 /// The contents of CResult_SignedRawInvoiceNoneZ
1546 pub union CResult_SignedRawInvoiceNoneZPtr {
1547         /// A pointer to the contents in the success state.
1548         /// Reading from this pointer when `result_ok` is not set is undefined.
1549         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
1550         /// Note that this value is always NULL, as there are no contents in the Err variant
1551         pub err: *mut std::ffi::c_void,
1552 }
1553 #[repr(C)]
1554 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
1555 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
1556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1557 pub struct CResult_SignedRawInvoiceNoneZ {
1558         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
1559         /// `err` or `result` depending on the state of `result_ok`.
1560         pub contents: CResult_SignedRawInvoiceNoneZPtr,
1561         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
1562         pub result_ok: bool,
1563 }
1564 #[no_mangle]
1565 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
1566 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
1567         CResult_SignedRawInvoiceNoneZ {
1568                 contents: CResult_SignedRawInvoiceNoneZPtr {
1569                         result: Box::into_raw(Box::new(o)),
1570                 },
1571                 result_ok: true,
1572         }
1573 }
1574 #[no_mangle]
1575 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
1576 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
1577         CResult_SignedRawInvoiceNoneZ {
1578                 contents: CResult_SignedRawInvoiceNoneZPtr {
1579                         err: std::ptr::null_mut(),
1580                 },
1581                 result_ok: false,
1582         }
1583 }
1584 #[no_mangle]
1585 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
1586 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
1587 impl Drop for CResult_SignedRawInvoiceNoneZ {
1588         fn drop(&mut self) {
1589                 if self.result_ok {
1590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1592                         }
1593                 } else {
1594                 }
1595         }
1596 }
1597 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
1598         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
1599                 let contents = if o.result_ok {
1600                         let result = unsafe { o.contents.result };
1601                         unsafe { o.contents.result = std::ptr::null_mut() };
1602                         CResult_SignedRawInvoiceNoneZPtr { result }
1603                 } else {
1604                         let _ = unsafe { Box::from_raw(o.contents.err) };
1605                         o.contents.err = std::ptr::null_mut();
1606                         CResult_SignedRawInvoiceNoneZPtr { err: std::ptr::null_mut() }
1607                 };
1608                 Self {
1609                         contents,
1610                         result_ok: o.result_ok,
1611                 }
1612         }
1613 }
1614 impl Clone for CResult_SignedRawInvoiceNoneZ {
1615         fn clone(&self) -> Self {
1616                 if self.result_ok {
1617                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
1618                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
1619                         } }
1620                 } else {
1621                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
1622                                 err: std::ptr::null_mut()
1623                         } }
1624                 }
1625         }
1626 }
1627 #[no_mangle]
1628 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
1629 /// but with all dynamically-allocated buffers duplicated in new buffers.
1630 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { orig.clone() }
1631 #[repr(C)]
1632 /// A dynamically-allocated array of u8s of arbitrary size.
1633 /// This corresponds to std::vector in C++
1634 pub struct CVec_u8Z {
1635         /// The elements in the array.
1636         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1637         pub data: *mut u8,
1638         /// The number of elements pointed to by `data`.
1639         pub datalen: usize
1640 }
1641 impl CVec_u8Z {
1642         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
1643                 if self.datalen == 0 { return Vec::new(); }
1644                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1645                 self.data = std::ptr::null_mut();
1646                 self.datalen = 0;
1647                 ret
1648         }
1649         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
1650                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1651         }
1652 }
1653 impl From<Vec<u8>> for CVec_u8Z {
1654         fn from(v: Vec<u8>) -> Self {
1655                 let datalen = v.len();
1656                 let data = Box::into_raw(v.into_boxed_slice());
1657                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1658         }
1659 }
1660 #[no_mangle]
1661 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1662 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1663 impl Drop for CVec_u8Z {
1664         fn drop(&mut self) {
1665                 if self.datalen == 0 { return; }
1666                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1667         }
1668 }
1669 impl Clone for CVec_u8Z {
1670         fn clone(&self) -> Self {
1671                 let mut res = Vec::new();
1672                 if self.datalen == 0 { return Self::from(res); }
1673                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1674                 Self::from(res)
1675         }
1676 }
1677 #[repr(C)]
1678 /// A tuple of 3 elements. See the individual fields for the types contained.
1679 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1680         /// The element at position 0
1681         pub a: crate::lightning_invoice::RawInvoice,
1682         /// The element at position 1
1683         pub b: crate::c_types::ThirtyTwoBytes,
1684         /// The element at position 2
1685         pub c: crate::lightning_invoice::InvoiceSignature,
1686 }
1687 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1688         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
1689                 Self {
1690                         a: tup.0,
1691                         b: tup.1,
1692                         c: tup.2,
1693                 }
1694         }
1695 }
1696 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1697         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
1698                 (self.a, self.b, self.c)
1699         }
1700 }
1701 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
1702 #[no_mangle]
1703 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 {
1704         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
1705 }
1706
1707 #[no_mangle]
1708 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
1709 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
1710 #[repr(C)]
1711 /// The contents of CResult_PayeePubKeyErrorZ
1712 pub union CResult_PayeePubKeyErrorZPtr {
1713         /// A pointer to the contents in the success state.
1714         /// Reading from this pointer when `result_ok` is not set is undefined.
1715         pub result: *mut crate::lightning_invoice::PayeePubKey,
1716         /// A pointer to the contents in the error state.
1717         /// Reading from this pointer when `result_ok` is set is undefined.
1718         pub err: *mut crate::c_types::Secp256k1Error,
1719 }
1720 #[repr(C)]
1721 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1722 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1724 pub struct CResult_PayeePubKeyErrorZ {
1725         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1726         /// `err` or `result` depending on the state of `result_ok`.
1727         pub contents: CResult_PayeePubKeyErrorZPtr,
1728         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
1729         pub result_ok: bool,
1730 }
1731 #[no_mangle]
1732 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
1733 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
1734         CResult_PayeePubKeyErrorZ {
1735                 contents: CResult_PayeePubKeyErrorZPtr {
1736                         result: Box::into_raw(Box::new(o)),
1737                 },
1738                 result_ok: true,
1739         }
1740 }
1741 #[no_mangle]
1742 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
1743 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
1744         CResult_PayeePubKeyErrorZ {
1745                 contents: CResult_PayeePubKeyErrorZPtr {
1746                         err: Box::into_raw(Box::new(e)),
1747                 },
1748                 result_ok: false,
1749         }
1750 }
1751 #[no_mangle]
1752 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
1753 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
1754 impl Drop for CResult_PayeePubKeyErrorZ {
1755         fn drop(&mut self) {
1756                 if self.result_ok {
1757                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1758                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1759                         }
1760                 } else {
1761                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1762                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1763                         }
1764                 }
1765         }
1766 }
1767 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
1768         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
1769                 let contents = if o.result_ok {
1770                         let result = unsafe { o.contents.result };
1771                         unsafe { o.contents.result = std::ptr::null_mut() };
1772                         CResult_PayeePubKeyErrorZPtr { result }
1773                 } else {
1774                         let err = unsafe { o.contents.err };
1775                         unsafe { o.contents.err = std::ptr::null_mut(); }
1776                         CResult_PayeePubKeyErrorZPtr { err }
1777                 };
1778                 Self {
1779                         contents,
1780                         result_ok: o.result_ok,
1781                 }
1782         }
1783 }
1784 #[repr(C)]
1785 /// A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1786 /// This corresponds to std::vector in C++
1787 pub struct CVec_RouteHintZ {
1788         /// The elements in the array.
1789         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1790         pub data: *mut crate::lightning_invoice::RouteHint,
1791         /// The number of elements pointed to by `data`.
1792         pub datalen: usize
1793 }
1794 impl CVec_RouteHintZ {
1795         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RouteHint> {
1796                 if self.datalen == 0 { return Vec::new(); }
1797                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1798                 self.data = std::ptr::null_mut();
1799                 self.datalen = 0;
1800                 ret
1801         }
1802         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RouteHint] {
1803                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1804         }
1805 }
1806 impl From<Vec<crate::lightning_invoice::RouteHint>> for CVec_RouteHintZ {
1807         fn from(v: Vec<crate::lightning_invoice::RouteHint>) -> Self {
1808                 let datalen = v.len();
1809                 let data = Box::into_raw(v.into_boxed_slice());
1810                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1811         }
1812 }
1813 #[no_mangle]
1814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1815 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1816 impl Drop for CVec_RouteHintZ {
1817         fn drop(&mut self) {
1818                 if self.datalen == 0 { return; }
1819                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1820         }
1821 }
1822 impl Clone for CVec_RouteHintZ {
1823         fn clone(&self) -> Self {
1824                 let mut res = Vec::new();
1825                 if self.datalen == 0 { return Self::from(res); }
1826                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1827                 Self::from(res)
1828         }
1829 }
1830 #[repr(C)]
1831 #[derive(Clone)]
1832 /// An enum which can either contain a u64 or not
1833 pub enum COption_u64Z {
1834         /// When we're in this state, this COption_u64Z contains a u64
1835         Some(u64),
1836         /// When we're in this state, this COption_u64Z contains nothing
1837         None
1838 }
1839 impl COption_u64Z {
1840         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1841                 if let Self::Some(_) = self { true } else { false }
1842         }
1843         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1844                 if let Self::Some(v) = self { v } else { unreachable!() }
1845         }
1846 }
1847 #[no_mangle]
1848 /// Constructs a new COption_u64Z containing a u64
1849 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1850         COption_u64Z::Some(o)
1851 }
1852 #[no_mangle]
1853 /// Constructs a new COption_u64Z containing nothing
1854 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1855         COption_u64Z::None
1856 }
1857 #[no_mangle]
1858 /// Frees any resources associated with the u64, if we are in the Some state
1859 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1860 #[no_mangle]
1861 /// Creates a new COption_u64Z which has the same data as `orig`
1862 /// but with all dynamically-allocated buffers duplicated in new buffers.
1863 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1864 #[repr(C)]
1865 /// The contents of CResult_PositiveTimestampCreationErrorZ
1866 pub union CResult_PositiveTimestampCreationErrorZPtr {
1867         /// A pointer to the contents in the success state.
1868         /// Reading from this pointer when `result_ok` is not set is undefined.
1869         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
1870         /// A pointer to the contents in the error state.
1871         /// Reading from this pointer when `result_ok` is set is undefined.
1872         pub err: *mut crate::lightning_invoice::CreationError,
1873 }
1874 #[repr(C)]
1875 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1876 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1878 pub struct CResult_PositiveTimestampCreationErrorZ {
1879         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1880         /// `err` or `result` depending on the state of `result_ok`.
1881         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
1882         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1883         pub result_ok: bool,
1884 }
1885 #[no_mangle]
1886 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
1887 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
1888         CResult_PositiveTimestampCreationErrorZ {
1889                 contents: CResult_PositiveTimestampCreationErrorZPtr {
1890                         result: Box::into_raw(Box::new(o)),
1891                 },
1892                 result_ok: true,
1893         }
1894 }
1895 #[no_mangle]
1896 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
1897 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
1898         CResult_PositiveTimestampCreationErrorZ {
1899                 contents: CResult_PositiveTimestampCreationErrorZPtr {
1900                         err: Box::into_raw(Box::new(e)),
1901                 },
1902                 result_ok: false,
1903         }
1904 }
1905 #[no_mangle]
1906 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
1907 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
1908 impl Drop for CResult_PositiveTimestampCreationErrorZ {
1909         fn drop(&mut self) {
1910                 if self.result_ok {
1911                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1912                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1913                         }
1914                 } else {
1915                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1916                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1917                         }
1918                 }
1919         }
1920 }
1921 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
1922         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
1923                 let contents = if o.result_ok {
1924                         let result = unsafe { o.contents.result };
1925                         unsafe { o.contents.result = std::ptr::null_mut() };
1926                         CResult_PositiveTimestampCreationErrorZPtr { result }
1927                 } else {
1928                         let err = unsafe { o.contents.err };
1929                         unsafe { o.contents.err = std::ptr::null_mut(); }
1930                         CResult_PositiveTimestampCreationErrorZPtr { err }
1931                 };
1932                 Self {
1933                         contents,
1934                         result_ok: o.result_ok,
1935                 }
1936         }
1937 }
1938 impl Clone for CResult_PositiveTimestampCreationErrorZ {
1939         fn clone(&self) -> Self {
1940                 if self.result_ok {
1941                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
1942                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
1943                         } }
1944                 } else {
1945                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
1946                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
1947                         } }
1948                 }
1949         }
1950 }
1951 #[no_mangle]
1952 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
1953 /// but with all dynamically-allocated buffers duplicated in new buffers.
1954 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
1955 #[repr(C)]
1956 /// The contents of CResult_NoneSemanticErrorZ
1957 pub union CResult_NoneSemanticErrorZPtr {
1958         /// Note that this value is always NULL, as there are no contents in the OK variant
1959         pub result: *mut std::ffi::c_void,
1960         /// A pointer to the contents in the error state.
1961         /// Reading from this pointer when `result_ok` is set is undefined.
1962         pub err: *mut crate::lightning_invoice::SemanticError,
1963 }
1964 #[repr(C)]
1965 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1966 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1968 pub struct CResult_NoneSemanticErrorZ {
1969         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
1970         /// `err` or `result` depending on the state of `result_ok`.
1971         pub contents: CResult_NoneSemanticErrorZPtr,
1972         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
1973         pub result_ok: bool,
1974 }
1975 #[no_mangle]
1976 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
1977 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
1978         CResult_NoneSemanticErrorZ {
1979                 contents: CResult_NoneSemanticErrorZPtr {
1980                         result: std::ptr::null_mut(),
1981                 },
1982                 result_ok: true,
1983         }
1984 }
1985 #[no_mangle]
1986 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
1987 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
1988         CResult_NoneSemanticErrorZ {
1989                 contents: CResult_NoneSemanticErrorZPtr {
1990                         err: Box::into_raw(Box::new(e)),
1991                 },
1992                 result_ok: false,
1993         }
1994 }
1995 #[no_mangle]
1996 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
1997 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
1998 impl Drop for CResult_NoneSemanticErrorZ {
1999         fn drop(&mut self) {
2000                 if self.result_ok {
2001                 } else {
2002                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2003                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2004                         }
2005                 }
2006         }
2007 }
2008 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
2009         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
2010                 let contents = if o.result_ok {
2011                         let _ = unsafe { Box::from_raw(o.contents.result) };
2012                         o.contents.result = std::ptr::null_mut();
2013                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
2014                 } else {
2015                         let err = unsafe { o.contents.err };
2016                         unsafe { o.contents.err = std::ptr::null_mut(); }
2017                         CResult_NoneSemanticErrorZPtr { err }
2018                 };
2019                 Self {
2020                         contents,
2021                         result_ok: o.result_ok,
2022                 }
2023         }
2024 }
2025 impl Clone for CResult_NoneSemanticErrorZ {
2026         fn clone(&self) -> Self {
2027                 if self.result_ok {
2028                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
2029                                 result: std::ptr::null_mut()
2030                         } }
2031                 } else {
2032                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
2033                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
2034                         } }
2035                 }
2036         }
2037 }
2038 #[no_mangle]
2039 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
2040 /// but with all dynamically-allocated buffers duplicated in new buffers.
2041 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
2042 #[repr(C)]
2043 /// The contents of CResult_InvoiceSemanticErrorZ
2044 pub union CResult_InvoiceSemanticErrorZPtr {
2045         /// A pointer to the contents in the success state.
2046         /// Reading from this pointer when `result_ok` is not set is undefined.
2047         pub result: *mut crate::lightning_invoice::Invoice,
2048         /// A pointer to the contents in the error state.
2049         /// Reading from this pointer when `result_ok` is set is undefined.
2050         pub err: *mut crate::lightning_invoice::SemanticError,
2051 }
2052 #[repr(C)]
2053 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
2054 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
2055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2056 pub struct CResult_InvoiceSemanticErrorZ {
2057         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
2058         /// `err` or `result` depending on the state of `result_ok`.
2059         pub contents: CResult_InvoiceSemanticErrorZPtr,
2060         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
2061         pub result_ok: bool,
2062 }
2063 #[no_mangle]
2064 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
2065 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
2066         CResult_InvoiceSemanticErrorZ {
2067                 contents: CResult_InvoiceSemanticErrorZPtr {
2068                         result: Box::into_raw(Box::new(o)),
2069                 },
2070                 result_ok: true,
2071         }
2072 }
2073 #[no_mangle]
2074 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
2075 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
2076         CResult_InvoiceSemanticErrorZ {
2077                 contents: CResult_InvoiceSemanticErrorZPtr {
2078                         err: Box::into_raw(Box::new(e)),
2079                 },
2080                 result_ok: false,
2081         }
2082 }
2083 #[no_mangle]
2084 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
2085 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
2086 impl Drop for CResult_InvoiceSemanticErrorZ {
2087         fn drop(&mut self) {
2088                 if self.result_ok {
2089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2091                         }
2092                 } else {
2093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2095                         }
2096                 }
2097         }
2098 }
2099 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
2100         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
2101                 let contents = if o.result_ok {
2102                         let result = unsafe { o.contents.result };
2103                         unsafe { o.contents.result = std::ptr::null_mut() };
2104                         CResult_InvoiceSemanticErrorZPtr { result }
2105                 } else {
2106                         let err = unsafe { o.contents.err };
2107                         unsafe { o.contents.err = std::ptr::null_mut(); }
2108                         CResult_InvoiceSemanticErrorZPtr { err }
2109                 };
2110                 Self {
2111                         contents,
2112                         result_ok: o.result_ok,
2113                 }
2114         }
2115 }
2116 impl Clone for CResult_InvoiceSemanticErrorZ {
2117         fn clone(&self) -> Self {
2118                 if self.result_ok {
2119                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
2120                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
2121                         } }
2122                 } else {
2123                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
2124                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
2125                         } }
2126                 }
2127         }
2128 }
2129 #[no_mangle]
2130 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
2131 /// but with all dynamically-allocated buffers duplicated in new buffers.
2132 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
2133 #[repr(C)]
2134 /// The contents of CResult_DescriptionCreationErrorZ
2135 pub union CResult_DescriptionCreationErrorZPtr {
2136         /// A pointer to the contents in the success state.
2137         /// Reading from this pointer when `result_ok` is not set is undefined.
2138         pub result: *mut crate::lightning_invoice::Description,
2139         /// A pointer to the contents in the error state.
2140         /// Reading from this pointer when `result_ok` is set is undefined.
2141         pub err: *mut crate::lightning_invoice::CreationError,
2142 }
2143 #[repr(C)]
2144 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
2145 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
2146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2147 pub struct CResult_DescriptionCreationErrorZ {
2148         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
2149         /// `err` or `result` depending on the state of `result_ok`.
2150         pub contents: CResult_DescriptionCreationErrorZPtr,
2151         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
2152         pub result_ok: bool,
2153 }
2154 #[no_mangle]
2155 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
2156 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
2157         CResult_DescriptionCreationErrorZ {
2158                 contents: CResult_DescriptionCreationErrorZPtr {
2159                         result: Box::into_raw(Box::new(o)),
2160                 },
2161                 result_ok: true,
2162         }
2163 }
2164 #[no_mangle]
2165 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
2166 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
2167         CResult_DescriptionCreationErrorZ {
2168                 contents: CResult_DescriptionCreationErrorZPtr {
2169                         err: Box::into_raw(Box::new(e)),
2170                 },
2171                 result_ok: false,
2172         }
2173 }
2174 #[no_mangle]
2175 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
2176 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
2177 impl Drop for CResult_DescriptionCreationErrorZ {
2178         fn drop(&mut self) {
2179                 if self.result_ok {
2180                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2181                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2182                         }
2183                 } else {
2184                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2185                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2186                         }
2187                 }
2188         }
2189 }
2190 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
2191         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
2192                 let contents = if o.result_ok {
2193                         let result = unsafe { o.contents.result };
2194                         unsafe { o.contents.result = std::ptr::null_mut() };
2195                         CResult_DescriptionCreationErrorZPtr { result }
2196                 } else {
2197                         let err = unsafe { o.contents.err };
2198                         unsafe { o.contents.err = std::ptr::null_mut(); }
2199                         CResult_DescriptionCreationErrorZPtr { err }
2200                 };
2201                 Self {
2202                         contents,
2203                         result_ok: o.result_ok,
2204                 }
2205         }
2206 }
2207 impl Clone for CResult_DescriptionCreationErrorZ {
2208         fn clone(&self) -> Self {
2209                 if self.result_ok {
2210                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
2211                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
2212                         } }
2213                 } else {
2214                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
2215                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2216                         } }
2217                 }
2218         }
2219 }
2220 #[no_mangle]
2221 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
2222 /// but with all dynamically-allocated buffers duplicated in new buffers.
2223 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
2224 #[repr(C)]
2225 /// The contents of CResult_ExpiryTimeCreationErrorZ
2226 pub union CResult_ExpiryTimeCreationErrorZPtr {
2227         /// A pointer to the contents in the success state.
2228         /// Reading from this pointer when `result_ok` is not set is undefined.
2229         pub result: *mut crate::lightning_invoice::ExpiryTime,
2230         /// A pointer to the contents in the error state.
2231         /// Reading from this pointer when `result_ok` is set is undefined.
2232         pub err: *mut crate::lightning_invoice::CreationError,
2233 }
2234 #[repr(C)]
2235 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
2236 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
2237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2238 pub struct CResult_ExpiryTimeCreationErrorZ {
2239         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
2240         /// `err` or `result` depending on the state of `result_ok`.
2241         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
2242         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
2243         pub result_ok: bool,
2244 }
2245 #[no_mangle]
2246 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
2247 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
2248         CResult_ExpiryTimeCreationErrorZ {
2249                 contents: CResult_ExpiryTimeCreationErrorZPtr {
2250                         result: Box::into_raw(Box::new(o)),
2251                 },
2252                 result_ok: true,
2253         }
2254 }
2255 #[no_mangle]
2256 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
2257 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
2258         CResult_ExpiryTimeCreationErrorZ {
2259                 contents: CResult_ExpiryTimeCreationErrorZPtr {
2260                         err: Box::into_raw(Box::new(e)),
2261                 },
2262                 result_ok: false,
2263         }
2264 }
2265 #[no_mangle]
2266 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
2267 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
2268 impl Drop for CResult_ExpiryTimeCreationErrorZ {
2269         fn drop(&mut self) {
2270                 if self.result_ok {
2271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2273                         }
2274                 } else {
2275                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2276                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2277                         }
2278                 }
2279         }
2280 }
2281 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
2282         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
2283                 let contents = if o.result_ok {
2284                         let result = unsafe { o.contents.result };
2285                         unsafe { o.contents.result = std::ptr::null_mut() };
2286                         CResult_ExpiryTimeCreationErrorZPtr { result }
2287                 } else {
2288                         let err = unsafe { o.contents.err };
2289                         unsafe { o.contents.err = std::ptr::null_mut(); }
2290                         CResult_ExpiryTimeCreationErrorZPtr { err }
2291                 };
2292                 Self {
2293                         contents,
2294                         result_ok: o.result_ok,
2295                 }
2296         }
2297 }
2298 impl Clone for CResult_ExpiryTimeCreationErrorZ {
2299         fn clone(&self) -> Self {
2300                 if self.result_ok {
2301                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
2302                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
2303                         } }
2304                 } else {
2305                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
2306                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2307                         } }
2308                 }
2309         }
2310 }
2311 #[no_mangle]
2312 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
2313 /// but with all dynamically-allocated buffers duplicated in new buffers.
2314 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
2315 #[repr(C)]
2316 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2317 /// This corresponds to std::vector in C++
2318 pub struct CVec_RouteHintHopZ {
2319         /// The elements in the array.
2320         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2321         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2322         /// The number of elements pointed to by `data`.
2323         pub datalen: usize
2324 }
2325 impl CVec_RouteHintHopZ {
2326         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2327                 if self.datalen == 0 { return Vec::new(); }
2328                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2329                 self.data = std::ptr::null_mut();
2330                 self.datalen = 0;
2331                 ret
2332         }
2333         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2334                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2335         }
2336 }
2337 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2338         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2339                 let datalen = v.len();
2340                 let data = Box::into_raw(v.into_boxed_slice());
2341                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2342         }
2343 }
2344 #[no_mangle]
2345 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2346 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2347 impl Drop for CVec_RouteHintHopZ {
2348         fn drop(&mut self) {
2349                 if self.datalen == 0 { return; }
2350                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2351         }
2352 }
2353 impl Clone for CVec_RouteHintHopZ {
2354         fn clone(&self) -> Self {
2355                 let mut res = Vec::new();
2356                 if self.datalen == 0 { return Self::from(res); }
2357                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2358                 Self::from(res)
2359         }
2360 }
2361 #[repr(C)]
2362 /// The contents of CResult_RouteHintCreationErrorZ
2363 pub union CResult_RouteHintCreationErrorZPtr {
2364         /// A pointer to the contents in the success state.
2365         /// Reading from this pointer when `result_ok` is not set is undefined.
2366         pub result: *mut crate::lightning_invoice::RouteHint,
2367         /// A pointer to the contents in the error state.
2368         /// Reading from this pointer when `result_ok` is set is undefined.
2369         pub err: *mut crate::lightning_invoice::CreationError,
2370 }
2371 #[repr(C)]
2372 /// A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
2373 /// containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
2374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2375 pub struct CResult_RouteHintCreationErrorZ {
2376         /// The contents of this CResult_RouteHintCreationErrorZ, accessible via either
2377         /// `err` or `result` depending on the state of `result_ok`.
2378         pub contents: CResult_RouteHintCreationErrorZPtr,
2379         /// Whether this CResult_RouteHintCreationErrorZ represents a success state.
2380         pub result_ok: bool,
2381 }
2382 #[no_mangle]
2383 /// Creates a new CResult_RouteHintCreationErrorZ in the success state.
2384 pub extern "C" fn CResult_RouteHintCreationErrorZ_ok(o: crate::lightning_invoice::RouteHint) -> CResult_RouteHintCreationErrorZ {
2385         CResult_RouteHintCreationErrorZ {
2386                 contents: CResult_RouteHintCreationErrorZPtr {
2387                         result: Box::into_raw(Box::new(o)),
2388                 },
2389                 result_ok: true,
2390         }
2391 }
2392 #[no_mangle]
2393 /// Creates a new CResult_RouteHintCreationErrorZ in the error state.
2394 pub extern "C" fn CResult_RouteHintCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_RouteHintCreationErrorZ {
2395         CResult_RouteHintCreationErrorZ {
2396                 contents: CResult_RouteHintCreationErrorZPtr {
2397                         err: Box::into_raw(Box::new(e)),
2398                 },
2399                 result_ok: false,
2400         }
2401 }
2402 #[no_mangle]
2403 /// Frees any resources used by the CResult_RouteHintCreationErrorZ.
2404 pub extern "C" fn CResult_RouteHintCreationErrorZ_free(_res: CResult_RouteHintCreationErrorZ) { }
2405 impl Drop for CResult_RouteHintCreationErrorZ {
2406         fn drop(&mut self) {
2407                 if self.result_ok {
2408                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2409                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2410                         }
2411                 } else {
2412                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2413                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2414                         }
2415                 }
2416         }
2417 }
2418 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>> for CResult_RouteHintCreationErrorZ {
2419         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>) -> Self {
2420                 let contents = if o.result_ok {
2421                         let result = unsafe { o.contents.result };
2422                         unsafe { o.contents.result = std::ptr::null_mut() };
2423                         CResult_RouteHintCreationErrorZPtr { result }
2424                 } else {
2425                         let err = unsafe { o.contents.err };
2426                         unsafe { o.contents.err = std::ptr::null_mut(); }
2427                         CResult_RouteHintCreationErrorZPtr { err }
2428                 };
2429                 Self {
2430                         contents,
2431                         result_ok: o.result_ok,
2432                 }
2433         }
2434 }
2435 impl Clone for CResult_RouteHintCreationErrorZ {
2436         fn clone(&self) -> Self {
2437                 if self.result_ok {
2438                         Self { result_ok: true, contents: CResult_RouteHintCreationErrorZPtr {
2439                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::RouteHint>::clone(unsafe { &*self.contents.result })))
2440                         } }
2441                 } else {
2442                         Self { result_ok: false, contents: CResult_RouteHintCreationErrorZPtr {
2443                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2444                         } }
2445                 }
2446         }
2447 }
2448 #[no_mangle]
2449 /// Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
2450 /// but with all dynamically-allocated buffers duplicated in new buffers.
2451 pub extern "C" fn CResult_RouteHintCreationErrorZ_clone(orig: &CResult_RouteHintCreationErrorZ) -> CResult_RouteHintCreationErrorZ { orig.clone() }
2452 #[repr(C)]
2453 /// The contents of CResult_StringErrorZ
2454 pub union CResult_StringErrorZPtr {
2455         /// A pointer to the contents in the success state.
2456         /// Reading from this pointer when `result_ok` is not set is undefined.
2457         pub result: *mut crate::c_types::Str,
2458         /// A pointer to the contents in the error state.
2459         /// Reading from this pointer when `result_ok` is set is undefined.
2460         pub err: *mut crate::c_types::Secp256k1Error,
2461 }
2462 #[repr(C)]
2463 /// A CResult_StringErrorZ represents the result of a fallible operation,
2464 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
2465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2466 pub struct CResult_StringErrorZ {
2467         /// The contents of this CResult_StringErrorZ, accessible via either
2468         /// `err` or `result` depending on the state of `result_ok`.
2469         pub contents: CResult_StringErrorZPtr,
2470         /// Whether this CResult_StringErrorZ represents a success state.
2471         pub result_ok: bool,
2472 }
2473 #[no_mangle]
2474 /// Creates a new CResult_StringErrorZ in the success state.
2475 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
2476         CResult_StringErrorZ {
2477                 contents: CResult_StringErrorZPtr {
2478                         result: Box::into_raw(Box::new(o)),
2479                 },
2480                 result_ok: true,
2481         }
2482 }
2483 #[no_mangle]
2484 /// Creates a new CResult_StringErrorZ in the error state.
2485 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
2486         CResult_StringErrorZ {
2487                 contents: CResult_StringErrorZPtr {
2488                         err: Box::into_raw(Box::new(e)),
2489                 },
2490                 result_ok: false,
2491         }
2492 }
2493 #[no_mangle]
2494 /// Frees any resources used by the CResult_StringErrorZ.
2495 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
2496 impl Drop for CResult_StringErrorZ {
2497         fn drop(&mut self) {
2498                 if self.result_ok {
2499                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2500                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2501                         }
2502                 } else {
2503                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2504                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2505                         }
2506                 }
2507         }
2508 }
2509 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
2510         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
2511                 let contents = if o.result_ok {
2512                         let result = unsafe { o.contents.result };
2513                         unsafe { o.contents.result = std::ptr::null_mut() };
2514                         CResult_StringErrorZPtr { result }
2515                 } else {
2516                         let err = unsafe { o.contents.err };
2517                         unsafe { o.contents.err = std::ptr::null_mut(); }
2518                         CResult_StringErrorZPtr { err }
2519                 };
2520                 Self {
2521                         contents,
2522                         result_ok: o.result_ok,
2523                 }
2524         }
2525 }
2526 #[repr(C)]
2527 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
2528 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2529         /// A pointer to the contents in the success state.
2530         /// Reading from this pointer when `result_ok` is not set is undefined.
2531         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
2532         /// A pointer to the contents in the error state.
2533         /// Reading from this pointer when `result_ok` is set is undefined.
2534         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2535 }
2536 #[repr(C)]
2537 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2538 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2540 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
2541         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2542         /// `err` or `result` depending on the state of `result_ok`.
2543         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
2544         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2545         pub result_ok: bool,
2546 }
2547 #[no_mangle]
2548 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
2549 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2550         CResult_ChannelMonitorUpdateDecodeErrorZ {
2551                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2552                         result: Box::into_raw(Box::new(o)),
2553                 },
2554                 result_ok: true,
2555         }
2556 }
2557 #[no_mangle]
2558 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
2559 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2560         CResult_ChannelMonitorUpdateDecodeErrorZ {
2561                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2562                         err: Box::into_raw(Box::new(e)),
2563                 },
2564                 result_ok: false,
2565         }
2566 }
2567 #[no_mangle]
2568 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
2569 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
2570 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
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::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
2584         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> 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_ChannelMonitorUpdateDecodeErrorZPtr { result }
2589                 } else {
2590                         let err = unsafe { o.contents.err };
2591                         unsafe { o.contents.err = std::ptr::null_mut(); }
2592                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
2593                 };
2594                 Self {
2595                         contents,
2596                         result_ok: o.result_ok,
2597                 }
2598         }
2599 }
2600 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
2601         fn clone(&self) -> Self {
2602                 if self.result_ok {
2603                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2604                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
2605                         } }
2606                 } else {
2607                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2608                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2609                         } }
2610                 }
2611         }
2612 }
2613 #[no_mangle]
2614 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
2615 /// but with all dynamically-allocated buffers duplicated in new buffers.
2616 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
2617 #[repr(C)]
2618 /// The contents of CResult_HTLCUpdateDecodeErrorZ
2619 pub union CResult_HTLCUpdateDecodeErrorZPtr {
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::lightning::chain::channelmonitor::HTLCUpdate,
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::ln::msgs::DecodeError,
2626 }
2627 #[repr(C)]
2628 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2629 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2631 pub struct CResult_HTLCUpdateDecodeErrorZ {
2632         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2633         /// `err` or `result` depending on the state of `result_ok`.
2634         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
2635         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2636         pub result_ok: bool,
2637 }
2638 #[no_mangle]
2639 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
2640 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
2641         CResult_HTLCUpdateDecodeErrorZ {
2642                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2643                         result: Box::into_raw(Box::new(o)),
2644                 },
2645                 result_ok: true,
2646         }
2647 }
2648 #[no_mangle]
2649 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
2650 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
2651         CResult_HTLCUpdateDecodeErrorZ {
2652                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2653                         err: Box::into_raw(Box::new(e)),
2654                 },
2655                 result_ok: false,
2656         }
2657 }
2658 #[no_mangle]
2659 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
2660 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
2661 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
2662         fn drop(&mut self) {
2663                 if self.result_ok {
2664                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2665                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2666                         }
2667                 } else {
2668                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2669                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2670                         }
2671                 }
2672         }
2673 }
2674 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
2675         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
2676                 let contents = if o.result_ok {
2677                         let result = unsafe { o.contents.result };
2678                         unsafe { o.contents.result = std::ptr::null_mut() };
2679                         CResult_HTLCUpdateDecodeErrorZPtr { result }
2680                 } else {
2681                         let err = unsafe { o.contents.err };
2682                         unsafe { o.contents.err = std::ptr::null_mut(); }
2683                         CResult_HTLCUpdateDecodeErrorZPtr { err }
2684                 };
2685                 Self {
2686                         contents,
2687                         result_ok: o.result_ok,
2688                 }
2689         }
2690 }
2691 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
2692         fn clone(&self) -> Self {
2693                 if self.result_ok {
2694                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2695                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
2696                         } }
2697                 } else {
2698                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2699                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2700                         } }
2701                 }
2702         }
2703 }
2704 #[no_mangle]
2705 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
2706 /// but with all dynamically-allocated buffers duplicated in new buffers.
2707 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
2708 #[repr(C)]
2709 /// The contents of CResult_NoneMonitorUpdateErrorZ
2710 pub union CResult_NoneMonitorUpdateErrorZPtr {
2711         /// Note that this value is always NULL, as there are no contents in the OK variant
2712         pub result: *mut std::ffi::c_void,
2713         /// A pointer to the contents in the error state.
2714         /// Reading from this pointer when `result_ok` is set is undefined.
2715         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
2716 }
2717 #[repr(C)]
2718 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2719 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2721 pub struct CResult_NoneMonitorUpdateErrorZ {
2722         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2723         /// `err` or `result` depending on the state of `result_ok`.
2724         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
2725         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2726         pub result_ok: bool,
2727 }
2728 #[no_mangle]
2729 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
2730 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
2731         CResult_NoneMonitorUpdateErrorZ {
2732                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2733                         result: std::ptr::null_mut(),
2734                 },
2735                 result_ok: true,
2736         }
2737 }
2738 #[no_mangle]
2739 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
2740 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
2741         CResult_NoneMonitorUpdateErrorZ {
2742                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2743                         err: Box::into_raw(Box::new(e)),
2744                 },
2745                 result_ok: false,
2746         }
2747 }
2748 #[no_mangle]
2749 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
2750 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
2751 impl Drop for CResult_NoneMonitorUpdateErrorZ {
2752         fn drop(&mut self) {
2753                 if self.result_ok {
2754                 } else {
2755                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2756                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2757                         }
2758                 }
2759         }
2760 }
2761 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
2762         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
2763                 let contents = if o.result_ok {
2764                         let _ = unsafe { Box::from_raw(o.contents.result) };
2765                         o.contents.result = std::ptr::null_mut();
2766                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
2767                 } else {
2768                         let err = unsafe { o.contents.err };
2769                         unsafe { o.contents.err = std::ptr::null_mut(); }
2770                         CResult_NoneMonitorUpdateErrorZPtr { err }
2771                 };
2772                 Self {
2773                         contents,
2774                         result_ok: o.result_ok,
2775                 }
2776         }
2777 }
2778 impl Clone for CResult_NoneMonitorUpdateErrorZ {
2779         fn clone(&self) -> Self {
2780                 if self.result_ok {
2781                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
2782                                 result: std::ptr::null_mut()
2783                         } }
2784                 } else {
2785                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
2786                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
2787                         } }
2788                 }
2789         }
2790 }
2791 #[no_mangle]
2792 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
2793 /// but with all dynamically-allocated buffers duplicated in new buffers.
2794 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
2795 #[repr(C)]
2796 /// A tuple of 2 elements. See the individual fields for the types contained.
2797 pub struct C2Tuple_OutPointScriptZ {
2798         /// The element at position 0
2799         pub a: crate::lightning::chain::transaction::OutPoint,
2800         /// The element at position 1
2801         pub b: crate::c_types::derived::CVec_u8Z,
2802 }
2803 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
2804         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
2805                 Self {
2806                         a: tup.0,
2807                         b: tup.1,
2808                 }
2809         }
2810 }
2811 impl C2Tuple_OutPointScriptZ {
2812         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
2813                 (self.a, self.b)
2814         }
2815 }
2816 impl Clone for C2Tuple_OutPointScriptZ {
2817         fn clone(&self) -> Self {
2818                 Self {
2819                         a: self.a.clone(),
2820                         b: self.b.clone(),
2821                 }
2822         }
2823 }
2824 #[no_mangle]
2825 /// Creates a new tuple which has the same data as `orig`
2826 /// but with all dynamically-allocated buffers duplicated in new buffers.
2827 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
2828 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
2829 #[no_mangle]
2830 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
2831         C2Tuple_OutPointScriptZ { a, b, }
2832 }
2833
2834 #[no_mangle]
2835 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
2836 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
2837 #[repr(C)]
2838 /// A tuple of 2 elements. See the individual fields for the types contained.
2839 pub struct C2Tuple_u32ScriptZ {
2840         /// The element at position 0
2841         pub a: u32,
2842         /// The element at position 1
2843         pub b: crate::c_types::derived::CVec_u8Z,
2844 }
2845 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
2846         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
2847                 Self {
2848                         a: tup.0,
2849                         b: tup.1,
2850                 }
2851         }
2852 }
2853 impl C2Tuple_u32ScriptZ {
2854         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
2855                 (self.a, self.b)
2856         }
2857 }
2858 impl Clone for C2Tuple_u32ScriptZ {
2859         fn clone(&self) -> Self {
2860                 Self {
2861                         a: self.a.clone(),
2862                         b: self.b.clone(),
2863                 }
2864         }
2865 }
2866 #[no_mangle]
2867 /// Creates a new tuple which has the same data as `orig`
2868 /// but with all dynamically-allocated buffers duplicated in new buffers.
2869 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
2870 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
2871 #[no_mangle]
2872 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
2873         C2Tuple_u32ScriptZ { a, b, }
2874 }
2875
2876 #[no_mangle]
2877 /// Frees any resources used by the C2Tuple_u32ScriptZ.
2878 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
2879 #[repr(C)]
2880 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2881 /// This corresponds to std::vector in C++
2882 pub struct CVec_C2Tuple_u32ScriptZZ {
2883         /// The elements in the array.
2884         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2885         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
2886         /// The number of elements pointed to by `data`.
2887         pub datalen: usize
2888 }
2889 impl CVec_C2Tuple_u32ScriptZZ {
2890         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
2891                 if self.datalen == 0 { return Vec::new(); }
2892                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2893                 self.data = std::ptr::null_mut();
2894                 self.datalen = 0;
2895                 ret
2896         }
2897         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
2898                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2899         }
2900 }
2901 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
2902         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
2903                 let datalen = v.len();
2904                 let data = Box::into_raw(v.into_boxed_slice());
2905                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2906         }
2907 }
2908 #[no_mangle]
2909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2910 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
2911 impl Drop for CVec_C2Tuple_u32ScriptZZ {
2912         fn drop(&mut self) {
2913                 if self.datalen == 0 { return; }
2914                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2915         }
2916 }
2917 impl Clone for CVec_C2Tuple_u32ScriptZZ {
2918         fn clone(&self) -> Self {
2919                 let mut res = Vec::new();
2920                 if self.datalen == 0 { return Self::from(res); }
2921                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2922                 Self::from(res)
2923         }
2924 }
2925 #[repr(C)]
2926 /// A tuple of 2 elements. See the individual fields for the types contained.
2927 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2928         /// The element at position 0
2929         pub a: crate::c_types::ThirtyTwoBytes,
2930         /// The element at position 1
2931         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
2932 }
2933 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2934         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
2935                 Self {
2936                         a: tup.0,
2937                         b: tup.1,
2938                 }
2939         }
2940 }
2941 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2942         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
2943                 (self.a, self.b)
2944         }
2945 }
2946 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
2947 #[no_mangle]
2948 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 {
2949         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
2950 }
2951
2952 #[no_mangle]
2953 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
2954 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
2955 #[repr(C)]
2956 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2957 /// This corresponds to std::vector in C++
2958 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2959         /// The elements in the array.
2960         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2961         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
2962         /// The number of elements pointed to by `data`.
2963         pub datalen: usize
2964 }
2965 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2966         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
2967                 if self.datalen == 0 { return Vec::new(); }
2968                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2969                 self.data = std::ptr::null_mut();
2970                 self.datalen = 0;
2971                 ret
2972         }
2973         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
2974                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2975         }
2976 }
2977 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2978         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
2979                 let datalen = v.len();
2980                 let data = Box::into_raw(v.into_boxed_slice());
2981                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2982         }
2983 }
2984 #[no_mangle]
2985 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2986 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
2987 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2988         fn drop(&mut self) {
2989                 if self.datalen == 0 { return; }
2990                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2991         }
2992 }
2993 #[repr(C)]
2994 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2995 /// This corresponds to std::vector in C++
2996 pub struct CVec_MonitorEventZ {
2997         /// The elements in the array.
2998         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2999         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3000         /// The number of elements pointed to by `data`.
3001         pub datalen: usize
3002 }
3003 impl CVec_MonitorEventZ {
3004         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3005                 if self.datalen == 0 { return Vec::new(); }
3006                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3007                 self.data = std::ptr::null_mut();
3008                 self.datalen = 0;
3009                 ret
3010         }
3011         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3012                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3013         }
3014 }
3015 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3016         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3017                 let datalen = v.len();
3018                 let data = Box::into_raw(v.into_boxed_slice());
3019                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3020         }
3021 }
3022 #[no_mangle]
3023 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3024 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3025 impl Drop for CVec_MonitorEventZ {
3026         fn drop(&mut self) {
3027                 if self.datalen == 0 { return; }
3028                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3029         }
3030 }
3031 impl Clone for CVec_MonitorEventZ {
3032         fn clone(&self) -> Self {
3033                 let mut res = Vec::new();
3034                 if self.datalen == 0 { return Self::from(res); }
3035                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3036                 Self::from(res)
3037         }
3038 }
3039 #[repr(C)]
3040 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
3041 /// This corresponds to std::vector in C++
3042 pub struct CVec_EventZ {
3043         /// The elements in the array.
3044         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3045         pub data: *mut crate::lightning::util::events::Event,
3046         /// The number of elements pointed to by `data`.
3047         pub datalen: usize
3048 }
3049 impl CVec_EventZ {
3050         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
3051                 if self.datalen == 0 { return Vec::new(); }
3052                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3053                 self.data = std::ptr::null_mut();
3054                 self.datalen = 0;
3055                 ret
3056         }
3057         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
3058                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3059         }
3060 }
3061 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
3062         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
3063                 let datalen = v.len();
3064                 let data = Box::into_raw(v.into_boxed_slice());
3065                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3066         }
3067 }
3068 #[no_mangle]
3069 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3070 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
3071 impl Drop for CVec_EventZ {
3072         fn drop(&mut self) {
3073                 if self.datalen == 0 { return; }
3074                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3075         }
3076 }
3077 impl Clone for CVec_EventZ {
3078         fn clone(&self) -> Self {
3079                 let mut res = Vec::new();
3080                 if self.datalen == 0 { return Self::from(res); }
3081                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3082                 Self::from(res)
3083         }
3084 }
3085 #[repr(C)]
3086 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
3087 /// This corresponds to std::vector in C++
3088 pub struct CVec_TransactionZ {
3089         /// The elements in the array.
3090         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3091         pub data: *mut crate::c_types::Transaction,
3092         /// The number of elements pointed to by `data`.
3093         pub datalen: usize
3094 }
3095 impl CVec_TransactionZ {
3096         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
3097                 if self.datalen == 0 { return Vec::new(); }
3098                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3099                 self.data = std::ptr::null_mut();
3100                 self.datalen = 0;
3101                 ret
3102         }
3103         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
3104                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3105         }
3106 }
3107 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
3108         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
3109                 let datalen = v.len();
3110                 let data = Box::into_raw(v.into_boxed_slice());
3111                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3112         }
3113 }
3114 #[no_mangle]
3115 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3116 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
3117 impl Drop for CVec_TransactionZ {
3118         fn drop(&mut self) {
3119                 if self.datalen == 0 { return; }
3120                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3121         }
3122 }
3123 #[repr(C)]
3124 /// A tuple of 2 elements. See the individual fields for the types contained.
3125 pub struct C2Tuple_usizeTransactionZ {
3126         /// The element at position 0
3127         pub a: usize,
3128         /// The element at position 1
3129         pub b: crate::c_types::Transaction,
3130 }
3131 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3132         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3133                 Self {
3134                         a: tup.0,
3135                         b: tup.1,
3136                 }
3137         }
3138 }
3139 impl C2Tuple_usizeTransactionZ {
3140         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3141                 (self.a, self.b)
3142         }
3143 }
3144 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3145 #[no_mangle]
3146 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3147         C2Tuple_usizeTransactionZ { a, b, }
3148 }
3149
3150 #[no_mangle]
3151 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3152 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3153 #[repr(C)]
3154 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3155 /// This corresponds to std::vector in C++
3156 pub struct CVec_C2Tuple_usizeTransactionZZ {
3157         /// The elements in the array.
3158         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3159         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3160         /// The number of elements pointed to by `data`.
3161         pub datalen: usize
3162 }
3163 impl CVec_C2Tuple_usizeTransactionZZ {
3164         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3165                 if self.datalen == 0 { return Vec::new(); }
3166                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3167                 self.data = std::ptr::null_mut();
3168                 self.datalen = 0;
3169                 ret
3170         }
3171         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3172                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3173         }
3174 }
3175 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3176         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3177                 let datalen = v.len();
3178                 let data = Box::into_raw(v.into_boxed_slice());
3179                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3180         }
3181 }
3182 #[no_mangle]
3183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3184 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3185 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3186         fn drop(&mut self) {
3187                 if self.datalen == 0 { return; }
3188                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3189         }
3190 }
3191 #[repr(C)]
3192 /// A tuple of 2 elements. See the individual fields for the types contained.
3193 pub struct C2Tuple_u32TxOutZ {
3194         /// The element at position 0
3195         pub a: u32,
3196         /// The element at position 1
3197         pub b: crate::c_types::TxOut,
3198 }
3199 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3200         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3201                 Self {
3202                         a: tup.0,
3203                         b: tup.1,
3204                 }
3205         }
3206 }
3207 impl C2Tuple_u32TxOutZ {
3208         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3209                 (self.a, self.b)
3210         }
3211 }
3212 impl Clone for C2Tuple_u32TxOutZ {
3213         fn clone(&self) -> Self {
3214                 Self {
3215                         a: self.a.clone(),
3216                         b: self.b.clone(),
3217                 }
3218         }
3219 }
3220 #[no_mangle]
3221 /// Creates a new tuple which has the same data as `orig`
3222 /// but with all dynamically-allocated buffers duplicated in new buffers.
3223 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3224 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
3225 #[no_mangle]
3226 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3227         C2Tuple_u32TxOutZ { a, b, }
3228 }
3229
3230 #[no_mangle]
3231 /// Frees any resources used by the C2Tuple_u32TxOutZ.
3232 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3233 #[repr(C)]
3234 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3235 /// This corresponds to std::vector in C++
3236 pub struct CVec_C2Tuple_u32TxOutZZ {
3237         /// The elements in the array.
3238         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3239         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3240         /// The number of elements pointed to by `data`.
3241         pub datalen: usize
3242 }
3243 impl CVec_C2Tuple_u32TxOutZZ {
3244         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3245                 if self.datalen == 0 { return Vec::new(); }
3246                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3247                 self.data = std::ptr::null_mut();
3248                 self.datalen = 0;
3249                 ret
3250         }
3251         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3252                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3253         }
3254 }
3255 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3256         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3257                 let datalen = v.len();
3258                 let data = Box::into_raw(v.into_boxed_slice());
3259                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3260         }
3261 }
3262 #[no_mangle]
3263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3264 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3265 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3266         fn drop(&mut self) {
3267                 if self.datalen == 0 { return; }
3268                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3269         }
3270 }
3271 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3272         fn clone(&self) -> Self {
3273                 let mut res = Vec::new();
3274                 if self.datalen == 0 { return Self::from(res); }
3275                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3276                 Self::from(res)
3277         }
3278 }
3279 #[repr(C)]
3280 /// A tuple of 2 elements. See the individual fields for the types contained.
3281 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3282         /// The element at position 0
3283         pub a: crate::c_types::ThirtyTwoBytes,
3284         /// The element at position 1
3285         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3286 }
3287 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3288         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3289                 Self {
3290                         a: tup.0,
3291                         b: tup.1,
3292                 }
3293         }
3294 }
3295 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3296         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3297                 (self.a, self.b)
3298         }
3299 }
3300 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
3301 #[no_mangle]
3302 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 {
3303         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3304 }
3305
3306 #[no_mangle]
3307 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
3308 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3309 #[repr(C)]
3310 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3311 /// This corresponds to std::vector in C++
3312 pub struct CVec_TransactionOutputsZ {
3313         /// The elements in the array.
3314         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3315         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3316         /// The number of elements pointed to by `data`.
3317         pub datalen: usize
3318 }
3319 impl CVec_TransactionOutputsZ {
3320         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3321                 if self.datalen == 0 { return Vec::new(); }
3322                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3323                 self.data = std::ptr::null_mut();
3324                 self.datalen = 0;
3325                 ret
3326         }
3327         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3328                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3329         }
3330 }
3331 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
3332         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3333                 let datalen = v.len();
3334                 let data = Box::into_raw(v.into_boxed_slice());
3335                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3336         }
3337 }
3338 #[no_mangle]
3339 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3340 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
3341 impl Drop for CVec_TransactionOutputsZ {
3342         fn drop(&mut self) {
3343                 if self.datalen == 0 { return; }
3344                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3345         }
3346 }
3347 #[repr(C)]
3348 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3349 /// This corresponds to std::vector in C++
3350 pub struct CVec_TxidZ {
3351         /// The elements in the array.
3352         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3353         pub data: *mut crate::c_types::ThirtyTwoBytes,
3354         /// The number of elements pointed to by `data`.
3355         pub datalen: usize
3356 }
3357 impl CVec_TxidZ {
3358         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3359                 if self.datalen == 0 { return Vec::new(); }
3360                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3361                 self.data = std::ptr::null_mut();
3362                 self.datalen = 0;
3363                 ret
3364         }
3365         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3366                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3367         }
3368 }
3369 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3370         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3371                 let datalen = v.len();
3372                 let data = Box::into_raw(v.into_boxed_slice());
3373                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3374         }
3375 }
3376 #[no_mangle]
3377 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3378 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3379 impl Drop for CVec_TxidZ {
3380         fn drop(&mut self) {
3381                 if self.datalen == 0 { return; }
3382                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3383         }
3384 }
3385 #[repr(C)]
3386 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3387 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3388         /// Note that this value is always NULL, as there are no contents in the OK variant
3389         pub result: *mut std::ffi::c_void,
3390         /// A pointer to the contents in the error state.
3391         /// Reading from this pointer when `result_ok` is set is undefined.
3392         pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
3393 }
3394 #[repr(C)]
3395 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3396 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
3397 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3398 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3399         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3400         /// `err` or `result` depending on the state of `result_ok`.
3401         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3402         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3403         pub result_ok: bool,
3404 }
3405 #[no_mangle]
3406 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3407 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3408         CResult_NoneChannelMonitorUpdateErrZ {
3409                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3410                         result: std::ptr::null_mut(),
3411                 },
3412                 result_ok: true,
3413         }
3414 }
3415 #[no_mangle]
3416 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3417 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3418         CResult_NoneChannelMonitorUpdateErrZ {
3419                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3420                         err: Box::into_raw(Box::new(e)),
3421                 },
3422                 result_ok: false,
3423         }
3424 }
3425 #[no_mangle]
3426 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3427 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3428 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3429         fn drop(&mut self) {
3430                 if self.result_ok {
3431                 } else {
3432                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3433                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3434                         }
3435                 }
3436         }
3437 }
3438 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3439         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
3440                 let contents = if o.result_ok {
3441                         let _ = unsafe { Box::from_raw(o.contents.result) };
3442                         o.contents.result = std::ptr::null_mut();
3443                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
3444                 } else {
3445                         let err = unsafe { o.contents.err };
3446                         unsafe { o.contents.err = std::ptr::null_mut(); }
3447                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3448                 };
3449                 Self {
3450                         contents,
3451                         result_ok: o.result_ok,
3452                 }
3453         }
3454 }
3455 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3456         fn clone(&self) -> Self {
3457                 if self.result_ok {
3458                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3459                                 result: std::ptr::null_mut()
3460                         } }
3461                 } else {
3462                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3463                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3464                         } }
3465                 }
3466         }
3467 }
3468 #[no_mangle]
3469 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3470 /// but with all dynamically-allocated buffers duplicated in new buffers.
3471 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
3472 #[repr(C)]
3473 /// A tuple of 2 elements. See the individual fields for the types contained.
3474 pub struct C2Tuple_BlockHashChannelMonitorZ {
3475         /// The element at position 0
3476         pub a: crate::c_types::ThirtyTwoBytes,
3477         /// The element at position 1
3478         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3479 }
3480 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3481         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3482                 Self {
3483                         a: tup.0,
3484                         b: tup.1,
3485                 }
3486         }
3487 }
3488 impl C2Tuple_BlockHashChannelMonitorZ {
3489         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3490                 (self.a, self.b)
3491         }
3492 }
3493 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3494 #[no_mangle]
3495 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3496         C2Tuple_BlockHashChannelMonitorZ { a, b, }
3497 }
3498
3499 #[no_mangle]
3500 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3501 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3502 #[repr(C)]
3503 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3504 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3505         /// A pointer to the contents in the success state.
3506         /// Reading from this pointer when `result_ok` is not set is undefined.
3507         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3508         /// A pointer to the contents in the error state.
3509         /// Reading from this pointer when `result_ok` is set is undefined.
3510         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3511 }
3512 #[repr(C)]
3513 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3514 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3516 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3517         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3518         /// `err` or `result` depending on the state of `result_ok`.
3519         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
3520         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3521         pub result_ok: bool,
3522 }
3523 #[no_mangle]
3524 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
3525 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3526         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3527                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3528                         result: Box::into_raw(Box::new(o)),
3529                 },
3530                 result_ok: true,
3531         }
3532 }
3533 #[no_mangle]
3534 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
3535 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3536         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3537                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3538                         err: Box::into_raw(Box::new(e)),
3539                 },
3540                 result_ok: false,
3541         }
3542 }
3543 #[no_mangle]
3544 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
3545 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
3546 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3547         fn drop(&mut self) {
3548                 if self.result_ok {
3549                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3550                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3551                         }
3552                 } else {
3553                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3554                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3555                         }
3556                 }
3557         }
3558 }
3559 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3560         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3561                 let contents = if o.result_ok {
3562                         let result = unsafe { o.contents.result };
3563                         unsafe { o.contents.result = std::ptr::null_mut() };
3564                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
3565                 } else {
3566                         let err = unsafe { o.contents.err };
3567                         unsafe { o.contents.err = std::ptr::null_mut(); }
3568                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
3569                 };
3570                 Self {
3571                         contents,
3572                         result_ok: o.result_ok,
3573                 }
3574         }
3575 }
3576 #[repr(C)]
3577 /// The contents of CResult_RouteHopDecodeErrorZ
3578 pub union CResult_RouteHopDecodeErrorZPtr {
3579         /// A pointer to the contents in the success state.
3580         /// Reading from this pointer when `result_ok` is not set is undefined.
3581         pub result: *mut crate::lightning::routing::router::RouteHop,
3582         /// A pointer to the contents in the error state.
3583         /// Reading from this pointer when `result_ok` is set is undefined.
3584         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3585 }
3586 #[repr(C)]
3587 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3588 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3590 pub struct CResult_RouteHopDecodeErrorZ {
3591         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3592         /// `err` or `result` depending on the state of `result_ok`.
3593         pub contents: CResult_RouteHopDecodeErrorZPtr,
3594         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3595         pub result_ok: bool,
3596 }
3597 #[no_mangle]
3598 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3599 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3600         CResult_RouteHopDecodeErrorZ {
3601                 contents: CResult_RouteHopDecodeErrorZPtr {
3602                         result: Box::into_raw(Box::new(o)),
3603                 },
3604                 result_ok: true,
3605         }
3606 }
3607 #[no_mangle]
3608 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3609 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3610         CResult_RouteHopDecodeErrorZ {
3611                 contents: CResult_RouteHopDecodeErrorZPtr {
3612                         err: Box::into_raw(Box::new(e)),
3613                 },
3614                 result_ok: false,
3615         }
3616 }
3617 #[no_mangle]
3618 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3619 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3620 impl Drop for CResult_RouteHopDecodeErrorZ {
3621         fn drop(&mut self) {
3622                 if self.result_ok {
3623                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3624                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3625                         }
3626                 } else {
3627                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3628                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3629                         }
3630                 }
3631         }
3632 }
3633 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3634         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3635                 let contents = if o.result_ok {
3636                         let result = unsafe { o.contents.result };
3637                         unsafe { o.contents.result = std::ptr::null_mut() };
3638                         CResult_RouteHopDecodeErrorZPtr { result }
3639                 } else {
3640                         let err = unsafe { o.contents.err };
3641                         unsafe { o.contents.err = std::ptr::null_mut(); }
3642                         CResult_RouteHopDecodeErrorZPtr { err }
3643                 };
3644                 Self {
3645                         contents,
3646                         result_ok: o.result_ok,
3647                 }
3648         }
3649 }
3650 impl Clone for CResult_RouteHopDecodeErrorZ {
3651         fn clone(&self) -> Self {
3652                 if self.result_ok {
3653                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3654                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3655                         } }
3656                 } else {
3657                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3658                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3659                         } }
3660                 }
3661         }
3662 }
3663 #[no_mangle]
3664 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3665 /// but with all dynamically-allocated buffers duplicated in new buffers.
3666 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { orig.clone() }
3667 #[repr(C)]
3668 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3669 /// This corresponds to std::vector in C++
3670 pub struct CVec_RouteHopZ {
3671         /// The elements in the array.
3672         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3673         pub data: *mut crate::lightning::routing::router::RouteHop,
3674         /// The number of elements pointed to by `data`.
3675         pub datalen: usize
3676 }
3677 impl CVec_RouteHopZ {
3678         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3679                 if self.datalen == 0 { return Vec::new(); }
3680                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3681                 self.data = std::ptr::null_mut();
3682                 self.datalen = 0;
3683                 ret
3684         }
3685         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3686                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3687         }
3688 }
3689 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3690         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3691                 let datalen = v.len();
3692                 let data = Box::into_raw(v.into_boxed_slice());
3693                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3694         }
3695 }
3696 #[no_mangle]
3697 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3698 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3699 impl Drop for CVec_RouteHopZ {
3700         fn drop(&mut self) {
3701                 if self.datalen == 0 { return; }
3702                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3703         }
3704 }
3705 impl Clone for CVec_RouteHopZ {
3706         fn clone(&self) -> Self {
3707                 let mut res = Vec::new();
3708                 if self.datalen == 0 { return Self::from(res); }
3709                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3710                 Self::from(res)
3711         }
3712 }
3713 #[repr(C)]
3714 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3715 /// This corresponds to std::vector in C++
3716 pub struct CVec_CVec_RouteHopZZ {
3717         /// The elements in the array.
3718         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3719         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3720         /// The number of elements pointed to by `data`.
3721         pub datalen: usize
3722 }
3723 impl CVec_CVec_RouteHopZZ {
3724         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3725                 if self.datalen == 0 { return Vec::new(); }
3726                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3727                 self.data = std::ptr::null_mut();
3728                 self.datalen = 0;
3729                 ret
3730         }
3731         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3732                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3733         }
3734 }
3735 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3736         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3737                 let datalen = v.len();
3738                 let data = Box::into_raw(v.into_boxed_slice());
3739                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3740         }
3741 }
3742 #[no_mangle]
3743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3744 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3745 impl Drop for CVec_CVec_RouteHopZZ {
3746         fn drop(&mut self) {
3747                 if self.datalen == 0 { return; }
3748                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3749         }
3750 }
3751 impl Clone for CVec_CVec_RouteHopZZ {
3752         fn clone(&self) -> Self {
3753                 let mut res = Vec::new();
3754                 if self.datalen == 0 { return Self::from(res); }
3755                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3756                 Self::from(res)
3757         }
3758 }
3759 #[repr(C)]
3760 /// The contents of CResult_RouteDecodeErrorZ
3761 pub union CResult_RouteDecodeErrorZPtr {
3762         /// A pointer to the contents in the success state.
3763         /// Reading from this pointer when `result_ok` is not set is undefined.
3764         pub result: *mut crate::lightning::routing::router::Route,
3765         /// A pointer to the contents in the error state.
3766         /// Reading from this pointer when `result_ok` is set is undefined.
3767         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3768 }
3769 #[repr(C)]
3770 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3771 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3773 pub struct CResult_RouteDecodeErrorZ {
3774         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3775         /// `err` or `result` depending on the state of `result_ok`.
3776         pub contents: CResult_RouteDecodeErrorZPtr,
3777         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3778         pub result_ok: bool,
3779 }
3780 #[no_mangle]
3781 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3782 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3783         CResult_RouteDecodeErrorZ {
3784                 contents: CResult_RouteDecodeErrorZPtr {
3785                         result: Box::into_raw(Box::new(o)),
3786                 },
3787                 result_ok: true,
3788         }
3789 }
3790 #[no_mangle]
3791 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3792 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3793         CResult_RouteDecodeErrorZ {
3794                 contents: CResult_RouteDecodeErrorZPtr {
3795                         err: Box::into_raw(Box::new(e)),
3796                 },
3797                 result_ok: false,
3798         }
3799 }
3800 #[no_mangle]
3801 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3802 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3803 impl Drop for CResult_RouteDecodeErrorZ {
3804         fn drop(&mut self) {
3805                 if self.result_ok {
3806                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3807                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3808                         }
3809                 } else {
3810                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3811                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3812                         }
3813                 }
3814         }
3815 }
3816 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3817         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3818                 let contents = if o.result_ok {
3819                         let result = unsafe { o.contents.result };
3820                         unsafe { o.contents.result = std::ptr::null_mut() };
3821                         CResult_RouteDecodeErrorZPtr { result }
3822                 } else {
3823                         let err = unsafe { o.contents.err };
3824                         unsafe { o.contents.err = std::ptr::null_mut(); }
3825                         CResult_RouteDecodeErrorZPtr { err }
3826                 };
3827                 Self {
3828                         contents,
3829                         result_ok: o.result_ok,
3830                 }
3831         }
3832 }
3833 impl Clone for CResult_RouteDecodeErrorZ {
3834         fn clone(&self) -> Self {
3835                 if self.result_ok {
3836                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3837                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3838                         } }
3839                 } else {
3840                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3841                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3842                         } }
3843                 }
3844         }
3845 }
3846 #[no_mangle]
3847 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3848 /// but with all dynamically-allocated buffers duplicated in new buffers.
3849 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3850 #[repr(C)]
3851 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3852 /// This corresponds to std::vector in C++
3853 pub struct CVec_ChannelDetailsZ {
3854         /// The elements in the array.
3855         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3856         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3857         /// The number of elements pointed to by `data`.
3858         pub datalen: usize
3859 }
3860 impl CVec_ChannelDetailsZ {
3861         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3862                 if self.datalen == 0 { return Vec::new(); }
3863                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3864                 self.data = std::ptr::null_mut();
3865                 self.datalen = 0;
3866                 ret
3867         }
3868         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3869                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3870         }
3871 }
3872 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3873         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3874                 let datalen = v.len();
3875                 let data = Box::into_raw(v.into_boxed_slice());
3876                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3877         }
3878 }
3879 #[no_mangle]
3880 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3881 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3882 impl Drop for CVec_ChannelDetailsZ {
3883         fn drop(&mut self) {
3884                 if self.datalen == 0 { return; }
3885                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3886         }
3887 }
3888 impl Clone for CVec_ChannelDetailsZ {
3889         fn clone(&self) -> Self {
3890                 let mut res = Vec::new();
3891                 if self.datalen == 0 { return Self::from(res); }
3892                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3893                 Self::from(res)
3894         }
3895 }
3896 #[repr(C)]
3897 /// The contents of CResult_RouteLightningErrorZ
3898 pub union CResult_RouteLightningErrorZPtr {
3899         /// A pointer to the contents in the success state.
3900         /// Reading from this pointer when `result_ok` is not set is undefined.
3901         pub result: *mut crate::lightning::routing::router::Route,
3902         /// A pointer to the contents in the error state.
3903         /// Reading from this pointer when `result_ok` is set is undefined.
3904         pub err: *mut crate::lightning::ln::msgs::LightningError,
3905 }
3906 #[repr(C)]
3907 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3908 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3910 pub struct CResult_RouteLightningErrorZ {
3911         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3912         /// `err` or `result` depending on the state of `result_ok`.
3913         pub contents: CResult_RouteLightningErrorZPtr,
3914         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3915         pub result_ok: bool,
3916 }
3917 #[no_mangle]
3918 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3919 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3920         CResult_RouteLightningErrorZ {
3921                 contents: CResult_RouteLightningErrorZPtr {
3922                         result: Box::into_raw(Box::new(o)),
3923                 },
3924                 result_ok: true,
3925         }
3926 }
3927 #[no_mangle]
3928 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3929 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3930         CResult_RouteLightningErrorZ {
3931                 contents: CResult_RouteLightningErrorZPtr {
3932                         err: Box::into_raw(Box::new(e)),
3933                 },
3934                 result_ok: false,
3935         }
3936 }
3937 #[no_mangle]
3938 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3939 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3940 impl Drop for CResult_RouteLightningErrorZ {
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::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3954         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> 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_RouteLightningErrorZPtr { result }
3959                 } else {
3960                         let err = unsafe { o.contents.err };
3961                         unsafe { o.contents.err = std::ptr::null_mut(); }
3962                         CResult_RouteLightningErrorZPtr { err }
3963                 };
3964                 Self {
3965                         contents,
3966                         result_ok: o.result_ok,
3967                 }
3968         }
3969 }
3970 impl Clone for CResult_RouteLightningErrorZ {
3971         fn clone(&self) -> Self {
3972                 if self.result_ok {
3973                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3974                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3975                         } }
3976                 } else {
3977                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3978                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3979                         } }
3980                 }
3981         }
3982 }
3983 #[no_mangle]
3984 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3985 /// but with all dynamically-allocated buffers duplicated in new buffers.
3986 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
3987 #[repr(C)]
3988 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3989 /// This corresponds to std::vector in C++
3990 pub struct CVec_MessageSendEventZ {
3991         /// The elements in the array.
3992         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3993         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3994         /// The number of elements pointed to by `data`.
3995         pub datalen: usize
3996 }
3997 impl CVec_MessageSendEventZ {
3998         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3999                 if self.datalen == 0 { return Vec::new(); }
4000                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4001                 self.data = std::ptr::null_mut();
4002                 self.datalen = 0;
4003                 ret
4004         }
4005         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
4006                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4007         }
4008 }
4009 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
4010         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
4011                 let datalen = v.len();
4012                 let data = Box::into_raw(v.into_boxed_slice());
4013                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4014         }
4015 }
4016 #[no_mangle]
4017 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4018 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
4019 impl Drop for CVec_MessageSendEventZ {
4020         fn drop(&mut self) {
4021                 if self.datalen == 0 { return; }
4022                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4023         }
4024 }
4025 impl Clone for CVec_MessageSendEventZ {
4026         fn clone(&self) -> Self {
4027                 let mut res = Vec::new();
4028                 if self.datalen == 0 { return Self::from(res); }
4029                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4030                 Self::from(res)
4031         }
4032 }
4033 #[repr(C)]
4034 /// The contents of CResult_boolLightningErrorZ
4035 pub union CResult_boolLightningErrorZPtr {
4036         /// A pointer to the contents in the success state.
4037         /// Reading from this pointer when `result_ok` is not set is undefined.
4038         pub result: *mut bool,
4039         /// A pointer to the contents in the error state.
4040         /// Reading from this pointer when `result_ok` is set is undefined.
4041         pub err: *mut crate::lightning::ln::msgs::LightningError,
4042 }
4043 #[repr(C)]
4044 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4045 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4047 pub struct CResult_boolLightningErrorZ {
4048         /// The contents of this CResult_boolLightningErrorZ, accessible via either
4049         /// `err` or `result` depending on the state of `result_ok`.
4050         pub contents: CResult_boolLightningErrorZPtr,
4051         /// Whether this CResult_boolLightningErrorZ represents a success state.
4052         pub result_ok: bool,
4053 }
4054 #[no_mangle]
4055 /// Creates a new CResult_boolLightningErrorZ in the success state.
4056 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4057         CResult_boolLightningErrorZ {
4058                 contents: CResult_boolLightningErrorZPtr {
4059                         result: Box::into_raw(Box::new(o)),
4060                 },
4061                 result_ok: true,
4062         }
4063 }
4064 #[no_mangle]
4065 /// Creates a new CResult_boolLightningErrorZ in the error state.
4066 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4067         CResult_boolLightningErrorZ {
4068                 contents: CResult_boolLightningErrorZPtr {
4069                         err: Box::into_raw(Box::new(e)),
4070                 },
4071                 result_ok: false,
4072         }
4073 }
4074 #[no_mangle]
4075 /// Frees any resources used by the CResult_boolLightningErrorZ.
4076 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4077 impl Drop for CResult_boolLightningErrorZ {
4078         fn drop(&mut self) {
4079                 if self.result_ok {
4080                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4081                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4082                         }
4083                 } else {
4084                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4085                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4086                         }
4087                 }
4088         }
4089 }
4090 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4091         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4092                 let contents = if o.result_ok {
4093                         let result = unsafe { o.contents.result };
4094                         unsafe { o.contents.result = std::ptr::null_mut() };
4095                         CResult_boolLightningErrorZPtr { result }
4096                 } else {
4097                         let err = unsafe { o.contents.err };
4098                         unsafe { o.contents.err = std::ptr::null_mut(); }
4099                         CResult_boolLightningErrorZPtr { err }
4100                 };
4101                 Self {
4102                         contents,
4103                         result_ok: o.result_ok,
4104                 }
4105         }
4106 }
4107 impl Clone for CResult_boolLightningErrorZ {
4108         fn clone(&self) -> Self {
4109                 if self.result_ok {
4110                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4111                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4112                         } }
4113                 } else {
4114                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4115                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4116                         } }
4117                 }
4118         }
4119 }
4120 #[no_mangle]
4121 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4122 /// but with all dynamically-allocated buffers duplicated in new buffers.
4123 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
4124 #[repr(C)]
4125 /// A tuple of 3 elements. See the individual fields for the types contained.
4126 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4127         /// The element at position 0
4128         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4129         /// The element at position 1
4130         pub b: crate::lightning::ln::msgs::ChannelUpdate,
4131         /// The element at position 2
4132         pub c: crate::lightning::ln::msgs::ChannelUpdate,
4133 }
4134 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4135         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4136                 Self {
4137                         a: tup.0,
4138                         b: tup.1,
4139                         c: tup.2,
4140                 }
4141         }
4142 }
4143 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4144         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4145                 (self.a, self.b, self.c)
4146         }
4147 }
4148 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4149         fn clone(&self) -> Self {
4150                 Self {
4151                         a: self.a.clone(),
4152                         b: self.b.clone(),
4153                         c: self.c.clone(),
4154                 }
4155         }
4156 }
4157 #[no_mangle]
4158 /// Creates a new tuple which has the same data as `orig`
4159 /// but with all dynamically-allocated buffers duplicated in new buffers.
4160 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
4161 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4162 #[no_mangle]
4163 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 {
4164         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4165 }
4166
4167 #[no_mangle]
4168 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
4169 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
4170 #[repr(C)]
4171 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4172 /// This corresponds to std::vector in C++
4173 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4174         /// The elements in the array.
4175         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4176         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
4177         /// The number of elements pointed to by `data`.
4178         pub datalen: usize
4179 }
4180 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4181         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
4182                 if self.datalen == 0 { return Vec::new(); }
4183                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4184                 self.data = std::ptr::null_mut();
4185                 self.datalen = 0;
4186                 ret
4187         }
4188         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
4189                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4190         }
4191 }
4192 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4193         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
4194                 let datalen = v.len();
4195                 let data = Box::into_raw(v.into_boxed_slice());
4196                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4197         }
4198 }
4199 #[no_mangle]
4200 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4201 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
4202 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4203         fn drop(&mut self) {
4204                 if self.datalen == 0 { return; }
4205                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4206         }
4207 }
4208 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4209         fn clone(&self) -> Self {
4210                 let mut res = Vec::new();
4211                 if self.datalen == 0 { return Self::from(res); }
4212                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4213                 Self::from(res)
4214         }
4215 }
4216 #[repr(C)]
4217 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4218 /// This corresponds to std::vector in C++
4219 pub struct CVec_NodeAnnouncementZ {
4220         /// The elements in the array.
4221         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4222         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
4223         /// The number of elements pointed to by `data`.
4224         pub datalen: usize
4225 }
4226 impl CVec_NodeAnnouncementZ {
4227         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
4228                 if self.datalen == 0 { return Vec::new(); }
4229                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4230                 self.data = std::ptr::null_mut();
4231                 self.datalen = 0;
4232                 ret
4233         }
4234         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
4235                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4236         }
4237 }
4238 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
4239         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
4240                 let datalen = v.len();
4241                 let data = Box::into_raw(v.into_boxed_slice());
4242                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4243         }
4244 }
4245 #[no_mangle]
4246 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4247 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
4248 impl Drop for CVec_NodeAnnouncementZ {
4249         fn drop(&mut self) {
4250                 if self.datalen == 0 { return; }
4251                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4252         }
4253 }
4254 impl Clone for CVec_NodeAnnouncementZ {
4255         fn clone(&self) -> Self {
4256                 let mut res = Vec::new();
4257                 if self.datalen == 0 { return Self::from(res); }
4258                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4259                 Self::from(res)
4260         }
4261 }
4262 #[repr(C)]
4263 /// The contents of CResult_NoneLightningErrorZ
4264 pub union CResult_NoneLightningErrorZPtr {
4265         /// Note that this value is always NULL, as there are no contents in the OK variant
4266         pub result: *mut std::ffi::c_void,
4267         /// A pointer to the contents in the error state.
4268         /// Reading from this pointer when `result_ok` is set is undefined.
4269         pub err: *mut crate::lightning::ln::msgs::LightningError,
4270 }
4271 #[repr(C)]
4272 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4273 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4275 pub struct CResult_NoneLightningErrorZ {
4276         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
4277         /// `err` or `result` depending on the state of `result_ok`.
4278         pub contents: CResult_NoneLightningErrorZPtr,
4279         /// Whether this CResult_NoneLightningErrorZ represents a success state.
4280         pub result_ok: bool,
4281 }
4282 #[no_mangle]
4283 /// Creates a new CResult_NoneLightningErrorZ in the success state.
4284 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
4285         CResult_NoneLightningErrorZ {
4286                 contents: CResult_NoneLightningErrorZPtr {
4287                         result: std::ptr::null_mut(),
4288                 },
4289                 result_ok: true,
4290         }
4291 }
4292 #[no_mangle]
4293 /// Creates a new CResult_NoneLightningErrorZ in the error state.
4294 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
4295         CResult_NoneLightningErrorZ {
4296                 contents: CResult_NoneLightningErrorZPtr {
4297                         err: Box::into_raw(Box::new(e)),
4298                 },
4299                 result_ok: false,
4300         }
4301 }
4302 #[no_mangle]
4303 /// Frees any resources used by the CResult_NoneLightningErrorZ.
4304 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
4305 impl Drop for CResult_NoneLightningErrorZ {
4306         fn drop(&mut self) {
4307                 if self.result_ok {
4308                 } else {
4309                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4310                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4311                         }
4312                 }
4313         }
4314 }
4315 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
4316         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
4317                 let contents = if o.result_ok {
4318                         let _ = unsafe { Box::from_raw(o.contents.result) };
4319                         o.contents.result = std::ptr::null_mut();
4320                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
4321                 } else {
4322                         let err = unsafe { o.contents.err };
4323                         unsafe { o.contents.err = std::ptr::null_mut(); }
4324                         CResult_NoneLightningErrorZPtr { err }
4325                 };
4326                 Self {
4327                         contents,
4328                         result_ok: o.result_ok,
4329                 }
4330         }
4331 }
4332 impl Clone for CResult_NoneLightningErrorZ {
4333         fn clone(&self) -> Self {
4334                 if self.result_ok {
4335                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
4336                                 result: std::ptr::null_mut()
4337                         } }
4338                 } else {
4339                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
4340                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4341                         } }
4342                 }
4343         }
4344 }
4345 #[no_mangle]
4346 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
4347 /// but with all dynamically-allocated buffers duplicated in new buffers.
4348 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
4349 #[repr(C)]
4350 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4351 /// This corresponds to std::vector in C++
4352 pub struct CVec_PublicKeyZ {
4353         /// The elements in the array.
4354         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4355         pub data: *mut crate::c_types::PublicKey,
4356         /// The number of elements pointed to by `data`.
4357         pub datalen: usize
4358 }
4359 impl CVec_PublicKeyZ {
4360         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4361                 if self.datalen == 0 { return Vec::new(); }
4362                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4363                 self.data = std::ptr::null_mut();
4364                 self.datalen = 0;
4365                 ret
4366         }
4367         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4368                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4369         }
4370 }
4371 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4372         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4373                 let datalen = v.len();
4374                 let data = Box::into_raw(v.into_boxed_slice());
4375                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4376         }
4377 }
4378 #[no_mangle]
4379 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4380 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4381 impl Drop for CVec_PublicKeyZ {
4382         fn drop(&mut self) {
4383                 if self.datalen == 0 { return; }
4384                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4385         }
4386 }
4387 #[repr(C)]
4388 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
4389 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
4390         /// A pointer to the contents in the success state.
4391         /// Reading from this pointer when `result_ok` is not set is undefined.
4392         pub result: *mut crate::c_types::derived::CVec_u8Z,
4393         /// A pointer to the contents in the error state.
4394         /// Reading from this pointer when `result_ok` is set is undefined.
4395         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4396 }
4397 #[repr(C)]
4398 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4399 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4401 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
4402         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4403         /// `err` or `result` depending on the state of `result_ok`.
4404         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
4405         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4406         pub result_ok: bool,
4407 }
4408 #[no_mangle]
4409 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
4410 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
4411         CResult_CVec_u8ZPeerHandleErrorZ {
4412                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4413                         result: Box::into_raw(Box::new(o)),
4414                 },
4415                 result_ok: true,
4416         }
4417 }
4418 #[no_mangle]
4419 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
4420 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
4421         CResult_CVec_u8ZPeerHandleErrorZ {
4422                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4423                         err: Box::into_raw(Box::new(e)),
4424                 },
4425                 result_ok: false,
4426         }
4427 }
4428 #[no_mangle]
4429 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
4430 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
4431 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
4432         fn drop(&mut self) {
4433                 if self.result_ok {
4434                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4435                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4436                         }
4437                 } else {
4438                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4439                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4440                         }
4441                 }
4442         }
4443 }
4444 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
4445         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4446                 let contents = if o.result_ok {
4447                         let result = unsafe { o.contents.result };
4448                         unsafe { o.contents.result = std::ptr::null_mut() };
4449                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
4450                 } else {
4451                         let err = unsafe { o.contents.err };
4452                         unsafe { o.contents.err = std::ptr::null_mut(); }
4453                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
4454                 };
4455                 Self {
4456                         contents,
4457                         result_ok: o.result_ok,
4458                 }
4459         }
4460 }
4461 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
4462         fn clone(&self) -> Self {
4463                 if self.result_ok {
4464                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4465                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
4466                         } }
4467                 } else {
4468                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4469                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4470                         } }
4471                 }
4472         }
4473 }
4474 #[no_mangle]
4475 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
4476 /// but with all dynamically-allocated buffers duplicated in new buffers.
4477 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
4478 #[repr(C)]
4479 /// The contents of CResult_NonePeerHandleErrorZ
4480 pub union CResult_NonePeerHandleErrorZPtr {
4481         /// Note that this value is always NULL, as there are no contents in the OK variant
4482         pub result: *mut std::ffi::c_void,
4483         /// A pointer to the contents in the error state.
4484         /// Reading from this pointer when `result_ok` is set is undefined.
4485         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4486 }
4487 #[repr(C)]
4488 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4489 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4491 pub struct CResult_NonePeerHandleErrorZ {
4492         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4493         /// `err` or `result` depending on the state of `result_ok`.
4494         pub contents: CResult_NonePeerHandleErrorZPtr,
4495         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
4496         pub result_ok: bool,
4497 }
4498 #[no_mangle]
4499 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
4500 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
4501         CResult_NonePeerHandleErrorZ {
4502                 contents: CResult_NonePeerHandleErrorZPtr {
4503                         result: std::ptr::null_mut(),
4504                 },
4505                 result_ok: true,
4506         }
4507 }
4508 #[no_mangle]
4509 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
4510 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
4511         CResult_NonePeerHandleErrorZ {
4512                 contents: CResult_NonePeerHandleErrorZPtr {
4513                         err: Box::into_raw(Box::new(e)),
4514                 },
4515                 result_ok: false,
4516         }
4517 }
4518 #[no_mangle]
4519 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
4520 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
4521 impl Drop for CResult_NonePeerHandleErrorZ {
4522         fn drop(&mut self) {
4523                 if self.result_ok {
4524                 } else {
4525                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4526                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4527                         }
4528                 }
4529         }
4530 }
4531 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
4532         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4533                 let contents = if o.result_ok {
4534                         let _ = unsafe { Box::from_raw(o.contents.result) };
4535                         o.contents.result = std::ptr::null_mut();
4536                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
4537                 } else {
4538                         let err = unsafe { o.contents.err };
4539                         unsafe { o.contents.err = std::ptr::null_mut(); }
4540                         CResult_NonePeerHandleErrorZPtr { err }
4541                 };
4542                 Self {
4543                         contents,
4544                         result_ok: o.result_ok,
4545                 }
4546         }
4547 }
4548 impl Clone for CResult_NonePeerHandleErrorZ {
4549         fn clone(&self) -> Self {
4550                 if self.result_ok {
4551                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
4552                                 result: std::ptr::null_mut()
4553                         } }
4554                 } else {
4555                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
4556                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4557                         } }
4558                 }
4559         }
4560 }
4561 #[no_mangle]
4562 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
4563 /// but with all dynamically-allocated buffers duplicated in new buffers.
4564 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
4565 #[repr(C)]
4566 /// The contents of CResult_boolPeerHandleErrorZ
4567 pub union CResult_boolPeerHandleErrorZPtr {
4568         /// A pointer to the contents in the success state.
4569         /// Reading from this pointer when `result_ok` is not set is undefined.
4570         pub result: *mut bool,
4571         /// A pointer to the contents in the error state.
4572         /// Reading from this pointer when `result_ok` is set is undefined.
4573         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4574 }
4575 #[repr(C)]
4576 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4577 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4579 pub struct CResult_boolPeerHandleErrorZ {
4580         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4581         /// `err` or `result` depending on the state of `result_ok`.
4582         pub contents: CResult_boolPeerHandleErrorZPtr,
4583         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
4584         pub result_ok: bool,
4585 }
4586 #[no_mangle]
4587 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
4588 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
4589         CResult_boolPeerHandleErrorZ {
4590                 contents: CResult_boolPeerHandleErrorZPtr {
4591                         result: Box::into_raw(Box::new(o)),
4592                 },
4593                 result_ok: true,
4594         }
4595 }
4596 #[no_mangle]
4597 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
4598 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
4599         CResult_boolPeerHandleErrorZ {
4600                 contents: CResult_boolPeerHandleErrorZPtr {
4601                         err: Box::into_raw(Box::new(e)),
4602                 },
4603                 result_ok: false,
4604         }
4605 }
4606 #[no_mangle]
4607 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
4608 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
4609 impl Drop for CResult_boolPeerHandleErrorZ {
4610         fn drop(&mut self) {
4611                 if self.result_ok {
4612                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4613                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4614                         }
4615                 } else {
4616                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4617                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4618                         }
4619                 }
4620         }
4621 }
4622 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
4623         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4624                 let contents = if o.result_ok {
4625                         let result = unsafe { o.contents.result };
4626                         unsafe { o.contents.result = std::ptr::null_mut() };
4627                         CResult_boolPeerHandleErrorZPtr { result }
4628                 } else {
4629                         let err = unsafe { o.contents.err };
4630                         unsafe { o.contents.err = std::ptr::null_mut(); }
4631                         CResult_boolPeerHandleErrorZPtr { err }
4632                 };
4633                 Self {
4634                         contents,
4635                         result_ok: o.result_ok,
4636                 }
4637         }
4638 }
4639 impl Clone for CResult_boolPeerHandleErrorZ {
4640         fn clone(&self) -> Self {
4641                 if self.result_ok {
4642                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
4643                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4644                         } }
4645                 } else {
4646                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
4647                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4648                         } }
4649                 }
4650         }
4651 }
4652 #[no_mangle]
4653 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
4654 /// but with all dynamically-allocated buffers duplicated in new buffers.
4655 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
4656 #[repr(C)]
4657 /// The contents of CResult_TxOutAccessErrorZ
4658 pub union CResult_TxOutAccessErrorZPtr {
4659         /// A pointer to the contents in the success state.
4660         /// Reading from this pointer when `result_ok` is not set is undefined.
4661         pub result: *mut crate::c_types::TxOut,
4662         /// A pointer to the contents in the error state.
4663         /// Reading from this pointer when `result_ok` is set is undefined.
4664         pub err: *mut crate::lightning::chain::AccessError,
4665 }
4666 #[repr(C)]
4667 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4668 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4670 pub struct CResult_TxOutAccessErrorZ {
4671         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4672         /// `err` or `result` depending on the state of `result_ok`.
4673         pub contents: CResult_TxOutAccessErrorZPtr,
4674         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4675         pub result_ok: bool,
4676 }
4677 #[no_mangle]
4678 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4679 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4680         CResult_TxOutAccessErrorZ {
4681                 contents: CResult_TxOutAccessErrorZPtr {
4682                         result: Box::into_raw(Box::new(o)),
4683                 },
4684                 result_ok: true,
4685         }
4686 }
4687 #[no_mangle]
4688 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4689 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4690         CResult_TxOutAccessErrorZ {
4691                 contents: CResult_TxOutAccessErrorZPtr {
4692                         err: Box::into_raw(Box::new(e)),
4693                 },
4694                 result_ok: false,
4695         }
4696 }
4697 #[no_mangle]
4698 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
4699 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4700 impl Drop for CResult_TxOutAccessErrorZ {
4701         fn drop(&mut self) {
4702                 if self.result_ok {
4703                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4704                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4705                         }
4706                 } else {
4707                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4708                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4709                         }
4710                 }
4711         }
4712 }
4713 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4714         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
4715                 let contents = if o.result_ok {
4716                         let result = unsafe { o.contents.result };
4717                         unsafe { o.contents.result = std::ptr::null_mut() };
4718                         CResult_TxOutAccessErrorZPtr { result }
4719                 } else {
4720                         let err = unsafe { o.contents.err };
4721                         unsafe { o.contents.err = std::ptr::null_mut(); }
4722                         CResult_TxOutAccessErrorZPtr { err }
4723                 };
4724                 Self {
4725                         contents,
4726                         result_ok: o.result_ok,
4727                 }
4728         }
4729 }
4730 impl Clone for CResult_TxOutAccessErrorZ {
4731         fn clone(&self) -> Self {
4732                 if self.result_ok {
4733                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4734                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4735                         } }
4736                 } else {
4737                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4738                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4739                         } }
4740                 }
4741         }
4742 }
4743 #[no_mangle]
4744 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4745 /// but with all dynamically-allocated buffers duplicated in new buffers.
4746 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4747 #[repr(C)]
4748 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4749 pub enum COption_C2Tuple_usizeTransactionZZ {
4750         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4751         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4752         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4753         None
4754 }
4755 impl COption_C2Tuple_usizeTransactionZZ {
4756         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4757                 if let Self::Some(_) = self { true } else { false }
4758         }
4759         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4760                 if let Self::Some(v) = self { v } else { unreachable!() }
4761         }
4762 }
4763 #[no_mangle]
4764 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4765 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4766         COption_C2Tuple_usizeTransactionZZ::Some(o)
4767 }
4768 #[no_mangle]
4769 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4770 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4771         COption_C2Tuple_usizeTransactionZZ::None
4772 }
4773 #[no_mangle]
4774 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4775 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4776 #[repr(C)]
4777 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4778 /// This corresponds to std::vector in C++
4779 pub struct CVec_SpendableOutputDescriptorZ {
4780         /// The elements in the array.
4781         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4782         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4783         /// The number of elements pointed to by `data`.
4784         pub datalen: usize
4785 }
4786 impl CVec_SpendableOutputDescriptorZ {
4787         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
4788                 if self.datalen == 0 { return Vec::new(); }
4789                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4790                 self.data = std::ptr::null_mut();
4791                 self.datalen = 0;
4792                 ret
4793         }
4794         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
4795                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4796         }
4797 }
4798 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4799         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4800                 let datalen = v.len();
4801                 let data = Box::into_raw(v.into_boxed_slice());
4802                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4803         }
4804 }
4805 #[no_mangle]
4806 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4807 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4808 impl Drop for CVec_SpendableOutputDescriptorZ {
4809         fn drop(&mut self) {
4810                 if self.datalen == 0 { return; }
4811                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4812         }
4813 }
4814 impl Clone for CVec_SpendableOutputDescriptorZ {
4815         fn clone(&self) -> Self {
4816                 let mut res = Vec::new();
4817                 if self.datalen == 0 { return Self::from(res); }
4818                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4819                 Self::from(res)
4820         }
4821 }
4822 #[repr(C)]
4823 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4824 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
4825         /// A pointer to the contents in the success state.
4826         /// Reading from this pointer when `result_ok` is not set is undefined.
4827         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
4828         /// A pointer to the contents in the error state.
4829         /// Reading from this pointer when `result_ok` is set is undefined.
4830         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4831 }
4832 #[repr(C)]
4833 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4834 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4835 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4836 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
4837         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4838         /// `err` or `result` depending on the state of `result_ok`.
4839         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
4840         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4841         pub result_ok: bool,
4842 }
4843 #[no_mangle]
4844 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
4845 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4846         CResult_DirectionalChannelInfoDecodeErrorZ {
4847                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4848                         result: Box::into_raw(Box::new(o)),
4849                 },
4850                 result_ok: true,
4851         }
4852 }
4853 #[no_mangle]
4854 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
4855 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4856         CResult_DirectionalChannelInfoDecodeErrorZ {
4857                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4858                         err: Box::into_raw(Box::new(e)),
4859                 },
4860                 result_ok: false,
4861         }
4862 }
4863 #[no_mangle]
4864 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
4865 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
4866 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
4867         fn drop(&mut self) {
4868                 if self.result_ok {
4869                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4870                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4871                         }
4872                 } else {
4873                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4874                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4875                         }
4876                 }
4877         }
4878 }
4879 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
4880         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4881                 let contents = if o.result_ok {
4882                         let result = unsafe { o.contents.result };
4883                         unsafe { o.contents.result = std::ptr::null_mut() };
4884                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
4885                 } else {
4886                         let err = unsafe { o.contents.err };
4887                         unsafe { o.contents.err = std::ptr::null_mut(); }
4888                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
4889                 };
4890                 Self {
4891                         contents,
4892                         result_ok: o.result_ok,
4893                 }
4894         }
4895 }
4896 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
4897         fn clone(&self) -> Self {
4898                 if self.result_ok {
4899                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4900                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
4901                         } }
4902                 } else {
4903                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4904                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4905                         } }
4906                 }
4907         }
4908 }
4909 #[no_mangle]
4910 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
4911 /// but with all dynamically-allocated buffers duplicated in new buffers.
4912 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
4913 #[repr(C)]
4914 /// The contents of CResult_ChannelInfoDecodeErrorZ
4915 pub union CResult_ChannelInfoDecodeErrorZPtr {
4916         /// A pointer to the contents in the success state.
4917         /// Reading from this pointer when `result_ok` is not set is undefined.
4918         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
4919         /// A pointer to the contents in the error state.
4920         /// Reading from this pointer when `result_ok` is set is undefined.
4921         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4922 }
4923 #[repr(C)]
4924 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4925 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4926 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4927 pub struct CResult_ChannelInfoDecodeErrorZ {
4928         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4929         /// `err` or `result` depending on the state of `result_ok`.
4930         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
4931         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4932         pub result_ok: bool,
4933 }
4934 #[no_mangle]
4935 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
4936 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
4937         CResult_ChannelInfoDecodeErrorZ {
4938                 contents: CResult_ChannelInfoDecodeErrorZPtr {
4939                         result: Box::into_raw(Box::new(o)),
4940                 },
4941                 result_ok: true,
4942         }
4943 }
4944 #[no_mangle]
4945 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
4946 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
4947         CResult_ChannelInfoDecodeErrorZ {
4948                 contents: CResult_ChannelInfoDecodeErrorZPtr {
4949                         err: Box::into_raw(Box::new(e)),
4950                 },
4951                 result_ok: false,
4952         }
4953 }
4954 #[no_mangle]
4955 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
4956 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
4957 impl Drop for CResult_ChannelInfoDecodeErrorZ {
4958         fn drop(&mut self) {
4959                 if self.result_ok {
4960                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4961                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4962                         }
4963                 } else {
4964                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4965                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4966                         }
4967                 }
4968         }
4969 }
4970 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
4971         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4972                 let contents = if o.result_ok {
4973                         let result = unsafe { o.contents.result };
4974                         unsafe { o.contents.result = std::ptr::null_mut() };
4975                         CResult_ChannelInfoDecodeErrorZPtr { result }
4976                 } else {
4977                         let err = unsafe { o.contents.err };
4978                         unsafe { o.contents.err = std::ptr::null_mut(); }
4979                         CResult_ChannelInfoDecodeErrorZPtr { err }
4980                 };
4981                 Self {
4982                         contents,
4983                         result_ok: o.result_ok,
4984                 }
4985         }
4986 }
4987 impl Clone for CResult_ChannelInfoDecodeErrorZ {
4988         fn clone(&self) -> Self {
4989                 if self.result_ok {
4990                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
4991                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
4992                         } }
4993                 } else {
4994                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
4995                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4996                         } }
4997                 }
4998         }
4999 }
5000 #[no_mangle]
5001 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5002 /// but with all dynamically-allocated buffers duplicated in new buffers.
5003 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
5004 #[repr(C)]
5005 /// The contents of CResult_RoutingFeesDecodeErrorZ
5006 pub union CResult_RoutingFeesDecodeErrorZPtr {
5007         /// A pointer to the contents in the success state.
5008         /// Reading from this pointer when `result_ok` is not set is undefined.
5009         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
5010         /// A pointer to the contents in the error state.
5011         /// Reading from this pointer when `result_ok` is set is undefined.
5012         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5013 }
5014 #[repr(C)]
5015 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5016 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5017 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5018 pub struct CResult_RoutingFeesDecodeErrorZ {
5019         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5020         /// `err` or `result` depending on the state of `result_ok`.
5021         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5022         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5023         pub result_ok: bool,
5024 }
5025 #[no_mangle]
5026 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5027 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5028         CResult_RoutingFeesDecodeErrorZ {
5029                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5030                         result: Box::into_raw(Box::new(o)),
5031                 },
5032                 result_ok: true,
5033         }
5034 }
5035 #[no_mangle]
5036 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5037 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5038         CResult_RoutingFeesDecodeErrorZ {
5039                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5040                         err: Box::into_raw(Box::new(e)),
5041                 },
5042                 result_ok: false,
5043         }
5044 }
5045 #[no_mangle]
5046 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5047 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5048 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5049         fn drop(&mut self) {
5050                 if self.result_ok {
5051                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5052                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5053                         }
5054                 } else {
5055                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5056                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5057                         }
5058                 }
5059         }
5060 }
5061 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5062         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5063                 let contents = if o.result_ok {
5064                         let result = unsafe { o.contents.result };
5065                         unsafe { o.contents.result = std::ptr::null_mut() };
5066                         CResult_RoutingFeesDecodeErrorZPtr { result }
5067                 } else {
5068                         let err = unsafe { o.contents.err };
5069                         unsafe { o.contents.err = std::ptr::null_mut(); }
5070                         CResult_RoutingFeesDecodeErrorZPtr { err }
5071                 };
5072                 Self {
5073                         contents,
5074                         result_ok: o.result_ok,
5075                 }
5076         }
5077 }
5078 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5079         fn clone(&self) -> Self {
5080                 if self.result_ok {
5081                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5082                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
5083                         } }
5084                 } else {
5085                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5086                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5087                         } }
5088                 }
5089         }
5090 }
5091 #[no_mangle]
5092 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5093 /// but with all dynamically-allocated buffers duplicated in new buffers.
5094 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
5095 #[repr(C)]
5096 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5097 /// This corresponds to std::vector in C++
5098 pub struct CVec_NetAddressZ {
5099         /// The elements in the array.
5100         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5101         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5102         /// The number of elements pointed to by `data`.
5103         pub datalen: usize
5104 }
5105 impl CVec_NetAddressZ {
5106         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5107                 if self.datalen == 0 { return Vec::new(); }
5108                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5109                 self.data = std::ptr::null_mut();
5110                 self.datalen = 0;
5111                 ret
5112         }
5113         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5114                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5115         }
5116 }
5117 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5118         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5119                 let datalen = v.len();
5120                 let data = Box::into_raw(v.into_boxed_slice());
5121                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5122         }
5123 }
5124 #[no_mangle]
5125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5126 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5127 impl Drop for CVec_NetAddressZ {
5128         fn drop(&mut self) {
5129                 if self.datalen == 0 { return; }
5130                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5131         }
5132 }
5133 impl Clone for CVec_NetAddressZ {
5134         fn clone(&self) -> Self {
5135                 let mut res = Vec::new();
5136                 if self.datalen == 0 { return Self::from(res); }
5137                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5138                 Self::from(res)
5139         }
5140 }
5141 #[repr(C)]
5142 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5143 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5144         /// A pointer to the contents in the success state.
5145         /// Reading from this pointer when `result_ok` is not set is undefined.
5146         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
5147         /// A pointer to the contents in the error state.
5148         /// Reading from this pointer when `result_ok` is set is undefined.
5149         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5150 }
5151 #[repr(C)]
5152 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5153 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5154 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5155 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5156         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5157         /// `err` or `result` depending on the state of `result_ok`.
5158         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5159         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5160         pub result_ok: bool,
5161 }
5162 #[no_mangle]
5163 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5164 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5165         CResult_NodeAnnouncementInfoDecodeErrorZ {
5166                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5167                         result: Box::into_raw(Box::new(o)),
5168                 },
5169                 result_ok: true,
5170         }
5171 }
5172 #[no_mangle]
5173 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5174 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5175         CResult_NodeAnnouncementInfoDecodeErrorZ {
5176                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5177                         err: Box::into_raw(Box::new(e)),
5178                 },
5179                 result_ok: false,
5180         }
5181 }
5182 #[no_mangle]
5183 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5184 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5185 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5186         fn drop(&mut self) {
5187                 if self.result_ok {
5188                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5189                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5190                         }
5191                 } else {
5192                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5193                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5194                         }
5195                 }
5196         }
5197 }
5198 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5199         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5200                 let contents = if o.result_ok {
5201                         let result = unsafe { o.contents.result };
5202                         unsafe { o.contents.result = std::ptr::null_mut() };
5203                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5204                 } else {
5205                         let err = unsafe { o.contents.err };
5206                         unsafe { o.contents.err = std::ptr::null_mut(); }
5207                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5208                 };
5209                 Self {
5210                         contents,
5211                         result_ok: o.result_ok,
5212                 }
5213         }
5214 }
5215 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5216         fn clone(&self) -> Self {
5217                 if self.result_ok {
5218                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5219                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5220                         } }
5221                 } else {
5222                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5223                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5224                         } }
5225                 }
5226         }
5227 }
5228 #[no_mangle]
5229 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5230 /// but with all dynamically-allocated buffers duplicated in new buffers.
5231 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
5232 #[repr(C)]
5233 /// A dynamically-allocated array of u64s of arbitrary size.
5234 /// This corresponds to std::vector in C++
5235 pub struct CVec_u64Z {
5236         /// The elements in the array.
5237         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5238         pub data: *mut u64,
5239         /// The number of elements pointed to by `data`.
5240         pub datalen: usize
5241 }
5242 impl CVec_u64Z {
5243         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5244                 if self.datalen == 0 { return Vec::new(); }
5245                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5246                 self.data = std::ptr::null_mut();
5247                 self.datalen = 0;
5248                 ret
5249         }
5250         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5251                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5252         }
5253 }
5254 impl From<Vec<u64>> for CVec_u64Z {
5255         fn from(v: Vec<u64>) -> Self {
5256                 let datalen = v.len();
5257                 let data = Box::into_raw(v.into_boxed_slice());
5258                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5259         }
5260 }
5261 #[no_mangle]
5262 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5263 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5264 impl Drop for CVec_u64Z {
5265         fn drop(&mut self) {
5266                 if self.datalen == 0 { return; }
5267                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5268         }
5269 }
5270 impl Clone for CVec_u64Z {
5271         fn clone(&self) -> Self {
5272                 let mut res = Vec::new();
5273                 if self.datalen == 0 { return Self::from(res); }
5274                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5275                 Self::from(res)
5276         }
5277 }
5278 #[repr(C)]
5279 /// The contents of CResult_NodeInfoDecodeErrorZ
5280 pub union CResult_NodeInfoDecodeErrorZPtr {
5281         /// A pointer to the contents in the success state.
5282         /// Reading from this pointer when `result_ok` is not set is undefined.
5283         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
5284         /// A pointer to the contents in the error state.
5285         /// Reading from this pointer when `result_ok` is set is undefined.
5286         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5287 }
5288 #[repr(C)]
5289 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5290 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5292 pub struct CResult_NodeInfoDecodeErrorZ {
5293         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5294         /// `err` or `result` depending on the state of `result_ok`.
5295         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5296         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5297         pub result_ok: bool,
5298 }
5299 #[no_mangle]
5300 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5301 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5302         CResult_NodeInfoDecodeErrorZ {
5303                 contents: CResult_NodeInfoDecodeErrorZPtr {
5304                         result: Box::into_raw(Box::new(o)),
5305                 },
5306                 result_ok: true,
5307         }
5308 }
5309 #[no_mangle]
5310 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5311 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5312         CResult_NodeInfoDecodeErrorZ {
5313                 contents: CResult_NodeInfoDecodeErrorZPtr {
5314                         err: Box::into_raw(Box::new(e)),
5315                 },
5316                 result_ok: false,
5317         }
5318 }
5319 #[no_mangle]
5320 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5321 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5322 impl Drop for CResult_NodeInfoDecodeErrorZ {
5323         fn drop(&mut self) {
5324                 if self.result_ok {
5325                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5326                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5327                         }
5328                 } else {
5329                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5330                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5331                         }
5332                 }
5333         }
5334 }
5335 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5336         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5337                 let contents = if o.result_ok {
5338                         let result = unsafe { o.contents.result };
5339                         unsafe { o.contents.result = std::ptr::null_mut() };
5340                         CResult_NodeInfoDecodeErrorZPtr { result }
5341                 } else {
5342                         let err = unsafe { o.contents.err };
5343                         unsafe { o.contents.err = std::ptr::null_mut(); }
5344                         CResult_NodeInfoDecodeErrorZPtr { err }
5345                 };
5346                 Self {
5347                         contents,
5348                         result_ok: o.result_ok,
5349                 }
5350         }
5351 }
5352 impl Clone for CResult_NodeInfoDecodeErrorZ {
5353         fn clone(&self) -> Self {
5354                 if self.result_ok {
5355                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5356                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
5357                         } }
5358                 } else {
5359                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5360                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5361                         } }
5362                 }
5363         }
5364 }
5365 #[no_mangle]
5366 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5367 /// but with all dynamically-allocated buffers duplicated in new buffers.
5368 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
5369 #[repr(C)]
5370 /// The contents of CResult_NetworkGraphDecodeErrorZ
5371 pub union CResult_NetworkGraphDecodeErrorZPtr {
5372         /// A pointer to the contents in the success state.
5373         /// Reading from this pointer when `result_ok` is not set is undefined.
5374         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
5375         /// A pointer to the contents in the error state.
5376         /// Reading from this pointer when `result_ok` is set is undefined.
5377         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5378 }
5379 #[repr(C)]
5380 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5381 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5383 pub struct CResult_NetworkGraphDecodeErrorZ {
5384         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5385         /// `err` or `result` depending on the state of `result_ok`.
5386         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5387         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5388         pub result_ok: bool,
5389 }
5390 #[no_mangle]
5391 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5392 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5393         CResult_NetworkGraphDecodeErrorZ {
5394                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5395                         result: Box::into_raw(Box::new(o)),
5396                 },
5397                 result_ok: true,
5398         }
5399 }
5400 #[no_mangle]
5401 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5402 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5403         CResult_NetworkGraphDecodeErrorZ {
5404                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5405                         err: Box::into_raw(Box::new(e)),
5406                 },
5407                 result_ok: false,
5408         }
5409 }
5410 #[no_mangle]
5411 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5412 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5413 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5414         fn drop(&mut self) {
5415                 if self.result_ok {
5416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5418                         }
5419                 } else {
5420                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5421                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5422                         }
5423                 }
5424         }
5425 }
5426 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5427         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5428                 let contents = if o.result_ok {
5429                         let result = unsafe { o.contents.result };
5430                         unsafe { o.contents.result = std::ptr::null_mut() };
5431                         CResult_NetworkGraphDecodeErrorZPtr { result }
5432                 } else {
5433                         let err = unsafe { o.contents.err };
5434                         unsafe { o.contents.err = std::ptr::null_mut(); }
5435                         CResult_NetworkGraphDecodeErrorZPtr { err }
5436                 };
5437                 Self {
5438                         contents,
5439                         result_ok: o.result_ok,
5440                 }
5441         }
5442 }
5443 impl Clone for CResult_NetworkGraphDecodeErrorZ {
5444         fn clone(&self) -> Self {
5445                 if self.result_ok {
5446                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
5447                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
5448                         } }
5449                 } else {
5450                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
5451                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5452                         } }
5453                 }
5454         }
5455 }
5456 #[no_mangle]
5457 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
5458 /// but with all dynamically-allocated buffers duplicated in new buffers.
5459 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
5460 #[repr(C)]
5461 /// The contents of CResult_InitFeaturesDecodeErrorZ
5462 pub union CResult_InitFeaturesDecodeErrorZPtr {
5463         /// A pointer to the contents in the success state.
5464         /// Reading from this pointer when `result_ok` is not set is undefined.
5465         pub result: *mut crate::lightning::ln::features::InitFeatures,
5466         /// A pointer to the contents in the error state.
5467         /// Reading from this pointer when `result_ok` is set is undefined.
5468         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5469 }
5470 #[repr(C)]
5471 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5472 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5474 pub struct CResult_InitFeaturesDecodeErrorZ {
5475         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5476         /// `err` or `result` depending on the state of `result_ok`.
5477         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5478         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5479         pub result_ok: bool,
5480 }
5481 #[no_mangle]
5482 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5483 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5484         CResult_InitFeaturesDecodeErrorZ {
5485                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5486                         result: Box::into_raw(Box::new(o)),
5487                 },
5488                 result_ok: true,
5489         }
5490 }
5491 #[no_mangle]
5492 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5493 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5494         CResult_InitFeaturesDecodeErrorZ {
5495                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5496                         err: Box::into_raw(Box::new(e)),
5497                 },
5498                 result_ok: false,
5499         }
5500 }
5501 #[no_mangle]
5502 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5503 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5504 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5505         fn drop(&mut self) {
5506                 if self.result_ok {
5507                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5508                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5509                         }
5510                 } else {
5511                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5512                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5513                         }
5514                 }
5515         }
5516 }
5517 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5518         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5519                 let contents = if o.result_ok {
5520                         let result = unsafe { o.contents.result };
5521                         unsafe { o.contents.result = std::ptr::null_mut() };
5522                         CResult_InitFeaturesDecodeErrorZPtr { result }
5523                 } else {
5524                         let err = unsafe { o.contents.err };
5525                         unsafe { o.contents.err = std::ptr::null_mut(); }
5526                         CResult_InitFeaturesDecodeErrorZPtr { err }
5527                 };
5528                 Self {
5529                         contents,
5530                         result_ok: o.result_ok,
5531                 }
5532         }
5533 }
5534 #[repr(C)]
5535 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5536 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5537         /// A pointer to the contents in the success state.
5538         /// Reading from this pointer when `result_ok` is not set is undefined.
5539         pub result: *mut crate::lightning::ln::features::NodeFeatures,
5540         /// A pointer to the contents in the error state.
5541         /// Reading from this pointer when `result_ok` is set is undefined.
5542         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5543 }
5544 #[repr(C)]
5545 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5546 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5548 pub struct CResult_NodeFeaturesDecodeErrorZ {
5549         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5550         /// `err` or `result` depending on the state of `result_ok`.
5551         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5552         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5553         pub result_ok: bool,
5554 }
5555 #[no_mangle]
5556 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5557 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5558         CResult_NodeFeaturesDecodeErrorZ {
5559                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5560                         result: Box::into_raw(Box::new(o)),
5561                 },
5562                 result_ok: true,
5563         }
5564 }
5565 #[no_mangle]
5566 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5567 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5568         CResult_NodeFeaturesDecodeErrorZ {
5569                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5570                         err: Box::into_raw(Box::new(e)),
5571                 },
5572                 result_ok: false,
5573         }
5574 }
5575 #[no_mangle]
5576 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5577 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5578 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5579         fn drop(&mut self) {
5580                 if self.result_ok {
5581                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5582                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5583                         }
5584                 } else {
5585                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5586                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5587                         }
5588                 }
5589         }
5590 }
5591 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5592         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5593                 let contents = if o.result_ok {
5594                         let result = unsafe { o.contents.result };
5595                         unsafe { o.contents.result = std::ptr::null_mut() };
5596                         CResult_NodeFeaturesDecodeErrorZPtr { result }
5597                 } else {
5598                         let err = unsafe { o.contents.err };
5599                         unsafe { o.contents.err = std::ptr::null_mut(); }
5600                         CResult_NodeFeaturesDecodeErrorZPtr { err }
5601                 };
5602                 Self {
5603                         contents,
5604                         result_ok: o.result_ok,
5605                 }
5606         }
5607 }
5608 #[repr(C)]
5609 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5610 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5611         /// A pointer to the contents in the success state.
5612         /// Reading from this pointer when `result_ok` is not set is undefined.
5613         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5614         /// A pointer to the contents in the error state.
5615         /// Reading from this pointer when `result_ok` is set is undefined.
5616         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5617 }
5618 #[repr(C)]
5619 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5620 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5622 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5623         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5624         /// `err` or `result` depending on the state of `result_ok`.
5625         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5626         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5627         pub result_ok: bool,
5628 }
5629 #[no_mangle]
5630 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5631 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5632         CResult_ChannelFeaturesDecodeErrorZ {
5633                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5634                         result: Box::into_raw(Box::new(o)),
5635                 },
5636                 result_ok: true,
5637         }
5638 }
5639 #[no_mangle]
5640 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5641 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5642         CResult_ChannelFeaturesDecodeErrorZ {
5643                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5644                         err: Box::into_raw(Box::new(e)),
5645                 },
5646                 result_ok: false,
5647         }
5648 }
5649 #[no_mangle]
5650 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5651 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5652 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5653         fn drop(&mut self) {
5654                 if self.result_ok {
5655                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5656                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5657                         }
5658                 } else {
5659                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5660                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5661                         }
5662                 }
5663         }
5664 }
5665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5666         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5667                 let contents = if o.result_ok {
5668                         let result = unsafe { o.contents.result };
5669                         unsafe { o.contents.result = std::ptr::null_mut() };
5670                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
5671                 } else {
5672                         let err = unsafe { o.contents.err };
5673                         unsafe { o.contents.err = std::ptr::null_mut(); }
5674                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
5675                 };
5676                 Self {
5677                         contents,
5678                         result_ok: o.result_ok,
5679                 }
5680         }
5681 }
5682 #[repr(C)]
5683 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
5684 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
5685         /// A pointer to the contents in the success state.
5686         /// Reading from this pointer when `result_ok` is not set is undefined.
5687         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
5688         /// A pointer to the contents in the error state.
5689         /// Reading from this pointer when `result_ok` is set is undefined.
5690         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5691 }
5692 #[repr(C)]
5693 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5694 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5696 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
5697         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5698         /// `err` or `result` depending on the state of `result_ok`.
5699         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
5700         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5701         pub result_ok: bool,
5702 }
5703 #[no_mangle]
5704 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
5705 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
5706         CResult_InvoiceFeaturesDecodeErrorZ {
5707                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5708                         result: Box::into_raw(Box::new(o)),
5709                 },
5710                 result_ok: true,
5711         }
5712 }
5713 #[no_mangle]
5714 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
5715 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
5716         CResult_InvoiceFeaturesDecodeErrorZ {
5717                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5718                         err: Box::into_raw(Box::new(e)),
5719                 },
5720                 result_ok: false,
5721         }
5722 }
5723 #[no_mangle]
5724 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
5725 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
5726 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
5727         fn drop(&mut self) {
5728                 if self.result_ok {
5729                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5730                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5731                         }
5732                 } else {
5733                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5734                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5735                         }
5736                 }
5737         }
5738 }
5739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
5740         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5741                 let contents = if o.result_ok {
5742                         let result = unsafe { o.contents.result };
5743                         unsafe { o.contents.result = std::ptr::null_mut() };
5744                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
5745                 } else {
5746                         let err = unsafe { o.contents.err };
5747                         unsafe { o.contents.err = std::ptr::null_mut(); }
5748                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
5749                 };
5750                 Self {
5751                         contents,
5752                         result_ok: o.result_ok,
5753                 }
5754         }
5755 }
5756 #[repr(C)]
5757 /// The contents of CResult_NetAddressu8Z
5758 pub union CResult_NetAddressu8ZPtr {
5759         /// A pointer to the contents in the success state.
5760         /// Reading from this pointer when `result_ok` is not set is undefined.
5761         pub result: *mut crate::lightning::ln::msgs::NetAddress,
5762         /// A pointer to the contents in the error state.
5763         /// Reading from this pointer when `result_ok` is set is undefined.
5764         pub err: *mut u8,
5765 }
5766 #[repr(C)]
5767 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5768 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5769 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5770 pub struct CResult_NetAddressu8Z {
5771         /// The contents of this CResult_NetAddressu8Z, accessible via either
5772         /// `err` or `result` depending on the state of `result_ok`.
5773         pub contents: CResult_NetAddressu8ZPtr,
5774         /// Whether this CResult_NetAddressu8Z represents a success state.
5775         pub result_ok: bool,
5776 }
5777 #[no_mangle]
5778 /// Creates a new CResult_NetAddressu8Z in the success state.
5779 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5780         CResult_NetAddressu8Z {
5781                 contents: CResult_NetAddressu8ZPtr {
5782                         result: Box::into_raw(Box::new(o)),
5783                 },
5784                 result_ok: true,
5785         }
5786 }
5787 #[no_mangle]
5788 /// Creates a new CResult_NetAddressu8Z in the error state.
5789 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5790         CResult_NetAddressu8Z {
5791                 contents: CResult_NetAddressu8ZPtr {
5792                         err: Box::into_raw(Box::new(e)),
5793                 },
5794                 result_ok: false,
5795         }
5796 }
5797 #[no_mangle]
5798 /// Frees any resources used by the CResult_NetAddressu8Z.
5799 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5800 impl Drop for CResult_NetAddressu8Z {
5801         fn drop(&mut self) {
5802                 if self.result_ok {
5803                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5804                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5805                         }
5806                 } else {
5807                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5808                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5809                         }
5810                 }
5811         }
5812 }
5813 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5814         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
5815                 let contents = if o.result_ok {
5816                         let result = unsafe { o.contents.result };
5817                         unsafe { o.contents.result = std::ptr::null_mut() };
5818                         CResult_NetAddressu8ZPtr { result }
5819                 } else {
5820                         let err = unsafe { o.contents.err };
5821                         unsafe { o.contents.err = std::ptr::null_mut(); }
5822                         CResult_NetAddressu8ZPtr { err }
5823                 };
5824                 Self {
5825                         contents,
5826                         result_ok: o.result_ok,
5827                 }
5828         }
5829 }
5830 impl Clone for CResult_NetAddressu8Z {
5831         fn clone(&self) -> Self {
5832                 if self.result_ok {
5833                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5834                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5835                         } }
5836                 } else {
5837                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5838                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5839                         } }
5840                 }
5841         }
5842 }
5843 #[no_mangle]
5844 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5845 /// but with all dynamically-allocated buffers duplicated in new buffers.
5846 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5847 #[repr(C)]
5848 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5849 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5850         /// A pointer to the contents in the success state.
5851         /// Reading from this pointer when `result_ok` is not set is undefined.
5852         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
5853         /// A pointer to the contents in the error state.
5854         /// Reading from this pointer when `result_ok` is set is undefined.
5855         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5856 }
5857 #[repr(C)]
5858 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5859 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5861 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5862         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5863         /// `err` or `result` depending on the state of `result_ok`.
5864         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5865         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5866         pub result_ok: bool,
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5870 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5871         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5872                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5873                         result: Box::into_raw(Box::new(o)),
5874                 },
5875                 result_ok: true,
5876         }
5877 }
5878 #[no_mangle]
5879 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5880 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5881         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5882                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5883                         err: Box::into_raw(Box::new(e)),
5884                 },
5885                 result_ok: false,
5886         }
5887 }
5888 #[no_mangle]
5889 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
5890 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5891 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5892         fn drop(&mut self) {
5893                 if self.result_ok {
5894                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5895                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5896                         }
5897                 } else {
5898                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5899                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5900                         }
5901                 }
5902         }
5903 }
5904 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5905         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
5906                 let contents = if o.result_ok {
5907                         let result = unsafe { o.contents.result };
5908                         unsafe { o.contents.result = std::ptr::null_mut() };
5909                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5910                 } else {
5911                         let err = unsafe { o.contents.err };
5912                         unsafe { o.contents.err = std::ptr::null_mut(); }
5913                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5914                 };
5915                 Self {
5916                         contents,
5917                         result_ok: o.result_ok,
5918                 }
5919         }
5920 }
5921 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5922         fn clone(&self) -> Self {
5923                 if self.result_ok {
5924                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5925                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5926                         } }
5927                 } else {
5928                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5929                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5930                         } }
5931                 }
5932         }
5933 }
5934 #[no_mangle]
5935 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5936 /// but with all dynamically-allocated buffers duplicated in new buffers.
5937 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5938 #[repr(C)]
5939 /// The contents of CResult_NetAddressDecodeErrorZ
5940 pub union CResult_NetAddressDecodeErrorZPtr {
5941         /// A pointer to the contents in the success state.
5942         /// Reading from this pointer when `result_ok` is not set is undefined.
5943         pub result: *mut crate::lightning::ln::msgs::NetAddress,
5944         /// A pointer to the contents in the error state.
5945         /// Reading from this pointer when `result_ok` is set is undefined.
5946         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5947 }
5948 #[repr(C)]
5949 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
5950 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
5951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5952 pub struct CResult_NetAddressDecodeErrorZ {
5953         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
5954         /// `err` or `result` depending on the state of `result_ok`.
5955         pub contents: CResult_NetAddressDecodeErrorZPtr,
5956         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
5957         pub result_ok: bool,
5958 }
5959 #[no_mangle]
5960 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
5961 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
5962         CResult_NetAddressDecodeErrorZ {
5963                 contents: CResult_NetAddressDecodeErrorZPtr {
5964                         result: Box::into_raw(Box::new(o)),
5965                 },
5966                 result_ok: true,
5967         }
5968 }
5969 #[no_mangle]
5970 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
5971 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
5972         CResult_NetAddressDecodeErrorZ {
5973                 contents: CResult_NetAddressDecodeErrorZPtr {
5974                         err: Box::into_raw(Box::new(e)),
5975                 },
5976                 result_ok: false,
5977         }
5978 }
5979 #[no_mangle]
5980 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
5981 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
5982 impl Drop for CResult_NetAddressDecodeErrorZ {
5983         fn drop(&mut self) {
5984                 if self.result_ok {
5985                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5986                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5987                         }
5988                 } else {
5989                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5990                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5991                         }
5992                 }
5993         }
5994 }
5995 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
5996         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
5997                 let contents = if o.result_ok {
5998                         let result = unsafe { o.contents.result };
5999                         unsafe { o.contents.result = std::ptr::null_mut() };
6000                         CResult_NetAddressDecodeErrorZPtr { result }
6001                 } else {
6002                         let err = unsafe { o.contents.err };
6003                         unsafe { o.contents.err = std::ptr::null_mut(); }
6004                         CResult_NetAddressDecodeErrorZPtr { err }
6005                 };
6006                 Self {
6007                         contents,
6008                         result_ok: o.result_ok,
6009                 }
6010         }
6011 }
6012 impl Clone for CResult_NetAddressDecodeErrorZ {
6013         fn clone(&self) -> Self {
6014                 if self.result_ok {
6015                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
6016                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
6017                         } }
6018                 } else {
6019                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
6020                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6021                         } }
6022                 }
6023         }
6024 }
6025 #[no_mangle]
6026 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
6027 /// but with all dynamically-allocated buffers duplicated in new buffers.
6028 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { orig.clone() }
6029 #[repr(C)]
6030 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
6031 /// This corresponds to std::vector in C++
6032 pub struct CVec_UpdateAddHTLCZ {
6033         /// The elements in the array.
6034         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6035         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
6036         /// The number of elements pointed to by `data`.
6037         pub datalen: usize
6038 }
6039 impl CVec_UpdateAddHTLCZ {
6040         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
6041                 if self.datalen == 0 { return Vec::new(); }
6042                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6043                 self.data = std::ptr::null_mut();
6044                 self.datalen = 0;
6045                 ret
6046         }
6047         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
6048                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6049         }
6050 }
6051 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
6052         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
6053                 let datalen = v.len();
6054                 let data = Box::into_raw(v.into_boxed_slice());
6055                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6056         }
6057 }
6058 #[no_mangle]
6059 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6060 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
6061 impl Drop for CVec_UpdateAddHTLCZ {
6062         fn drop(&mut self) {
6063                 if self.datalen == 0 { return; }
6064                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6065         }
6066 }
6067 impl Clone for CVec_UpdateAddHTLCZ {
6068         fn clone(&self) -> Self {
6069                 let mut res = Vec::new();
6070                 if self.datalen == 0 { return Self::from(res); }
6071                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6072                 Self::from(res)
6073         }
6074 }
6075 #[repr(C)]
6076 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6077 /// This corresponds to std::vector in C++
6078 pub struct CVec_UpdateFulfillHTLCZ {
6079         /// The elements in the array.
6080         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6081         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
6082         /// The number of elements pointed to by `data`.
6083         pub datalen: usize
6084 }
6085 impl CVec_UpdateFulfillHTLCZ {
6086         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
6087                 if self.datalen == 0 { return Vec::new(); }
6088                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6089                 self.data = std::ptr::null_mut();
6090                 self.datalen = 0;
6091                 ret
6092         }
6093         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
6094                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6095         }
6096 }
6097 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
6098         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
6099                 let datalen = v.len();
6100                 let data = Box::into_raw(v.into_boxed_slice());
6101                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6102         }
6103 }
6104 #[no_mangle]
6105 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6106 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
6107 impl Drop for CVec_UpdateFulfillHTLCZ {
6108         fn drop(&mut self) {
6109                 if self.datalen == 0 { return; }
6110                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6111         }
6112 }
6113 impl Clone for CVec_UpdateFulfillHTLCZ {
6114         fn clone(&self) -> Self {
6115                 let mut res = Vec::new();
6116                 if self.datalen == 0 { return Self::from(res); }
6117                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6118                 Self::from(res)
6119         }
6120 }
6121 #[repr(C)]
6122 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
6123 /// This corresponds to std::vector in C++
6124 pub struct CVec_UpdateFailHTLCZ {
6125         /// The elements in the array.
6126         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6127         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
6128         /// The number of elements pointed to by `data`.
6129         pub datalen: usize
6130 }
6131 impl CVec_UpdateFailHTLCZ {
6132         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
6133                 if self.datalen == 0 { return Vec::new(); }
6134                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6135                 self.data = std::ptr::null_mut();
6136                 self.datalen = 0;
6137                 ret
6138         }
6139         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
6140                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6141         }
6142 }
6143 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
6144         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
6145                 let datalen = v.len();
6146                 let data = Box::into_raw(v.into_boxed_slice());
6147                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6148         }
6149 }
6150 #[no_mangle]
6151 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6152 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
6153 impl Drop for CVec_UpdateFailHTLCZ {
6154         fn drop(&mut self) {
6155                 if self.datalen == 0 { return; }
6156                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6157         }
6158 }
6159 impl Clone for CVec_UpdateFailHTLCZ {
6160         fn clone(&self) -> Self {
6161                 let mut res = Vec::new();
6162                 if self.datalen == 0 { return Self::from(res); }
6163                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6164                 Self::from(res)
6165         }
6166 }
6167 #[repr(C)]
6168 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6169 /// This corresponds to std::vector in C++
6170 pub struct CVec_UpdateFailMalformedHTLCZ {
6171         /// The elements in the array.
6172         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6173         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
6174         /// The number of elements pointed to by `data`.
6175         pub datalen: usize
6176 }
6177 impl CVec_UpdateFailMalformedHTLCZ {
6178         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
6179                 if self.datalen == 0 { return Vec::new(); }
6180                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6181                 self.data = std::ptr::null_mut();
6182                 self.datalen = 0;
6183                 ret
6184         }
6185         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
6186                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6187         }
6188 }
6189 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
6190         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
6191                 let datalen = v.len();
6192                 let data = Box::into_raw(v.into_boxed_slice());
6193                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6194         }
6195 }
6196 #[no_mangle]
6197 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6198 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
6199 impl Drop for CVec_UpdateFailMalformedHTLCZ {
6200         fn drop(&mut self) {
6201                 if self.datalen == 0 { return; }
6202                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6203         }
6204 }
6205 impl Clone for CVec_UpdateFailMalformedHTLCZ {
6206         fn clone(&self) -> Self {
6207                 let mut res = Vec::new();
6208                 if self.datalen == 0 { return Self::from(res); }
6209                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6210                 Self::from(res)
6211         }
6212 }
6213 #[repr(C)]
6214 /// The contents of CResult_AcceptChannelDecodeErrorZ
6215 pub union CResult_AcceptChannelDecodeErrorZPtr {
6216         /// A pointer to the contents in the success state.
6217         /// Reading from this pointer when `result_ok` is not set is undefined.
6218         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
6219         /// A pointer to the contents in the error state.
6220         /// Reading from this pointer when `result_ok` is set is undefined.
6221         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6222 }
6223 #[repr(C)]
6224 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6225 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6227 pub struct CResult_AcceptChannelDecodeErrorZ {
6228         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6229         /// `err` or `result` depending on the state of `result_ok`.
6230         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
6231         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6232         pub result_ok: bool,
6233 }
6234 #[no_mangle]
6235 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
6236 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
6237         CResult_AcceptChannelDecodeErrorZ {
6238                 contents: CResult_AcceptChannelDecodeErrorZPtr {
6239                         result: Box::into_raw(Box::new(o)),
6240                 },
6241                 result_ok: true,
6242         }
6243 }
6244 #[no_mangle]
6245 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
6246 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
6247         CResult_AcceptChannelDecodeErrorZ {
6248                 contents: CResult_AcceptChannelDecodeErrorZPtr {
6249                         err: Box::into_raw(Box::new(e)),
6250                 },
6251                 result_ok: false,
6252         }
6253 }
6254 #[no_mangle]
6255 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
6256 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
6257 impl Drop for CResult_AcceptChannelDecodeErrorZ {
6258         fn drop(&mut self) {
6259                 if self.result_ok {
6260                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6261                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6262                         }
6263                 } else {
6264                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6265                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6266                         }
6267                 }
6268         }
6269 }
6270 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
6271         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
6272                 let contents = if o.result_ok {
6273                         let result = unsafe { o.contents.result };
6274                         unsafe { o.contents.result = std::ptr::null_mut() };
6275                         CResult_AcceptChannelDecodeErrorZPtr { result }
6276                 } else {
6277                         let err = unsafe { o.contents.err };
6278                         unsafe { o.contents.err = std::ptr::null_mut(); }
6279                         CResult_AcceptChannelDecodeErrorZPtr { err }
6280                 };
6281                 Self {
6282                         contents,
6283                         result_ok: o.result_ok,
6284                 }
6285         }
6286 }
6287 impl Clone for CResult_AcceptChannelDecodeErrorZ {
6288         fn clone(&self) -> Self {
6289                 if self.result_ok {
6290                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
6291                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
6292                         } }
6293                 } else {
6294                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
6295                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6296                         } }
6297                 }
6298         }
6299 }
6300 #[no_mangle]
6301 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
6302 /// but with all dynamically-allocated buffers duplicated in new buffers.
6303 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
6304 #[repr(C)]
6305 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6306 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
6307         /// A pointer to the contents in the success state.
6308         /// Reading from this pointer when `result_ok` is not set is undefined.
6309         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
6310         /// A pointer to the contents in the error state.
6311         /// Reading from this pointer when `result_ok` is set is undefined.
6312         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6313 }
6314 #[repr(C)]
6315 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6316 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6318 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
6319         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6320         /// `err` or `result` depending on the state of `result_ok`.
6321         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
6322         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6323         pub result_ok: bool,
6324 }
6325 #[no_mangle]
6326 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
6327 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6328         CResult_AnnouncementSignaturesDecodeErrorZ {
6329                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6330                         result: Box::into_raw(Box::new(o)),
6331                 },
6332                 result_ok: true,
6333         }
6334 }
6335 #[no_mangle]
6336 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
6337 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6338         CResult_AnnouncementSignaturesDecodeErrorZ {
6339                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6340                         err: Box::into_raw(Box::new(e)),
6341                 },
6342                 result_ok: false,
6343         }
6344 }
6345 #[no_mangle]
6346 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
6347 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
6348 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
6349         fn drop(&mut self) {
6350                 if self.result_ok {
6351                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6352                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6353                         }
6354                 } else {
6355                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6356                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6357                         }
6358                 }
6359         }
6360 }
6361 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6362         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6363                 let contents = if o.result_ok {
6364                         let result = unsafe { o.contents.result };
6365                         unsafe { o.contents.result = std::ptr::null_mut() };
6366                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6367                 } else {
6368                         let err = unsafe { o.contents.err };
6369                         unsafe { o.contents.err = std::ptr::null_mut(); }
6370                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6371                 };
6372                 Self {
6373                         contents,
6374                         result_ok: o.result_ok,
6375                 }
6376         }
6377 }
6378 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6379         fn clone(&self) -> Self {
6380                 if self.result_ok {
6381                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6382                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6383                         } }
6384                 } else {
6385                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6386                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6387                         } }
6388                 }
6389         }
6390 }
6391 #[no_mangle]
6392 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6393 /// but with all dynamically-allocated buffers duplicated in new buffers.
6394 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6395 #[repr(C)]
6396 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6397 pub union CResult_ChannelReestablishDecodeErrorZPtr {
6398         /// A pointer to the contents in the success state.
6399         /// Reading from this pointer when `result_ok` is not set is undefined.
6400         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
6401         /// A pointer to the contents in the error state.
6402         /// Reading from this pointer when `result_ok` is set is undefined.
6403         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6404 }
6405 #[repr(C)]
6406 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6407 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6408 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6409 pub struct CResult_ChannelReestablishDecodeErrorZ {
6410         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6411         /// `err` or `result` depending on the state of `result_ok`.
6412         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6413         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6414         pub result_ok: bool,
6415 }
6416 #[no_mangle]
6417 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6418 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6419         CResult_ChannelReestablishDecodeErrorZ {
6420                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6421                         result: Box::into_raw(Box::new(o)),
6422                 },
6423                 result_ok: true,
6424         }
6425 }
6426 #[no_mangle]
6427 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6428 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6429         CResult_ChannelReestablishDecodeErrorZ {
6430                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6431                         err: Box::into_raw(Box::new(e)),
6432                 },
6433                 result_ok: false,
6434         }
6435 }
6436 #[no_mangle]
6437 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
6438 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6439 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
6440         fn drop(&mut self) {
6441                 if self.result_ok {
6442                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6443                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6444                         }
6445                 } else {
6446                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6447                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6448                         }
6449                 }
6450         }
6451 }
6452 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6453         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
6454                 let contents = if o.result_ok {
6455                         let result = unsafe { o.contents.result };
6456                         unsafe { o.contents.result = std::ptr::null_mut() };
6457                         CResult_ChannelReestablishDecodeErrorZPtr { result }
6458                 } else {
6459                         let err = unsafe { o.contents.err };
6460                         unsafe { o.contents.err = std::ptr::null_mut(); }
6461                         CResult_ChannelReestablishDecodeErrorZPtr { err }
6462                 };
6463                 Self {
6464                         contents,
6465                         result_ok: o.result_ok,
6466                 }
6467         }
6468 }
6469 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6470         fn clone(&self) -> Self {
6471                 if self.result_ok {
6472                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6473                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6474                         } }
6475                 } else {
6476                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6477                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6478                         } }
6479                 }
6480         }
6481 }
6482 #[no_mangle]
6483 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6484 /// but with all dynamically-allocated buffers duplicated in new buffers.
6485 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6486 #[repr(C)]
6487 /// The contents of CResult_ClosingSignedDecodeErrorZ
6488 pub union CResult_ClosingSignedDecodeErrorZPtr {
6489         /// A pointer to the contents in the success state.
6490         /// Reading from this pointer when `result_ok` is not set is undefined.
6491         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
6492         /// A pointer to the contents in the error state.
6493         /// Reading from this pointer when `result_ok` is set is undefined.
6494         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6495 }
6496 #[repr(C)]
6497 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6498 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6500 pub struct CResult_ClosingSignedDecodeErrorZ {
6501         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6502         /// `err` or `result` depending on the state of `result_ok`.
6503         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6504         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6505         pub result_ok: bool,
6506 }
6507 #[no_mangle]
6508 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6509 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6510         CResult_ClosingSignedDecodeErrorZ {
6511                 contents: CResult_ClosingSignedDecodeErrorZPtr {
6512                         result: Box::into_raw(Box::new(o)),
6513                 },
6514                 result_ok: true,
6515         }
6516 }
6517 #[no_mangle]
6518 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6519 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6520         CResult_ClosingSignedDecodeErrorZ {
6521                 contents: CResult_ClosingSignedDecodeErrorZPtr {
6522                         err: Box::into_raw(Box::new(e)),
6523                 },
6524                 result_ok: false,
6525         }
6526 }
6527 #[no_mangle]
6528 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
6529 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6530 impl Drop for CResult_ClosingSignedDecodeErrorZ {
6531         fn drop(&mut self) {
6532                 if self.result_ok {
6533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6535                         }
6536                 } else {
6537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6539                         }
6540                 }
6541         }
6542 }
6543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6545                 let contents = if o.result_ok {
6546                         let result = unsafe { o.contents.result };
6547                         unsafe { o.contents.result = std::ptr::null_mut() };
6548                         CResult_ClosingSignedDecodeErrorZPtr { result }
6549                 } else {
6550                         let err = unsafe { o.contents.err };
6551                         unsafe { o.contents.err = std::ptr::null_mut(); }
6552                         CResult_ClosingSignedDecodeErrorZPtr { err }
6553                 };
6554                 Self {
6555                         contents,
6556                         result_ok: o.result_ok,
6557                 }
6558         }
6559 }
6560 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6561         fn clone(&self) -> Self {
6562                 if self.result_ok {
6563                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6564                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6565                         } }
6566                 } else {
6567                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
6568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6569                         } }
6570                 }
6571         }
6572 }
6573 #[no_mangle]
6574 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
6575 /// but with all dynamically-allocated buffers duplicated in new buffers.
6576 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6577 #[repr(C)]
6578 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6579 pub union CResult_CommitmentSignedDecodeErrorZPtr {
6580         /// A pointer to the contents in the success state.
6581         /// Reading from this pointer when `result_ok` is not set is undefined.
6582         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
6583         /// A pointer to the contents in the error state.
6584         /// Reading from this pointer when `result_ok` is set is undefined.
6585         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6586 }
6587 #[repr(C)]
6588 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6589 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6591 pub struct CResult_CommitmentSignedDecodeErrorZ {
6592         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6593         /// `err` or `result` depending on the state of `result_ok`.
6594         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6595         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6596         pub result_ok: bool,
6597 }
6598 #[no_mangle]
6599 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6600 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6601         CResult_CommitmentSignedDecodeErrorZ {
6602                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6603                         result: Box::into_raw(Box::new(o)),
6604                 },
6605                 result_ok: true,
6606         }
6607 }
6608 #[no_mangle]
6609 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6610 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6611         CResult_CommitmentSignedDecodeErrorZ {
6612                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6613                         err: Box::into_raw(Box::new(e)),
6614                 },
6615                 result_ok: false,
6616         }
6617 }
6618 #[no_mangle]
6619 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
6620 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6621 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
6622         fn drop(&mut self) {
6623                 if self.result_ok {
6624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6626                         }
6627                 } else {
6628                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6629                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6630                         }
6631                 }
6632         }
6633 }
6634 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6635         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6636                 let contents = if o.result_ok {
6637                         let result = unsafe { o.contents.result };
6638                         unsafe { o.contents.result = std::ptr::null_mut() };
6639                         CResult_CommitmentSignedDecodeErrorZPtr { result }
6640                 } else {
6641                         let err = unsafe { o.contents.err };
6642                         unsafe { o.contents.err = std::ptr::null_mut(); }
6643                         CResult_CommitmentSignedDecodeErrorZPtr { err }
6644                 };
6645                 Self {
6646                         contents,
6647                         result_ok: o.result_ok,
6648                 }
6649         }
6650 }
6651 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6652         fn clone(&self) -> Self {
6653                 if self.result_ok {
6654                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6655                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6656                         } }
6657                 } else {
6658                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6659                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6660                         } }
6661                 }
6662         }
6663 }
6664 #[no_mangle]
6665 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6666 /// but with all dynamically-allocated buffers duplicated in new buffers.
6667 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6668 #[repr(C)]
6669 /// The contents of CResult_FundingCreatedDecodeErrorZ
6670 pub union CResult_FundingCreatedDecodeErrorZPtr {
6671         /// A pointer to the contents in the success state.
6672         /// Reading from this pointer when `result_ok` is not set is undefined.
6673         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
6674         /// A pointer to the contents in the error state.
6675         /// Reading from this pointer when `result_ok` is set is undefined.
6676         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6677 }
6678 #[repr(C)]
6679 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6680 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
6681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6682 pub struct CResult_FundingCreatedDecodeErrorZ {
6683         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6684         /// `err` or `result` depending on the state of `result_ok`.
6685         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6686         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6687         pub result_ok: bool,
6688 }
6689 #[no_mangle]
6690 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6691 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6692         CResult_FundingCreatedDecodeErrorZ {
6693                 contents: CResult_FundingCreatedDecodeErrorZPtr {
6694                         result: Box::into_raw(Box::new(o)),
6695                 },
6696                 result_ok: true,
6697         }
6698 }
6699 #[no_mangle]
6700 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6701 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6702         CResult_FundingCreatedDecodeErrorZ {
6703                 contents: CResult_FundingCreatedDecodeErrorZPtr {
6704                         err: Box::into_raw(Box::new(e)),
6705                 },
6706                 result_ok: false,
6707         }
6708 }
6709 #[no_mangle]
6710 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
6711 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6712 impl Drop for CResult_FundingCreatedDecodeErrorZ {
6713         fn drop(&mut self) {
6714                 if self.result_ok {
6715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6717                         }
6718                 } else {
6719                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6720                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6721                         }
6722                 }
6723         }
6724 }
6725 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6726         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
6727                 let contents = if o.result_ok {
6728                         let result = unsafe { o.contents.result };
6729                         unsafe { o.contents.result = std::ptr::null_mut() };
6730                         CResult_FundingCreatedDecodeErrorZPtr { result }
6731                 } else {
6732                         let err = unsafe { o.contents.err };
6733                         unsafe { o.contents.err = std::ptr::null_mut(); }
6734                         CResult_FundingCreatedDecodeErrorZPtr { err }
6735                 };
6736                 Self {
6737                         contents,
6738                         result_ok: o.result_ok,
6739                 }
6740         }
6741 }
6742 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6743         fn clone(&self) -> Self {
6744                 if self.result_ok {
6745                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6746                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6747                         } }
6748                 } else {
6749                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
6750                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6751                         } }
6752                 }
6753         }
6754 }
6755 #[no_mangle]
6756 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
6757 /// but with all dynamically-allocated buffers duplicated in new buffers.
6758 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6759 #[repr(C)]
6760 /// The contents of CResult_FundingSignedDecodeErrorZ
6761 pub union CResult_FundingSignedDecodeErrorZPtr {
6762         /// A pointer to the contents in the success state.
6763         /// Reading from this pointer when `result_ok` is not set is undefined.
6764         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
6765         /// A pointer to the contents in the error state.
6766         /// Reading from this pointer when `result_ok` is set is undefined.
6767         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6768 }
6769 #[repr(C)]
6770 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6771 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6773 pub struct CResult_FundingSignedDecodeErrorZ {
6774         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6775         /// `err` or `result` depending on the state of `result_ok`.
6776         pub contents: CResult_FundingSignedDecodeErrorZPtr,
6777         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6778         pub result_ok: bool,
6779 }
6780 #[no_mangle]
6781 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6782 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6783         CResult_FundingSignedDecodeErrorZ {
6784                 contents: CResult_FundingSignedDecodeErrorZPtr {
6785                         result: Box::into_raw(Box::new(o)),
6786                 },
6787                 result_ok: true,
6788         }
6789 }
6790 #[no_mangle]
6791 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6792 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6793         CResult_FundingSignedDecodeErrorZ {
6794                 contents: CResult_FundingSignedDecodeErrorZPtr {
6795                         err: Box::into_raw(Box::new(e)),
6796                 },
6797                 result_ok: false,
6798         }
6799 }
6800 #[no_mangle]
6801 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
6802 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6803 impl Drop for CResult_FundingSignedDecodeErrorZ {
6804         fn drop(&mut self) {
6805                 if self.result_ok {
6806                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6807                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6808                         }
6809                 } else {
6810                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6811                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6812                         }
6813                 }
6814         }
6815 }
6816 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6817         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6818                 let contents = if o.result_ok {
6819                         let result = unsafe { o.contents.result };
6820                         unsafe { o.contents.result = std::ptr::null_mut() };
6821                         CResult_FundingSignedDecodeErrorZPtr { result }
6822                 } else {
6823                         let err = unsafe { o.contents.err };
6824                         unsafe { o.contents.err = std::ptr::null_mut(); }
6825                         CResult_FundingSignedDecodeErrorZPtr { err }
6826                 };
6827                 Self {
6828                         contents,
6829                         result_ok: o.result_ok,
6830                 }
6831         }
6832 }
6833 impl Clone for CResult_FundingSignedDecodeErrorZ {
6834         fn clone(&self) -> Self {
6835                 if self.result_ok {
6836                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6837                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6838                         } }
6839                 } else {
6840                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
6841                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6842                         } }
6843                 }
6844         }
6845 }
6846 #[no_mangle]
6847 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
6848 /// but with all dynamically-allocated buffers duplicated in new buffers.
6849 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6850 #[repr(C)]
6851 /// The contents of CResult_FundingLockedDecodeErrorZ
6852 pub union CResult_FundingLockedDecodeErrorZPtr {
6853         /// A pointer to the contents in the success state.
6854         /// Reading from this pointer when `result_ok` is not set is undefined.
6855         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
6856         /// A pointer to the contents in the error state.
6857         /// Reading from this pointer when `result_ok` is set is undefined.
6858         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6859 }
6860 #[repr(C)]
6861 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6862 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
6863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6864 pub struct CResult_FundingLockedDecodeErrorZ {
6865         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6866         /// `err` or `result` depending on the state of `result_ok`.
6867         pub contents: CResult_FundingLockedDecodeErrorZPtr,
6868         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6869         pub result_ok: bool,
6870 }
6871 #[no_mangle]
6872 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6873 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6874         CResult_FundingLockedDecodeErrorZ {
6875                 contents: CResult_FundingLockedDecodeErrorZPtr {
6876                         result: Box::into_raw(Box::new(o)),
6877                 },
6878                 result_ok: true,
6879         }
6880 }
6881 #[no_mangle]
6882 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6883 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6884         CResult_FundingLockedDecodeErrorZ {
6885                 contents: CResult_FundingLockedDecodeErrorZPtr {
6886                         err: Box::into_raw(Box::new(e)),
6887                 },
6888                 result_ok: false,
6889         }
6890 }
6891 #[no_mangle]
6892 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
6893 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6894 impl Drop for CResult_FundingLockedDecodeErrorZ {
6895         fn drop(&mut self) {
6896                 if self.result_ok {
6897                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6898                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6899                         }
6900                 } else {
6901                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6902                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6903                         }
6904                 }
6905         }
6906 }
6907 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6908         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
6909                 let contents = if o.result_ok {
6910                         let result = unsafe { o.contents.result };
6911                         unsafe { o.contents.result = std::ptr::null_mut() };
6912                         CResult_FundingLockedDecodeErrorZPtr { result }
6913                 } else {
6914                         let err = unsafe { o.contents.err };
6915                         unsafe { o.contents.err = std::ptr::null_mut(); }
6916                         CResult_FundingLockedDecodeErrorZPtr { err }
6917                 };
6918                 Self {
6919                         contents,
6920                         result_ok: o.result_ok,
6921                 }
6922         }
6923 }
6924 impl Clone for CResult_FundingLockedDecodeErrorZ {
6925         fn clone(&self) -> Self {
6926                 if self.result_ok {
6927                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6928                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6929                         } }
6930                 } else {
6931                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
6932                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6933                         } }
6934                 }
6935         }
6936 }
6937 #[no_mangle]
6938 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
6939 /// but with all dynamically-allocated buffers duplicated in new buffers.
6940 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6941 #[repr(C)]
6942 /// The contents of CResult_InitDecodeErrorZ
6943 pub union CResult_InitDecodeErrorZPtr {
6944         /// A pointer to the contents in the success state.
6945         /// Reading from this pointer when `result_ok` is not set is undefined.
6946         pub result: *mut crate::lightning::ln::msgs::Init,
6947         /// A pointer to the contents in the error state.
6948         /// Reading from this pointer when `result_ok` is set is undefined.
6949         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6950 }
6951 #[repr(C)]
6952 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6953 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
6954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6955 pub struct CResult_InitDecodeErrorZ {
6956         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6957         /// `err` or `result` depending on the state of `result_ok`.
6958         pub contents: CResult_InitDecodeErrorZPtr,
6959         /// Whether this CResult_InitDecodeErrorZ represents a success state.
6960         pub result_ok: bool,
6961 }
6962 #[no_mangle]
6963 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6964 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6965         CResult_InitDecodeErrorZ {
6966                 contents: CResult_InitDecodeErrorZPtr {
6967                         result: Box::into_raw(Box::new(o)),
6968                 },
6969                 result_ok: true,
6970         }
6971 }
6972 #[no_mangle]
6973 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6974 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6975         CResult_InitDecodeErrorZ {
6976                 contents: CResult_InitDecodeErrorZPtr {
6977                         err: Box::into_raw(Box::new(e)),
6978                 },
6979                 result_ok: false,
6980         }
6981 }
6982 #[no_mangle]
6983 /// Frees any resources used by the CResult_InitDecodeErrorZ.
6984 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6985 impl Drop for CResult_InitDecodeErrorZ {
6986         fn drop(&mut self) {
6987                 if self.result_ok {
6988                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6989                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6990                         }
6991                 } else {
6992                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6993                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6994                         }
6995                 }
6996         }
6997 }
6998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6999         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
7000                 let contents = if o.result_ok {
7001                         let result = unsafe { o.contents.result };
7002                         unsafe { o.contents.result = std::ptr::null_mut() };
7003                         CResult_InitDecodeErrorZPtr { result }
7004                 } else {
7005                         let err = unsafe { o.contents.err };
7006                         unsafe { o.contents.err = std::ptr::null_mut(); }
7007                         CResult_InitDecodeErrorZPtr { err }
7008                 };
7009                 Self {
7010                         contents,
7011                         result_ok: o.result_ok,
7012                 }
7013         }
7014 }
7015 impl Clone for CResult_InitDecodeErrorZ {
7016         fn clone(&self) -> Self {
7017                 if self.result_ok {
7018                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
7019                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
7020                         } }
7021                 } else {
7022                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
7023                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7024                         } }
7025                 }
7026         }
7027 }
7028 #[no_mangle]
7029 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
7030 /// but with all dynamically-allocated buffers duplicated in new buffers.
7031 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
7032 #[repr(C)]
7033 /// The contents of CResult_OpenChannelDecodeErrorZ
7034 pub union CResult_OpenChannelDecodeErrorZPtr {
7035         /// A pointer to the contents in the success state.
7036         /// Reading from this pointer when `result_ok` is not set is undefined.
7037         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
7038         /// A pointer to the contents in the error state.
7039         /// Reading from this pointer when `result_ok` is set is undefined.
7040         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7041 }
7042 #[repr(C)]
7043 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
7044 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7046 pub struct CResult_OpenChannelDecodeErrorZ {
7047         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
7048         /// `err` or `result` depending on the state of `result_ok`.
7049         pub contents: CResult_OpenChannelDecodeErrorZPtr,
7050         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
7051         pub result_ok: bool,
7052 }
7053 #[no_mangle]
7054 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
7055 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
7056         CResult_OpenChannelDecodeErrorZ {
7057                 contents: CResult_OpenChannelDecodeErrorZPtr {
7058                         result: Box::into_raw(Box::new(o)),
7059                 },
7060                 result_ok: true,
7061         }
7062 }
7063 #[no_mangle]
7064 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
7065 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
7066         CResult_OpenChannelDecodeErrorZ {
7067                 contents: CResult_OpenChannelDecodeErrorZPtr {
7068                         err: Box::into_raw(Box::new(e)),
7069                 },
7070                 result_ok: false,
7071         }
7072 }
7073 #[no_mangle]
7074 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
7075 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
7076 impl Drop for CResult_OpenChannelDecodeErrorZ {
7077         fn drop(&mut self) {
7078                 if self.result_ok {
7079                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7080                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7081                         }
7082                 } else {
7083                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7084                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7085                         }
7086                 }
7087         }
7088 }
7089 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
7090         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
7091                 let contents = if o.result_ok {
7092                         let result = unsafe { o.contents.result };
7093                         unsafe { o.contents.result = std::ptr::null_mut() };
7094                         CResult_OpenChannelDecodeErrorZPtr { result }
7095                 } else {
7096                         let err = unsafe { o.contents.err };
7097                         unsafe { o.contents.err = std::ptr::null_mut(); }
7098                         CResult_OpenChannelDecodeErrorZPtr { err }
7099                 };
7100                 Self {
7101                         contents,
7102                         result_ok: o.result_ok,
7103                 }
7104         }
7105 }
7106 impl Clone for CResult_OpenChannelDecodeErrorZ {
7107         fn clone(&self) -> Self {
7108                 if self.result_ok {
7109                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
7110                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
7111                         } }
7112                 } else {
7113                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
7114                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7115                         } }
7116                 }
7117         }
7118 }
7119 #[no_mangle]
7120 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
7121 /// but with all dynamically-allocated buffers duplicated in new buffers.
7122 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
7123 #[repr(C)]
7124 /// The contents of CResult_RevokeAndACKDecodeErrorZ
7125 pub union CResult_RevokeAndACKDecodeErrorZPtr {
7126         /// A pointer to the contents in the success state.
7127         /// Reading from this pointer when `result_ok` is not set is undefined.
7128         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
7129         /// A pointer to the contents in the error state.
7130         /// Reading from this pointer when `result_ok` is set is undefined.
7131         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7132 }
7133 #[repr(C)]
7134 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
7135 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
7136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7137 pub struct CResult_RevokeAndACKDecodeErrorZ {
7138         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
7139         /// `err` or `result` depending on the state of `result_ok`.
7140         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
7141         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
7142         pub result_ok: bool,
7143 }
7144 #[no_mangle]
7145 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
7146 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
7147         CResult_RevokeAndACKDecodeErrorZ {
7148                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7149                         result: Box::into_raw(Box::new(o)),
7150                 },
7151                 result_ok: true,
7152         }
7153 }
7154 #[no_mangle]
7155 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
7156 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
7157         CResult_RevokeAndACKDecodeErrorZ {
7158                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7159                         err: Box::into_raw(Box::new(e)),
7160                 },
7161                 result_ok: false,
7162         }
7163 }
7164 #[no_mangle]
7165 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
7166 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
7167 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
7168         fn drop(&mut self) {
7169                 if self.result_ok {
7170                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7171                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7172                         }
7173                 } else {
7174                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7175                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7176                         }
7177                 }
7178         }
7179 }
7180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
7181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
7182                 let contents = if o.result_ok {
7183                         let result = unsafe { o.contents.result };
7184                         unsafe { o.contents.result = std::ptr::null_mut() };
7185                         CResult_RevokeAndACKDecodeErrorZPtr { result }
7186                 } else {
7187                         let err = unsafe { o.contents.err };
7188                         unsafe { o.contents.err = std::ptr::null_mut(); }
7189                         CResult_RevokeAndACKDecodeErrorZPtr { err }
7190                 };
7191                 Self {
7192                         contents,
7193                         result_ok: o.result_ok,
7194                 }
7195         }
7196 }
7197 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
7198         fn clone(&self) -> Self {
7199                 if self.result_ok {
7200                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7201                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
7202                         } }
7203                 } else {
7204                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7205                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7206                         } }
7207                 }
7208         }
7209 }
7210 #[no_mangle]
7211 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
7212 /// but with all dynamically-allocated buffers duplicated in new buffers.
7213 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
7214 #[repr(C)]
7215 /// The contents of CResult_ShutdownDecodeErrorZ
7216 pub union CResult_ShutdownDecodeErrorZPtr {
7217         /// A pointer to the contents in the success state.
7218         /// Reading from this pointer when `result_ok` is not set is undefined.
7219         pub result: *mut crate::lightning::ln::msgs::Shutdown,
7220         /// A pointer to the contents in the error state.
7221         /// Reading from this pointer when `result_ok` is set is undefined.
7222         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7223 }
7224 #[repr(C)]
7225 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7226 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
7227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7228 pub struct CResult_ShutdownDecodeErrorZ {
7229         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7230         /// `err` or `result` depending on the state of `result_ok`.
7231         pub contents: CResult_ShutdownDecodeErrorZPtr,
7232         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7233         pub result_ok: bool,
7234 }
7235 #[no_mangle]
7236 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
7237 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
7238         CResult_ShutdownDecodeErrorZ {
7239                 contents: CResult_ShutdownDecodeErrorZPtr {
7240                         result: Box::into_raw(Box::new(o)),
7241                 },
7242                 result_ok: true,
7243         }
7244 }
7245 #[no_mangle]
7246 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
7247 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
7248         CResult_ShutdownDecodeErrorZ {
7249                 contents: CResult_ShutdownDecodeErrorZPtr {
7250                         err: Box::into_raw(Box::new(e)),
7251                 },
7252                 result_ok: false,
7253         }
7254 }
7255 #[no_mangle]
7256 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
7257 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
7258 impl Drop for CResult_ShutdownDecodeErrorZ {
7259         fn drop(&mut self) {
7260                 if self.result_ok {
7261                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7262                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7263                         }
7264                 } else {
7265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7267                         }
7268                 }
7269         }
7270 }
7271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
7272         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
7273                 let contents = if o.result_ok {
7274                         let result = unsafe { o.contents.result };
7275                         unsafe { o.contents.result = std::ptr::null_mut() };
7276                         CResult_ShutdownDecodeErrorZPtr { result }
7277                 } else {
7278                         let err = unsafe { o.contents.err };
7279                         unsafe { o.contents.err = std::ptr::null_mut(); }
7280                         CResult_ShutdownDecodeErrorZPtr { err }
7281                 };
7282                 Self {
7283                         contents,
7284                         result_ok: o.result_ok,
7285                 }
7286         }
7287 }
7288 impl Clone for CResult_ShutdownDecodeErrorZ {
7289         fn clone(&self) -> Self {
7290                 if self.result_ok {
7291                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
7292                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
7293                         } }
7294                 } else {
7295                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
7296                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7297                         } }
7298                 }
7299         }
7300 }
7301 #[no_mangle]
7302 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
7303 /// but with all dynamically-allocated buffers duplicated in new buffers.
7304 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
7305 #[repr(C)]
7306 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
7307 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
7308         /// A pointer to the contents in the success state.
7309         /// Reading from this pointer when `result_ok` is not set is undefined.
7310         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
7311         /// A pointer to the contents in the error state.
7312         /// Reading from this pointer when `result_ok` is set is undefined.
7313         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7314 }
7315 #[repr(C)]
7316 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7317 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7319 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
7320         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7321         /// `err` or `result` depending on the state of `result_ok`.
7322         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
7323         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7324         pub result_ok: bool,
7325 }
7326 #[no_mangle]
7327 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
7328 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
7329         CResult_UpdateFailHTLCDecodeErrorZ {
7330                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7331                         result: Box::into_raw(Box::new(o)),
7332                 },
7333                 result_ok: true,
7334         }
7335 }
7336 #[no_mangle]
7337 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
7338 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
7339         CResult_UpdateFailHTLCDecodeErrorZ {
7340                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7341                         err: Box::into_raw(Box::new(e)),
7342                 },
7343                 result_ok: false,
7344         }
7345 }
7346 #[no_mangle]
7347 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
7348 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
7349 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
7350         fn drop(&mut self) {
7351                 if self.result_ok {
7352                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7353                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7354                         }
7355                 } else {
7356                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7357                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7358                         }
7359                 }
7360         }
7361 }
7362 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7363         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7364                 let contents = if o.result_ok {
7365                         let result = unsafe { o.contents.result };
7366                         unsafe { o.contents.result = std::ptr::null_mut() };
7367                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
7368                 } else {
7369                         let err = unsafe { o.contents.err };
7370                         unsafe { o.contents.err = std::ptr::null_mut(); }
7371                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7372                 };
7373                 Self {
7374                         contents,
7375                         result_ok: o.result_ok,
7376                 }
7377         }
7378 }
7379 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7380         fn clone(&self) -> Self {
7381                 if self.result_ok {
7382                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7383                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7384                         } }
7385                 } else {
7386                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7387                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7388                         } }
7389                 }
7390         }
7391 }
7392 #[no_mangle]
7393 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7394 /// but with all dynamically-allocated buffers duplicated in new buffers.
7395 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7396 #[repr(C)]
7397 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7398 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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::ln::msgs::UpdateFailMalformedHTLC,
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::lightning::ln::msgs::DecodeError,
7405 }
7406 #[repr(C)]
7407 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7408 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7410 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7411         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7412         /// `err` or `result` depending on the state of `result_ok`.
7413         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7414         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7415         pub result_ok: bool,
7416 }
7417 #[no_mangle]
7418 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7419 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7420         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7421                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7422                         result: Box::into_raw(Box::new(o)),
7423                 },
7424                 result_ok: true,
7425         }
7426 }
7427 #[no_mangle]
7428 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7429 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7430         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7431                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7432                         err: Box::into_raw(Box::new(e)),
7433                 },
7434                 result_ok: false,
7435         }
7436 }
7437 #[no_mangle]
7438 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
7439 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7440 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7441         fn drop(&mut self) {
7442                 if self.result_ok {
7443                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7444                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7445                         }
7446                 } else {
7447                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7448                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7449                         }
7450                 }
7451         }
7452 }
7453 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7454         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7455                 let contents = if o.result_ok {
7456                         let result = unsafe { o.contents.result };
7457                         unsafe { o.contents.result = std::ptr::null_mut() };
7458                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7459                 } else {
7460                         let err = unsafe { o.contents.err };
7461                         unsafe { o.contents.err = std::ptr::null_mut(); }
7462                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7463                 };
7464                 Self {
7465                         contents,
7466                         result_ok: o.result_ok,
7467                 }
7468         }
7469 }
7470 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7471         fn clone(&self) -> Self {
7472                 if self.result_ok {
7473                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7474                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7475                         } }
7476                 } else {
7477                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7478                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7479                         } }
7480                 }
7481         }
7482 }
7483 #[no_mangle]
7484 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7485 /// but with all dynamically-allocated buffers duplicated in new buffers.
7486 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7487 #[repr(C)]
7488 /// The contents of CResult_UpdateFeeDecodeErrorZ
7489 pub union CResult_UpdateFeeDecodeErrorZPtr {
7490         /// A pointer to the contents in the success state.
7491         /// Reading from this pointer when `result_ok` is not set is undefined.
7492         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
7493         /// A pointer to the contents in the error state.
7494         /// Reading from this pointer when `result_ok` is set is undefined.
7495         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7496 }
7497 #[repr(C)]
7498 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7499 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7501 pub struct CResult_UpdateFeeDecodeErrorZ {
7502         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7503         /// `err` or `result` depending on the state of `result_ok`.
7504         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7505         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7506         pub result_ok: bool,
7507 }
7508 #[no_mangle]
7509 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7510 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7511         CResult_UpdateFeeDecodeErrorZ {
7512                 contents: CResult_UpdateFeeDecodeErrorZPtr {
7513                         result: Box::into_raw(Box::new(o)),
7514                 },
7515                 result_ok: true,
7516         }
7517 }
7518 #[no_mangle]
7519 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7520 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7521         CResult_UpdateFeeDecodeErrorZ {
7522                 contents: CResult_UpdateFeeDecodeErrorZPtr {
7523                         err: Box::into_raw(Box::new(e)),
7524                 },
7525                 result_ok: false,
7526         }
7527 }
7528 #[no_mangle]
7529 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
7530 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7531 impl Drop for CResult_UpdateFeeDecodeErrorZ {
7532         fn drop(&mut self) {
7533                 if self.result_ok {
7534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7536                         }
7537                 } else {
7538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7540                         }
7541                 }
7542         }
7543 }
7544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
7546                 let contents = if o.result_ok {
7547                         let result = unsafe { o.contents.result };
7548                         unsafe { o.contents.result = std::ptr::null_mut() };
7549                         CResult_UpdateFeeDecodeErrorZPtr { result }
7550                 } else {
7551                         let err = unsafe { o.contents.err };
7552                         unsafe { o.contents.err = std::ptr::null_mut(); }
7553                         CResult_UpdateFeeDecodeErrorZPtr { err }
7554                 };
7555                 Self {
7556                         contents,
7557                         result_ok: o.result_ok,
7558                 }
7559         }
7560 }
7561 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7562         fn clone(&self) -> Self {
7563                 if self.result_ok {
7564                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7566                         } }
7567                 } else {
7568                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
7569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7570                         } }
7571                 }
7572         }
7573 }
7574 #[no_mangle]
7575 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
7576 /// but with all dynamically-allocated buffers duplicated in new buffers.
7577 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7578 #[repr(C)]
7579 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7580 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7581         /// A pointer to the contents in the success state.
7582         /// Reading from this pointer when `result_ok` is not set is undefined.
7583         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
7584         /// A pointer to the contents in the error state.
7585         /// Reading from this pointer when `result_ok` is set is undefined.
7586         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7587 }
7588 #[repr(C)]
7589 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7590 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7592 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
7593         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7594         /// `err` or `result` depending on the state of `result_ok`.
7595         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7596         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7597         pub result_ok: bool,
7598 }
7599 #[no_mangle]
7600 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7601 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7602         CResult_UpdateFulfillHTLCDecodeErrorZ {
7603                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7604                         result: Box::into_raw(Box::new(o)),
7605                 },
7606                 result_ok: true,
7607         }
7608 }
7609 #[no_mangle]
7610 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7611 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7612         CResult_UpdateFulfillHTLCDecodeErrorZ {
7613                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7614                         err: Box::into_raw(Box::new(e)),
7615                 },
7616                 result_ok: false,
7617         }
7618 }
7619 #[no_mangle]
7620 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
7621 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7622 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
7623         fn drop(&mut self) {
7624                 if self.result_ok {
7625                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7626                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7627                         }
7628                 } else {
7629                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7630                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7631                         }
7632                 }
7633         }
7634 }
7635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7636         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7637                 let contents = if o.result_ok {
7638                         let result = unsafe { o.contents.result };
7639                         unsafe { o.contents.result = std::ptr::null_mut() };
7640                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
7641                 } else {
7642                         let err = unsafe { o.contents.err };
7643                         unsafe { o.contents.err = std::ptr::null_mut(); }
7644                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7645                 };
7646                 Self {
7647                         contents,
7648                         result_ok: o.result_ok,
7649                 }
7650         }
7651 }
7652 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7653         fn clone(&self) -> Self {
7654                 if self.result_ok {
7655                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7656                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7657                         } }
7658                 } else {
7659                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7660                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7661                         } }
7662                 }
7663         }
7664 }
7665 #[no_mangle]
7666 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7667 /// but with all dynamically-allocated buffers duplicated in new buffers.
7668 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7669 #[repr(C)]
7670 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7671 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
7672         /// A pointer to the contents in the success state.
7673         /// Reading from this pointer when `result_ok` is not set is undefined.
7674         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7675         /// A pointer to the contents in the error state.
7676         /// Reading from this pointer when `result_ok` is set is undefined.
7677         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7678 }
7679 #[repr(C)]
7680 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7681 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7683 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
7684         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7685         /// `err` or `result` depending on the state of `result_ok`.
7686         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7687         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7688         pub result_ok: bool,
7689 }
7690 #[no_mangle]
7691 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7692 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7693         CResult_UpdateAddHTLCDecodeErrorZ {
7694                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7695                         result: Box::into_raw(Box::new(o)),
7696                 },
7697                 result_ok: true,
7698         }
7699 }
7700 #[no_mangle]
7701 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7702 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7703         CResult_UpdateAddHTLCDecodeErrorZ {
7704                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7705                         err: Box::into_raw(Box::new(e)),
7706                 },
7707                 result_ok: false,
7708         }
7709 }
7710 #[no_mangle]
7711 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
7712 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7713 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
7714         fn drop(&mut self) {
7715                 if self.result_ok {
7716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7718                         }
7719                 } else {
7720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7722                         }
7723                 }
7724         }
7725 }
7726 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7728                 let contents = if o.result_ok {
7729                         let result = unsafe { o.contents.result };
7730                         unsafe { o.contents.result = std::ptr::null_mut() };
7731                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
7732                 } else {
7733                         let err = unsafe { o.contents.err };
7734                         unsafe { o.contents.err = std::ptr::null_mut(); }
7735                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7736                 };
7737                 Self {
7738                         contents,
7739                         result_ok: o.result_ok,
7740                 }
7741         }
7742 }
7743 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7744         fn clone(&self) -> Self {
7745                 if self.result_ok {
7746                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7747                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7748                         } }
7749                 } else {
7750                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7751                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7752                         } }
7753                 }
7754         }
7755 }
7756 #[no_mangle]
7757 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7758 /// but with all dynamically-allocated buffers duplicated in new buffers.
7759 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7760 #[repr(C)]
7761 /// The contents of CResult_PingDecodeErrorZ
7762 pub union CResult_PingDecodeErrorZPtr {
7763         /// A pointer to the contents in the success state.
7764         /// Reading from this pointer when `result_ok` is not set is undefined.
7765         pub result: *mut crate::lightning::ln::msgs::Ping,
7766         /// A pointer to the contents in the error state.
7767         /// Reading from this pointer when `result_ok` is set is undefined.
7768         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7769 }
7770 #[repr(C)]
7771 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7772 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7774 pub struct CResult_PingDecodeErrorZ {
7775         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7776         /// `err` or `result` depending on the state of `result_ok`.
7777         pub contents: CResult_PingDecodeErrorZPtr,
7778         /// Whether this CResult_PingDecodeErrorZ represents a success state.
7779         pub result_ok: bool,
7780 }
7781 #[no_mangle]
7782 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7783 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7784         CResult_PingDecodeErrorZ {
7785                 contents: CResult_PingDecodeErrorZPtr {
7786                         result: Box::into_raw(Box::new(o)),
7787                 },
7788                 result_ok: true,
7789         }
7790 }
7791 #[no_mangle]
7792 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7793 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7794         CResult_PingDecodeErrorZ {
7795                 contents: CResult_PingDecodeErrorZPtr {
7796                         err: Box::into_raw(Box::new(e)),
7797                 },
7798                 result_ok: false,
7799         }
7800 }
7801 #[no_mangle]
7802 /// Frees any resources used by the CResult_PingDecodeErrorZ.
7803 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7804 impl Drop for CResult_PingDecodeErrorZ {
7805         fn drop(&mut self) {
7806                 if self.result_ok {
7807                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7808                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7809                         }
7810                 } else {
7811                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7812                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7813                         }
7814                 }
7815         }
7816 }
7817 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7818         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
7819                 let contents = if o.result_ok {
7820                         let result = unsafe { o.contents.result };
7821                         unsafe { o.contents.result = std::ptr::null_mut() };
7822                         CResult_PingDecodeErrorZPtr { result }
7823                 } else {
7824                         let err = unsafe { o.contents.err };
7825                         unsafe { o.contents.err = std::ptr::null_mut(); }
7826                         CResult_PingDecodeErrorZPtr { err }
7827                 };
7828                 Self {
7829                         contents,
7830                         result_ok: o.result_ok,
7831                 }
7832         }
7833 }
7834 impl Clone for CResult_PingDecodeErrorZ {
7835         fn clone(&self) -> Self {
7836                 if self.result_ok {
7837                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7838                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7839                         } }
7840                 } else {
7841                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
7842                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7843                         } }
7844                 }
7845         }
7846 }
7847 #[no_mangle]
7848 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
7849 /// but with all dynamically-allocated buffers duplicated in new buffers.
7850 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7851 #[repr(C)]
7852 /// The contents of CResult_PongDecodeErrorZ
7853 pub union CResult_PongDecodeErrorZPtr {
7854         /// A pointer to the contents in the success state.
7855         /// Reading from this pointer when `result_ok` is not set is undefined.
7856         pub result: *mut crate::lightning::ln::msgs::Pong,
7857         /// A pointer to the contents in the error state.
7858         /// Reading from this pointer when `result_ok` is set is undefined.
7859         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7860 }
7861 #[repr(C)]
7862 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7863 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7865 pub struct CResult_PongDecodeErrorZ {
7866         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7867         /// `err` or `result` depending on the state of `result_ok`.
7868         pub contents: CResult_PongDecodeErrorZPtr,
7869         /// Whether this CResult_PongDecodeErrorZ represents a success state.
7870         pub result_ok: bool,
7871 }
7872 #[no_mangle]
7873 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7874 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7875         CResult_PongDecodeErrorZ {
7876                 contents: CResult_PongDecodeErrorZPtr {
7877                         result: Box::into_raw(Box::new(o)),
7878                 },
7879                 result_ok: true,
7880         }
7881 }
7882 #[no_mangle]
7883 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7884 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7885         CResult_PongDecodeErrorZ {
7886                 contents: CResult_PongDecodeErrorZPtr {
7887                         err: Box::into_raw(Box::new(e)),
7888                 },
7889                 result_ok: false,
7890         }
7891 }
7892 #[no_mangle]
7893 /// Frees any resources used by the CResult_PongDecodeErrorZ.
7894 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7895 impl Drop for CResult_PongDecodeErrorZ {
7896         fn drop(&mut self) {
7897                 if self.result_ok {
7898                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7899                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7900                         }
7901                 } else {
7902                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7903                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7904                         }
7905                 }
7906         }
7907 }
7908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7909         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
7910                 let contents = if o.result_ok {
7911                         let result = unsafe { o.contents.result };
7912                         unsafe { o.contents.result = std::ptr::null_mut() };
7913                         CResult_PongDecodeErrorZPtr { result }
7914                 } else {
7915                         let err = unsafe { o.contents.err };
7916                         unsafe { o.contents.err = std::ptr::null_mut(); }
7917                         CResult_PongDecodeErrorZPtr { err }
7918                 };
7919                 Self {
7920                         contents,
7921                         result_ok: o.result_ok,
7922                 }
7923         }
7924 }
7925 impl Clone for CResult_PongDecodeErrorZ {
7926         fn clone(&self) -> Self {
7927                 if self.result_ok {
7928                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7929                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7930                         } }
7931                 } else {
7932                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
7933                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7934                         } }
7935                 }
7936         }
7937 }
7938 #[no_mangle]
7939 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
7940 /// but with all dynamically-allocated buffers duplicated in new buffers.
7941 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7942 #[repr(C)]
7943 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7944 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7945         /// A pointer to the contents in the success state.
7946         /// Reading from this pointer when `result_ok` is not set is undefined.
7947         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
7948         /// A pointer to the contents in the error state.
7949         /// Reading from this pointer when `result_ok` is set is undefined.
7950         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7951 }
7952 #[repr(C)]
7953 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7954 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7956 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7957         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7958         /// `err` or `result` depending on the state of `result_ok`.
7959         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7960         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7961         pub result_ok: bool,
7962 }
7963 #[no_mangle]
7964 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7965 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7966         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7967                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7968                         result: Box::into_raw(Box::new(o)),
7969                 },
7970                 result_ok: true,
7971         }
7972 }
7973 #[no_mangle]
7974 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7975 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7976         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7977                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7978                         err: Box::into_raw(Box::new(e)),
7979                 },
7980                 result_ok: false,
7981         }
7982 }
7983 #[no_mangle]
7984 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
7985 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7986 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7987         fn drop(&mut self) {
7988                 if self.result_ok {
7989                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7990                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7991                         }
7992                 } else {
7993                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7994                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7995                         }
7996                 }
7997         }
7998 }
7999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
8000         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8001                 let contents = if o.result_ok {
8002                         let result = unsafe { o.contents.result };
8003                         unsafe { o.contents.result = std::ptr::null_mut() };
8004                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
8005                 } else {
8006                         let err = unsafe { o.contents.err };
8007                         unsafe { o.contents.err = std::ptr::null_mut(); }
8008                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
8009                 };
8010                 Self {
8011                         contents,
8012                         result_ok: o.result_ok,
8013                 }
8014         }
8015 }
8016 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
8017         fn clone(&self) -> Self {
8018                 if self.result_ok {
8019                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8020                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
8021                         } }
8022                 } else {
8023                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8024                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8025                         } }
8026                 }
8027         }
8028 }
8029 #[no_mangle]
8030 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8031 /// but with all dynamically-allocated buffers duplicated in new buffers.
8032 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
8033 #[repr(C)]
8034 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
8035 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
8036         /// A pointer to the contents in the success state.
8037         /// Reading from this pointer when `result_ok` is not set is undefined.
8038         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
8039         /// A pointer to the contents in the error state.
8040         /// Reading from this pointer when `result_ok` is set is undefined.
8041         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8042 }
8043 #[repr(C)]
8044 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8045 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8047 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
8048         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
8049         /// `err` or `result` depending on the state of `result_ok`.
8050         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
8051         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
8052         pub result_ok: bool,
8053 }
8054 #[no_mangle]
8055 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
8056 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
8057         CResult_ChannelAnnouncementDecodeErrorZ {
8058                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8059                         result: Box::into_raw(Box::new(o)),
8060                 },
8061                 result_ok: true,
8062         }
8063 }
8064 #[no_mangle]
8065 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
8066 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
8067         CResult_ChannelAnnouncementDecodeErrorZ {
8068                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8069                         err: Box::into_raw(Box::new(e)),
8070                 },
8071                 result_ok: false,
8072         }
8073 }
8074 #[no_mangle]
8075 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
8076 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
8077 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
8078         fn drop(&mut self) {
8079                 if self.result_ok {
8080                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8081                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8082                         }
8083                 } else {
8084                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8085                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8086                         }
8087                 }
8088         }
8089 }
8090 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
8091         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8092                 let contents = if o.result_ok {
8093                         let result = unsafe { o.contents.result };
8094                         unsafe { o.contents.result = std::ptr::null_mut() };
8095                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
8096                 } else {
8097                         let err = unsafe { o.contents.err };
8098                         unsafe { o.contents.err = std::ptr::null_mut(); }
8099                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
8100                 };
8101                 Self {
8102                         contents,
8103                         result_ok: o.result_ok,
8104                 }
8105         }
8106 }
8107 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
8108         fn clone(&self) -> Self {
8109                 if self.result_ok {
8110                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8111                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
8112                         } }
8113                 } else {
8114                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8115                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8116                         } }
8117                 }
8118         }
8119 }
8120 #[no_mangle]
8121 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8122 /// but with all dynamically-allocated buffers duplicated in new buffers.
8123 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
8124 #[repr(C)]
8125 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8126 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8127         /// A pointer to the contents in the success state.
8128         /// Reading from this pointer when `result_ok` is not set is undefined.
8129         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
8130         /// A pointer to the contents in the error state.
8131         /// Reading from this pointer when `result_ok` is set is undefined.
8132         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8133 }
8134 #[repr(C)]
8135 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8136 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8138 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
8139         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8140         /// `err` or `result` depending on the state of `result_ok`.
8141         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
8142         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8143         pub result_ok: bool,
8144 }
8145 #[no_mangle]
8146 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
8147 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8148         CResult_UnsignedChannelUpdateDecodeErrorZ {
8149                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8150                         result: Box::into_raw(Box::new(o)),
8151                 },
8152                 result_ok: true,
8153         }
8154 }
8155 #[no_mangle]
8156 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
8157 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8158         CResult_UnsignedChannelUpdateDecodeErrorZ {
8159                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8160                         err: Box::into_raw(Box::new(e)),
8161                 },
8162                 result_ok: false,
8163         }
8164 }
8165 #[no_mangle]
8166 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
8167 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
8168 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
8169         fn drop(&mut self) {
8170                 if self.result_ok {
8171                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8172                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8173                         }
8174                 } else {
8175                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8176                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8177                         }
8178                 }
8179         }
8180 }
8181 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
8182         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8183                 let contents = if o.result_ok {
8184                         let result = unsafe { o.contents.result };
8185                         unsafe { o.contents.result = std::ptr::null_mut() };
8186                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
8187                 } else {
8188                         let err = unsafe { o.contents.err };
8189                         unsafe { o.contents.err = std::ptr::null_mut(); }
8190                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
8191                 };
8192                 Self {
8193                         contents,
8194                         result_ok: o.result_ok,
8195                 }
8196         }
8197 }
8198 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
8199         fn clone(&self) -> Self {
8200                 if self.result_ok {
8201                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8202                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
8203                         } }
8204                 } else {
8205                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8206                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8207                         } }
8208                 }
8209         }
8210 }
8211 #[no_mangle]
8212 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
8213 /// but with all dynamically-allocated buffers duplicated in new buffers.
8214 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
8215 #[repr(C)]
8216 /// The contents of CResult_ChannelUpdateDecodeErrorZ
8217 pub union CResult_ChannelUpdateDecodeErrorZPtr {
8218         /// A pointer to the contents in the success state.
8219         /// Reading from this pointer when `result_ok` is not set is undefined.
8220         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
8221         /// A pointer to the contents in the error state.
8222         /// Reading from this pointer when `result_ok` is set is undefined.
8223         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8224 }
8225 #[repr(C)]
8226 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8227 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8229 pub struct CResult_ChannelUpdateDecodeErrorZ {
8230         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8231         /// `err` or `result` depending on the state of `result_ok`.
8232         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
8233         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8234         pub result_ok: bool,
8235 }
8236 #[no_mangle]
8237 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
8238 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
8239         CResult_ChannelUpdateDecodeErrorZ {
8240                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8241                         result: Box::into_raw(Box::new(o)),
8242                 },
8243                 result_ok: true,
8244         }
8245 }
8246 #[no_mangle]
8247 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
8248 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
8249         CResult_ChannelUpdateDecodeErrorZ {
8250                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8251                         err: Box::into_raw(Box::new(e)),
8252                 },
8253                 result_ok: false,
8254         }
8255 }
8256 #[no_mangle]
8257 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
8258 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
8259 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
8260         fn drop(&mut self) {
8261                 if self.result_ok {
8262                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8263                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8264                         }
8265                 } else {
8266                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8267                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8268                         }
8269                 }
8270         }
8271 }
8272 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
8273         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8274                 let contents = if o.result_ok {
8275                         let result = unsafe { o.contents.result };
8276                         unsafe { o.contents.result = std::ptr::null_mut() };
8277                         CResult_ChannelUpdateDecodeErrorZPtr { result }
8278                 } else {
8279                         let err = unsafe { o.contents.err };
8280                         unsafe { o.contents.err = std::ptr::null_mut(); }
8281                         CResult_ChannelUpdateDecodeErrorZPtr { err }
8282                 };
8283                 Self {
8284                         contents,
8285                         result_ok: o.result_ok,
8286                 }
8287         }
8288 }
8289 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
8290         fn clone(&self) -> Self {
8291                 if self.result_ok {
8292                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8293                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
8294                         } }
8295                 } else {
8296                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8297                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8298                         } }
8299                 }
8300         }
8301 }
8302 #[no_mangle]
8303 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
8304 /// but with all dynamically-allocated buffers duplicated in new buffers.
8305 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
8306 #[repr(C)]
8307 /// The contents of CResult_ErrorMessageDecodeErrorZ
8308 pub union CResult_ErrorMessageDecodeErrorZPtr {
8309         /// A pointer to the contents in the success state.
8310         /// Reading from this pointer when `result_ok` is not set is undefined.
8311         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
8312         /// A pointer to the contents in the error state.
8313         /// Reading from this pointer when `result_ok` is set is undefined.
8314         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8315 }
8316 #[repr(C)]
8317 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8318 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
8319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8320 pub struct CResult_ErrorMessageDecodeErrorZ {
8321         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8322         /// `err` or `result` depending on the state of `result_ok`.
8323         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
8324         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8325         pub result_ok: bool,
8326 }
8327 #[no_mangle]
8328 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
8329 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
8330         CResult_ErrorMessageDecodeErrorZ {
8331                 contents: CResult_ErrorMessageDecodeErrorZPtr {
8332                         result: Box::into_raw(Box::new(o)),
8333                 },
8334                 result_ok: true,
8335         }
8336 }
8337 #[no_mangle]
8338 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
8339 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
8340         CResult_ErrorMessageDecodeErrorZ {
8341                 contents: CResult_ErrorMessageDecodeErrorZPtr {
8342                         err: Box::into_raw(Box::new(e)),
8343                 },
8344                 result_ok: false,
8345         }
8346 }
8347 #[no_mangle]
8348 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
8349 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
8350 impl Drop for CResult_ErrorMessageDecodeErrorZ {
8351         fn drop(&mut self) {
8352                 if self.result_ok {
8353                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8354                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8355                         }
8356                 } else {
8357                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8358                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8359                         }
8360                 }
8361         }
8362 }
8363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8364         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
8365                 let contents = if o.result_ok {
8366                         let result = unsafe { o.contents.result };
8367                         unsafe { o.contents.result = std::ptr::null_mut() };
8368                         CResult_ErrorMessageDecodeErrorZPtr { result }
8369                 } else {
8370                         let err = unsafe { o.contents.err };
8371                         unsafe { o.contents.err = std::ptr::null_mut(); }
8372                         CResult_ErrorMessageDecodeErrorZPtr { err }
8373                 };
8374                 Self {
8375                         contents,
8376                         result_ok: o.result_ok,
8377                 }
8378         }
8379 }
8380 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8381         fn clone(&self) -> Self {
8382                 if self.result_ok {
8383                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8384                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8385                         } }
8386                 } else {
8387                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
8388                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8389                         } }
8390                 }
8391         }
8392 }
8393 #[no_mangle]
8394 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
8395 /// but with all dynamically-allocated buffers duplicated in new buffers.
8396 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8397 #[repr(C)]
8398 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8399 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8400         /// A pointer to the contents in the success state.
8401         /// Reading from this pointer when `result_ok` is not set is undefined.
8402         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
8403         /// A pointer to the contents in the error state.
8404         /// Reading from this pointer when `result_ok` is set is undefined.
8405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8406 }
8407 #[repr(C)]
8408 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8409 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8411 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8412         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8413         /// `err` or `result` depending on the state of `result_ok`.
8414         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8415         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8416         pub result_ok: bool,
8417 }
8418 #[no_mangle]
8419 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8420 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8421         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8422                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8423                         result: Box::into_raw(Box::new(o)),
8424                 },
8425                 result_ok: true,
8426         }
8427 }
8428 #[no_mangle]
8429 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8430 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8431         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8432                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8433                         err: Box::into_raw(Box::new(e)),
8434                 },
8435                 result_ok: false,
8436         }
8437 }
8438 #[no_mangle]
8439 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
8440 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8441 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8442         fn drop(&mut self) {
8443                 if self.result_ok {
8444                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8445                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8446                         }
8447                 } else {
8448                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8449                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8450                         }
8451                 }
8452         }
8453 }
8454 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8455         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8456                 let contents = if o.result_ok {
8457                         let result = unsafe { o.contents.result };
8458                         unsafe { o.contents.result = std::ptr::null_mut() };
8459                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8460                 } else {
8461                         let err = unsafe { o.contents.err };
8462                         unsafe { o.contents.err = std::ptr::null_mut(); }
8463                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8464                 };
8465                 Self {
8466                         contents,
8467                         result_ok: o.result_ok,
8468                 }
8469         }
8470 }
8471 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8472         fn clone(&self) -> Self {
8473                 if self.result_ok {
8474                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8475                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8476                         } }
8477                 } else {
8478                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8479                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8480                         } }
8481                 }
8482         }
8483 }
8484 #[no_mangle]
8485 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8486 /// but with all dynamically-allocated buffers duplicated in new buffers.
8487 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8488 #[repr(C)]
8489 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8490 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
8491         /// A pointer to the contents in the success state.
8492         /// Reading from this pointer when `result_ok` is not set is undefined.
8493         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8494         /// A pointer to the contents in the error state.
8495         /// Reading from this pointer when `result_ok` is set is undefined.
8496         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8497 }
8498 #[repr(C)]
8499 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8500 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8501 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8502 pub struct CResult_NodeAnnouncementDecodeErrorZ {
8503         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8504         /// `err` or `result` depending on the state of `result_ok`.
8505         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8506         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8507         pub result_ok: bool,
8508 }
8509 #[no_mangle]
8510 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8511 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8512         CResult_NodeAnnouncementDecodeErrorZ {
8513                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8514                         result: Box::into_raw(Box::new(o)),
8515                 },
8516                 result_ok: true,
8517         }
8518 }
8519 #[no_mangle]
8520 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8521 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8522         CResult_NodeAnnouncementDecodeErrorZ {
8523                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8524                         err: Box::into_raw(Box::new(e)),
8525                 },
8526                 result_ok: false,
8527         }
8528 }
8529 #[no_mangle]
8530 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
8531 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8532 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
8533         fn drop(&mut self) {
8534                 if self.result_ok {
8535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8537                         }
8538                 } else {
8539                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8540                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8541                         }
8542                 }
8543         }
8544 }
8545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8546         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8547                 let contents = if o.result_ok {
8548                         let result = unsafe { o.contents.result };
8549                         unsafe { o.contents.result = std::ptr::null_mut() };
8550                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
8551                 } else {
8552                         let err = unsafe { o.contents.err };
8553                         unsafe { o.contents.err = std::ptr::null_mut(); }
8554                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
8555                 };
8556                 Self {
8557                         contents,
8558                         result_ok: o.result_ok,
8559                 }
8560         }
8561 }
8562 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8563         fn clone(&self) -> Self {
8564                 if self.result_ok {
8565                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8566                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8567                         } }
8568                 } else {
8569                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8570                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8571                         } }
8572                 }
8573         }
8574 }
8575 #[no_mangle]
8576 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8577 /// but with all dynamically-allocated buffers duplicated in new buffers.
8578 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8579 #[repr(C)]
8580 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8581 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
8582         /// A pointer to the contents in the success state.
8583         /// Reading from this pointer when `result_ok` is not set is undefined.
8584         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
8585         /// A pointer to the contents in the error state.
8586         /// Reading from this pointer when `result_ok` is set is undefined.
8587         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8588 }
8589 #[repr(C)]
8590 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8591 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
8592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8593 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
8594         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8595         /// `err` or `result` depending on the state of `result_ok`.
8596         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8597         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8598         pub result_ok: bool,
8599 }
8600 #[no_mangle]
8601 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8602 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8603         CResult_QueryShortChannelIdsDecodeErrorZ {
8604                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8605                         result: Box::into_raw(Box::new(o)),
8606                 },
8607                 result_ok: true,
8608         }
8609 }
8610 #[no_mangle]
8611 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8612 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8613         CResult_QueryShortChannelIdsDecodeErrorZ {
8614                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8615                         err: Box::into_raw(Box::new(e)),
8616                 },
8617                 result_ok: false,
8618         }
8619 }
8620 #[no_mangle]
8621 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
8622 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8623 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
8624         fn drop(&mut self) {
8625                 if self.result_ok {
8626                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8627                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8628                         }
8629                 } else {
8630                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8631                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8632                         }
8633                 }
8634         }
8635 }
8636 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8637         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
8638                 let contents = if o.result_ok {
8639                         let result = unsafe { o.contents.result };
8640                         unsafe { o.contents.result = std::ptr::null_mut() };
8641                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
8642                 } else {
8643                         let err = unsafe { o.contents.err };
8644                         unsafe { o.contents.err = std::ptr::null_mut(); }
8645                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8646                 };
8647                 Self {
8648                         contents,
8649                         result_ok: o.result_ok,
8650                 }
8651         }
8652 }
8653 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8654         fn clone(&self) -> Self {
8655                 if self.result_ok {
8656                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8657                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8658                         } }
8659                 } else {
8660                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8661                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8662                         } }
8663                 }
8664         }
8665 }
8666 #[no_mangle]
8667 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8668 /// but with all dynamically-allocated buffers duplicated in new buffers.
8669 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8670 #[repr(C)]
8671 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8672 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8673         /// A pointer to the contents in the success state.
8674         /// Reading from this pointer when `result_ok` is not set is undefined.
8675         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
8676         /// A pointer to the contents in the error state.
8677         /// Reading from this pointer when `result_ok` is set is undefined.
8678         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8679 }
8680 #[repr(C)]
8681 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8682 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
8683 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8684 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8685         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8686         /// `err` or `result` depending on the state of `result_ok`.
8687         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8688         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8689         pub result_ok: bool,
8690 }
8691 #[no_mangle]
8692 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8693 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8694         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8695                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8696                         result: Box::into_raw(Box::new(o)),
8697                 },
8698                 result_ok: true,
8699         }
8700 }
8701 #[no_mangle]
8702 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8703 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8704         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8705                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8706                         err: Box::into_raw(Box::new(e)),
8707                 },
8708                 result_ok: false,
8709         }
8710 }
8711 #[no_mangle]
8712 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
8713 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8714 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8715         fn drop(&mut self) {
8716                 if self.result_ok {
8717                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8718                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8719                         }
8720                 } else {
8721                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8722                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8723                         }
8724                 }
8725         }
8726 }
8727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8728         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
8729                 let contents = if o.result_ok {
8730                         let result = unsafe { o.contents.result };
8731                         unsafe { o.contents.result = std::ptr::null_mut() };
8732                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8733                 } else {
8734                         let err = unsafe { o.contents.err };
8735                         unsafe { o.contents.err = std::ptr::null_mut(); }
8736                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8737                 };
8738                 Self {
8739                         contents,
8740                         result_ok: o.result_ok,
8741                 }
8742         }
8743 }
8744 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8745         fn clone(&self) -> Self {
8746                 if self.result_ok {
8747                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8748                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8749                         } }
8750                 } else {
8751                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8752                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8753                         } }
8754                 }
8755         }
8756 }
8757 #[no_mangle]
8758 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8759 /// but with all dynamically-allocated buffers duplicated in new buffers.
8760 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8761 #[repr(C)]
8762 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8763 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
8764         /// A pointer to the contents in the success state.
8765         /// Reading from this pointer when `result_ok` is not set is undefined.
8766         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
8767         /// A pointer to the contents in the error state.
8768         /// Reading from this pointer when `result_ok` is set is undefined.
8769         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8770 }
8771 #[repr(C)]
8772 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8773 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8775 pub struct CResult_QueryChannelRangeDecodeErrorZ {
8776         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8777         /// `err` or `result` depending on the state of `result_ok`.
8778         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8779         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8780         pub result_ok: bool,
8781 }
8782 #[no_mangle]
8783 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8784 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8785         CResult_QueryChannelRangeDecodeErrorZ {
8786                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8787                         result: Box::into_raw(Box::new(o)),
8788                 },
8789                 result_ok: true,
8790         }
8791 }
8792 #[no_mangle]
8793 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8794 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8795         CResult_QueryChannelRangeDecodeErrorZ {
8796                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8797                         err: Box::into_raw(Box::new(e)),
8798                 },
8799                 result_ok: false,
8800         }
8801 }
8802 #[no_mangle]
8803 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
8804 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8805 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
8806         fn drop(&mut self) {
8807                 if self.result_ok {
8808                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8809                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8810                         }
8811                 } else {
8812                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8813                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8814                         }
8815                 }
8816         }
8817 }
8818 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8819         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8820                 let contents = if o.result_ok {
8821                         let result = unsafe { o.contents.result };
8822                         unsafe { o.contents.result = std::ptr::null_mut() };
8823                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
8824                 } else {
8825                         let err = unsafe { o.contents.err };
8826                         unsafe { o.contents.err = std::ptr::null_mut(); }
8827                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
8828                 };
8829                 Self {
8830                         contents,
8831                         result_ok: o.result_ok,
8832                 }
8833         }
8834 }
8835 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8836         fn clone(&self) -> Self {
8837                 if self.result_ok {
8838                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8839                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8840                         } }
8841                 } else {
8842                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8843                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8844                         } }
8845                 }
8846         }
8847 }
8848 #[no_mangle]
8849 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8850 /// but with all dynamically-allocated buffers duplicated in new buffers.
8851 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8852 #[repr(C)]
8853 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8854 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
8855         /// A pointer to the contents in the success state.
8856         /// Reading from this pointer when `result_ok` is not set is undefined.
8857         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
8858         /// A pointer to the contents in the error state.
8859         /// Reading from this pointer when `result_ok` is set is undefined.
8860         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8861 }
8862 #[repr(C)]
8863 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8864 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8865 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8866 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
8867         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8868         /// `err` or `result` depending on the state of `result_ok`.
8869         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8870         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8871         pub result_ok: bool,
8872 }
8873 #[no_mangle]
8874 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8875 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8876         CResult_ReplyChannelRangeDecodeErrorZ {
8877                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8878                         result: Box::into_raw(Box::new(o)),
8879                 },
8880                 result_ok: true,
8881         }
8882 }
8883 #[no_mangle]
8884 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8885 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8886         CResult_ReplyChannelRangeDecodeErrorZ {
8887                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8888                         err: Box::into_raw(Box::new(e)),
8889                 },
8890                 result_ok: false,
8891         }
8892 }
8893 #[no_mangle]
8894 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
8895 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8896 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
8897         fn drop(&mut self) {
8898                 if self.result_ok {
8899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8901                         }
8902                 } else {
8903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8905                         }
8906                 }
8907         }
8908 }
8909 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8910         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8911                 let contents = if o.result_ok {
8912                         let result = unsafe { o.contents.result };
8913                         unsafe { o.contents.result = std::ptr::null_mut() };
8914                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
8915                 } else {
8916                         let err = unsafe { o.contents.err };
8917                         unsafe { o.contents.err = std::ptr::null_mut(); }
8918                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8919                 };
8920                 Self {
8921                         contents,
8922                         result_ok: o.result_ok,
8923                 }
8924         }
8925 }
8926 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8927         fn clone(&self) -> Self {
8928                 if self.result_ok {
8929                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8930                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8931                         } }
8932                 } else {
8933                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8934                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8935                         } }
8936                 }
8937         }
8938 }
8939 #[no_mangle]
8940 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8941 /// but with all dynamically-allocated buffers duplicated in new buffers.
8942 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8943 #[repr(C)]
8944 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8945 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
8946         /// A pointer to the contents in the success state.
8947         /// Reading from this pointer when `result_ok` is not set is undefined.
8948         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
8949         /// A pointer to the contents in the error state.
8950         /// Reading from this pointer when `result_ok` is set is undefined.
8951         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8952 }
8953 #[repr(C)]
8954 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8955 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
8956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8957 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
8958         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8959         /// `err` or `result` depending on the state of `result_ok`.
8960         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8961         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8962         pub result_ok: bool,
8963 }
8964 #[no_mangle]
8965 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8966 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8967         CResult_GossipTimestampFilterDecodeErrorZ {
8968                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8969                         result: Box::into_raw(Box::new(o)),
8970                 },
8971                 result_ok: true,
8972         }
8973 }
8974 #[no_mangle]
8975 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8976 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8977         CResult_GossipTimestampFilterDecodeErrorZ {
8978                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8979                         err: Box::into_raw(Box::new(e)),
8980                 },
8981                 result_ok: false,
8982         }
8983 }
8984 #[no_mangle]
8985 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
8986 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8987 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
8988         fn drop(&mut self) {
8989                 if self.result_ok {
8990                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8991                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8992                         }
8993                 } else {
8994                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8995                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8996                         }
8997                 }
8998         }
8999 }
9000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
9001         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
9002                 let contents = if o.result_ok {
9003                         let result = unsafe { o.contents.result };
9004                         unsafe { o.contents.result = std::ptr::null_mut() };
9005                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
9006                 } else {
9007                         let err = unsafe { o.contents.err };
9008                         unsafe { o.contents.err = std::ptr::null_mut(); }
9009                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
9010                 };
9011                 Self {
9012                         contents,
9013                         result_ok: o.result_ok,
9014                 }
9015         }
9016 }
9017 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
9018         fn clone(&self) -> Self {
9019                 if self.result_ok {
9020                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
9021                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
9022                         } }
9023                 } else {
9024                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
9025                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9026                         } }
9027                 }
9028         }
9029 }
9030 #[no_mangle]
9031 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
9032 /// but with all dynamically-allocated buffers duplicated in new buffers.
9033 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
9034 #[repr(C)]
9035 /// The contents of CResult_InvoiceSignOrCreationErrorZ
9036 pub union CResult_InvoiceSignOrCreationErrorZPtr {
9037         /// A pointer to the contents in the success state.
9038         /// Reading from this pointer when `result_ok` is not set is undefined.
9039         pub result: *mut crate::lightning_invoice::Invoice,
9040         /// A pointer to the contents in the error state.
9041         /// Reading from this pointer when `result_ok` is set is undefined.
9042         pub err: *mut crate::lightning_invoice::SignOrCreationError,
9043 }
9044 #[repr(C)]
9045 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
9046 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
9047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9048 pub struct CResult_InvoiceSignOrCreationErrorZ {
9049         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
9050         /// `err` or `result` depending on the state of `result_ok`.
9051         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
9052         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
9053         pub result_ok: bool,
9054 }
9055 #[no_mangle]
9056 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
9057 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
9058         CResult_InvoiceSignOrCreationErrorZ {
9059                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
9060                         result: Box::into_raw(Box::new(o)),
9061                 },
9062                 result_ok: true,
9063         }
9064 }
9065 #[no_mangle]
9066 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
9067 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
9068         CResult_InvoiceSignOrCreationErrorZ {
9069                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
9070                         err: Box::into_raw(Box::new(e)),
9071                 },
9072                 result_ok: false,
9073         }
9074 }
9075 #[no_mangle]
9076 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
9077 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
9078 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
9079         fn drop(&mut self) {
9080                 if self.result_ok {
9081                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9082                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9083                         }
9084                 } else {
9085                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9086                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9087                         }
9088                 }
9089         }
9090 }
9091 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
9092         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
9093                 let contents = if o.result_ok {
9094                         let result = unsafe { o.contents.result };
9095                         unsafe { o.contents.result = std::ptr::null_mut() };
9096                         CResult_InvoiceSignOrCreationErrorZPtr { result }
9097                 } else {
9098                         let err = unsafe { o.contents.err };
9099                         unsafe { o.contents.err = std::ptr::null_mut(); }
9100                         CResult_InvoiceSignOrCreationErrorZPtr { err }
9101                 };
9102                 Self {
9103                         contents,
9104                         result_ok: o.result_ok,
9105                 }
9106         }
9107 }
9108 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
9109         fn clone(&self) -> Self {
9110                 if self.result_ok {
9111                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
9112                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9113                         } }
9114                 } else {
9115                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
9116                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
9117                         } }
9118                 }
9119         }
9120 }
9121 #[no_mangle]
9122 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
9123 /// but with all dynamically-allocated buffers duplicated in new buffers.
9124 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }
9125 #[repr(C)]
9126 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
9127 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9128         /// A pointer to the contents in the success state.
9129         /// Reading from this pointer when `result_ok` is not set is undefined.
9130         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
9131         /// A pointer to the contents in the error state.
9132         /// Reading from this pointer when `result_ok` is set is undefined.
9133         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9134 }
9135 #[repr(C)]
9136 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
9137 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
9138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9139 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9140         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
9141         /// `err` or `result` depending on the state of `result_ok`.
9142         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
9143         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
9144         pub result_ok: bool,
9145 }
9146 #[no_mangle]
9147 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
9148 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9149         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9150                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9151                         result: Box::into_raw(Box::new(o)),
9152                 },
9153                 result_ok: true,
9154         }
9155 }
9156 #[no_mangle]
9157 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
9158 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9159         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9160                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9161                         err: Box::into_raw(Box::new(e)),
9162                 },
9163                 result_ok: false,
9164         }
9165 }
9166 #[no_mangle]
9167 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
9168 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
9169 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9170         fn drop(&mut self) {
9171                 if self.result_ok {
9172                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9173                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9174                         }
9175                 } else {
9176                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9177                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9178                         }
9179                 }
9180         }
9181 }
9182 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9183         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
9184                 let contents = if o.result_ok {
9185                         let result = unsafe { o.contents.result };
9186                         unsafe { o.contents.result = std::ptr::null_mut() };
9187                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
9188                 } else {
9189                         let err = unsafe { o.contents.err };
9190                         unsafe { o.contents.err = std::ptr::null_mut(); }
9191                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
9192                 };
9193                 Self {
9194                         contents,
9195                         result_ok: o.result_ok,
9196                 }
9197         }
9198 }
9199 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
9200         fn clone(&self) -> Self {
9201                 if self.result_ok {
9202                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9203                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
9204                         } }
9205                 } else {
9206                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
9207                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9208                         } }
9209                 }
9210         }
9211 }
9212 #[no_mangle]
9213 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9214 /// but with all dynamically-allocated buffers duplicated in new buffers.
9215 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
9216 #[repr(C)]
9217 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
9218 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9219         /// A pointer to the contents in the success state.
9220         /// Reading from this pointer when `result_ok` is not set is undefined.
9221         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
9222         /// A pointer to the contents in the error state.
9223         /// Reading from this pointer when `result_ok` is set is undefined.
9224         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9225 }
9226 #[repr(C)]
9227 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
9228 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
9229 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9230 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9231         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
9232         /// `err` or `result` depending on the state of `result_ok`.
9233         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
9234         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
9235         pub result_ok: bool,
9236 }
9237 #[no_mangle]
9238 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
9239 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9240         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9241                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9242                         result: Box::into_raw(Box::new(o)),
9243                 },
9244                 result_ok: true,
9245         }
9246 }
9247 #[no_mangle]
9248 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
9249 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9250         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9251                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9252                         err: Box::into_raw(Box::new(e)),
9253                 },
9254                 result_ok: false,
9255         }
9256 }
9257 #[no_mangle]
9258 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
9259 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
9260 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9261         fn drop(&mut self) {
9262                 if self.result_ok {
9263                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9264                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9265                         }
9266                 } else {
9267                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9268                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9269                         }
9270                 }
9271         }
9272 }
9273 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9274         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
9275                 let contents = if o.result_ok {
9276                         let result = unsafe { o.contents.result };
9277                         unsafe { o.contents.result = std::ptr::null_mut() };
9278                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
9279                 } else {
9280                         let err = unsafe { o.contents.err };
9281                         unsafe { o.contents.err = std::ptr::null_mut(); }
9282                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
9283                 };
9284                 Self {
9285                         contents,
9286                         result_ok: o.result_ok,
9287                 }
9288         }
9289 }
9290 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
9291         fn clone(&self) -> Self {
9292                 if self.result_ok {
9293                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9294                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
9295                         } }
9296                 } else {
9297                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
9298                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9299                         } }
9300                 }
9301         }
9302 }
9303 #[no_mangle]
9304 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9305 /// but with all dynamically-allocated buffers duplicated in new buffers.
9306 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { orig.clone() }
9307 #[repr(C)]
9308 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
9309 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9310         /// A pointer to the contents in the success state.
9311         /// Reading from this pointer when `result_ok` is not set is undefined.
9312         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
9313         /// A pointer to the contents in the error state.
9314         /// Reading from this pointer when `result_ok` is set is undefined.
9315         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9316 }
9317 #[repr(C)]
9318 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
9319 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
9320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9321 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
9322         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
9323         /// `err` or `result` depending on the state of `result_ok`.
9324         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
9325         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
9326         pub result_ok: bool,
9327 }
9328 #[no_mangle]
9329 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9330 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
9331         CResult_SpendableOutputDescriptorDecodeErrorZ {
9332                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9333                         result: Box::into_raw(Box::new(o)),
9334                 },
9335                 result_ok: true,
9336         }
9337 }
9338 #[no_mangle]
9339 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9340 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
9341         CResult_SpendableOutputDescriptorDecodeErrorZ {
9342                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9343                         err: Box::into_raw(Box::new(e)),
9344                 },
9345                 result_ok: false,
9346         }
9347 }
9348 #[no_mangle]
9349 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9350 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
9351 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
9352         fn drop(&mut self) {
9353                 if self.result_ok {
9354                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9355                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9356                         }
9357                 } else {
9358                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9359                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9360                         }
9361                 }
9362         }
9363 }
9364 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
9365         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
9366                 let contents = if o.result_ok {
9367                         let result = unsafe { o.contents.result };
9368                         unsafe { o.contents.result = std::ptr::null_mut() };
9369                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
9370                 } else {
9371                         let err = unsafe { o.contents.err };
9372                         unsafe { o.contents.err = std::ptr::null_mut(); }
9373                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
9374                 };
9375                 Self {
9376                         contents,
9377                         result_ok: o.result_ok,
9378                 }
9379         }
9380 }
9381 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
9382         fn clone(&self) -> Self {
9383                 if self.result_ok {
9384                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9385                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
9386                         } }
9387                 } else {
9388                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9389                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9390                         } }
9391                 }
9392         }
9393 }
9394 #[no_mangle]
9395 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9396 /// but with all dynamically-allocated buffers duplicated in new buffers.
9397 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
9398 #[repr(C)]
9399 /// A tuple of 2 elements. See the individual fields for the types contained.
9400 pub struct C2Tuple_SignatureCVec_SignatureZZ {
9401         /// The element at position 0
9402         pub a: crate::c_types::Signature,
9403         /// The element at position 1
9404         pub b: crate::c_types::derived::CVec_SignatureZ,
9405 }
9406 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
9407         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
9408                 Self {
9409                         a: tup.0,
9410                         b: tup.1,
9411                 }
9412         }
9413 }
9414 impl C2Tuple_SignatureCVec_SignatureZZ {
9415         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
9416                 (self.a, self.b)
9417         }
9418 }
9419 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
9420         fn clone(&self) -> Self {
9421                 Self {
9422                         a: self.a.clone(),
9423                         b: self.b.clone(),
9424                 }
9425         }
9426 }
9427 #[no_mangle]
9428 /// Creates a new tuple which has the same data as `orig`
9429 /// but with all dynamically-allocated buffers duplicated in new buffers.
9430 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
9431 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9432 #[no_mangle]
9433 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
9434         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
9435 }
9436
9437 #[no_mangle]
9438 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9439 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
9440 #[repr(C)]
9441 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
9442 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9443         /// A pointer to the contents in the success state.
9444         /// Reading from this pointer when `result_ok` is not set is undefined.
9445         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
9446         /// Note that this value is always NULL, as there are no contents in the Err variant
9447         pub err: *mut std::ffi::c_void,
9448 }
9449 #[repr(C)]
9450 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
9451 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
9452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9453 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9454         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
9455         /// `err` or `result` depending on the state of `result_ok`.
9456         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
9457         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
9458         pub result_ok: bool,
9459 }
9460 #[no_mangle]
9461 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9462 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9463         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9464                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9465                         result: Box::into_raw(Box::new(o)),
9466                 },
9467                 result_ok: true,
9468         }
9469 }
9470 #[no_mangle]
9471 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9472 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9473         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9474                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9475                         err: std::ptr::null_mut(),
9476                 },
9477                 result_ok: false,
9478         }
9479 }
9480 #[no_mangle]
9481 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9482 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
9483 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9484         fn drop(&mut self) {
9485                 if self.result_ok {
9486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9488                         }
9489                 } else {
9490                 }
9491         }
9492 }
9493 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9494         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
9495                 let contents = if o.result_ok {
9496                         let result = unsafe { o.contents.result };
9497                         unsafe { o.contents.result = std::ptr::null_mut() };
9498                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
9499                 } else {
9500                         let _ = unsafe { Box::from_raw(o.contents.err) };
9501                         o.contents.err = std::ptr::null_mut();
9502                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
9503                 };
9504                 Self {
9505                         contents,
9506                         result_ok: o.result_ok,
9507                 }
9508         }
9509 }
9510 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9511         fn clone(&self) -> Self {
9512                 if self.result_ok {
9513                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9514                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
9515                         } }
9516                 } else {
9517                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9518                                 err: std::ptr::null_mut()
9519                         } }
9520                 }
9521         }
9522 }
9523 #[no_mangle]
9524 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9525 /// but with all dynamically-allocated buffers duplicated in new buffers.
9526 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
9527 #[repr(C)]
9528 /// The contents of CResult_SignatureNoneZ
9529 pub union CResult_SignatureNoneZPtr {
9530         /// A pointer to the contents in the success state.
9531         /// Reading from this pointer when `result_ok` is not set is undefined.
9532         pub result: *mut crate::c_types::Signature,
9533         /// Note that this value is always NULL, as there are no contents in the Err variant
9534         pub err: *mut std::ffi::c_void,
9535 }
9536 #[repr(C)]
9537 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
9538 /// containing a crate::c_types::Signature on success and a () on failure.
9539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9540 pub struct CResult_SignatureNoneZ {
9541         /// The contents of this CResult_SignatureNoneZ, accessible via either
9542         /// `err` or `result` depending on the state of `result_ok`.
9543         pub contents: CResult_SignatureNoneZPtr,
9544         /// Whether this CResult_SignatureNoneZ represents a success state.
9545         pub result_ok: bool,
9546 }
9547 #[no_mangle]
9548 /// Creates a new CResult_SignatureNoneZ in the success state.
9549 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
9550         CResult_SignatureNoneZ {
9551                 contents: CResult_SignatureNoneZPtr {
9552                         result: Box::into_raw(Box::new(o)),
9553                 },
9554                 result_ok: true,
9555         }
9556 }
9557 #[no_mangle]
9558 /// Creates a new CResult_SignatureNoneZ in the error state.
9559 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
9560         CResult_SignatureNoneZ {
9561                 contents: CResult_SignatureNoneZPtr {
9562                         err: std::ptr::null_mut(),
9563                 },
9564                 result_ok: false,
9565         }
9566 }
9567 #[no_mangle]
9568 /// Frees any resources used by the CResult_SignatureNoneZ.
9569 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
9570 impl Drop for CResult_SignatureNoneZ {
9571         fn drop(&mut self) {
9572                 if self.result_ok {
9573                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9574                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9575                         }
9576                 } else {
9577                 }
9578         }
9579 }
9580 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
9581         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
9582                 let contents = if o.result_ok {
9583                         let result = unsafe { o.contents.result };
9584                         unsafe { o.contents.result = std::ptr::null_mut() };
9585                         CResult_SignatureNoneZPtr { result }
9586                 } else {
9587                         let _ = unsafe { Box::from_raw(o.contents.err) };
9588                         o.contents.err = std::ptr::null_mut();
9589                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
9590                 };
9591                 Self {
9592                         contents,
9593                         result_ok: o.result_ok,
9594                 }
9595         }
9596 }
9597 impl Clone for CResult_SignatureNoneZ {
9598         fn clone(&self) -> Self {
9599                 if self.result_ok {
9600                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
9601                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
9602                         } }
9603                 } else {
9604                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
9605                                 err: std::ptr::null_mut()
9606                         } }
9607                 }
9608         }
9609 }
9610 #[no_mangle]
9611 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9612 /// but with all dynamically-allocated buffers duplicated in new buffers.
9613 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
9614 #[repr(C)]
9615 /// The contents of CResult_SignDecodeErrorZ
9616 pub union CResult_SignDecodeErrorZPtr {
9617         /// A pointer to the contents in the success state.
9618         /// Reading from this pointer when `result_ok` is not set is undefined.
9619         pub result: *mut crate::lightning::chain::keysinterface::Sign,
9620         /// A pointer to the contents in the error state.
9621         /// Reading from this pointer when `result_ok` is set is undefined.
9622         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9623 }
9624 #[repr(C)]
9625 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
9626 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
9627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9628 pub struct CResult_SignDecodeErrorZ {
9629         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
9630         /// `err` or `result` depending on the state of `result_ok`.
9631         pub contents: CResult_SignDecodeErrorZPtr,
9632         /// Whether this CResult_SignDecodeErrorZ represents a success state.
9633         pub result_ok: bool,
9634 }
9635 #[no_mangle]
9636 /// Creates a new CResult_SignDecodeErrorZ in the success state.
9637 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
9638         CResult_SignDecodeErrorZ {
9639                 contents: CResult_SignDecodeErrorZPtr {
9640                         result: Box::into_raw(Box::new(o)),
9641                 },
9642                 result_ok: true,
9643         }
9644 }
9645 #[no_mangle]
9646 /// Creates a new CResult_SignDecodeErrorZ in the error state.
9647 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
9648         CResult_SignDecodeErrorZ {
9649                 contents: CResult_SignDecodeErrorZPtr {
9650                         err: Box::into_raw(Box::new(e)),
9651                 },
9652                 result_ok: false,
9653         }
9654 }
9655 #[no_mangle]
9656 /// Frees any resources used by the CResult_SignDecodeErrorZ.
9657 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
9658 impl Drop for CResult_SignDecodeErrorZ {
9659         fn drop(&mut self) {
9660                 if self.result_ok {
9661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9663                         }
9664                 } else {
9665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9667                         }
9668                 }
9669         }
9670 }
9671 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
9672         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
9673                 let contents = if o.result_ok {
9674                         let result = unsafe { o.contents.result };
9675                         unsafe { o.contents.result = std::ptr::null_mut() };
9676                         CResult_SignDecodeErrorZPtr { result }
9677                 } else {
9678                         let err = unsafe { o.contents.err };
9679                         unsafe { o.contents.err = std::ptr::null_mut(); }
9680                         CResult_SignDecodeErrorZPtr { err }
9681                 };
9682                 Self {
9683                         contents,
9684                         result_ok: o.result_ok,
9685                 }
9686         }
9687 }
9688 impl Clone for CResult_SignDecodeErrorZ {
9689         fn clone(&self) -> Self {
9690                 if self.result_ok {
9691                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
9692                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
9693                         } }
9694                 } else {
9695                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
9696                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9697                         } }
9698                 }
9699         }
9700 }
9701 #[no_mangle]
9702 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9703 /// but with all dynamically-allocated buffers duplicated in new buffers.
9704 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
9705 #[repr(C)]
9706 /// The contents of CResult_RecoverableSignatureNoneZ
9707 pub union CResult_RecoverableSignatureNoneZPtr {
9708         /// A pointer to the contents in the success state.
9709         /// Reading from this pointer when `result_ok` is not set is undefined.
9710         pub result: *mut crate::c_types::RecoverableSignature,
9711         /// Note that this value is always NULL, as there are no contents in the Err variant
9712         pub err: *mut std::ffi::c_void,
9713 }
9714 #[repr(C)]
9715 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
9716 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
9717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9718 pub struct CResult_RecoverableSignatureNoneZ {
9719         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
9720         /// `err` or `result` depending on the state of `result_ok`.
9721         pub contents: CResult_RecoverableSignatureNoneZPtr,
9722         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
9723         pub result_ok: bool,
9724 }
9725 #[no_mangle]
9726 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
9727 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
9728         CResult_RecoverableSignatureNoneZ {
9729                 contents: CResult_RecoverableSignatureNoneZPtr {
9730                         result: Box::into_raw(Box::new(o)),
9731                 },
9732                 result_ok: true,
9733         }
9734 }
9735 #[no_mangle]
9736 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
9737 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
9738         CResult_RecoverableSignatureNoneZ {
9739                 contents: CResult_RecoverableSignatureNoneZPtr {
9740                         err: std::ptr::null_mut(),
9741                 },
9742                 result_ok: false,
9743         }
9744 }
9745 #[no_mangle]
9746 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
9747 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
9748 impl Drop for CResult_RecoverableSignatureNoneZ {
9749         fn drop(&mut self) {
9750                 if self.result_ok {
9751                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9752                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9753                         }
9754                 } else {
9755                 }
9756         }
9757 }
9758 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
9759         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
9760                 let contents = if o.result_ok {
9761                         let result = unsafe { o.contents.result };
9762                         unsafe { o.contents.result = std::ptr::null_mut() };
9763                         CResult_RecoverableSignatureNoneZPtr { result }
9764                 } else {
9765                         let _ = unsafe { Box::from_raw(o.contents.err) };
9766                         o.contents.err = std::ptr::null_mut();
9767                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
9768                 };
9769                 Self {
9770                         contents,
9771                         result_ok: o.result_ok,
9772                 }
9773         }
9774 }
9775 impl Clone for CResult_RecoverableSignatureNoneZ {
9776         fn clone(&self) -> Self {
9777                 if self.result_ok {
9778                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
9779                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
9780                         } }
9781                 } else {
9782                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
9783                                 err: std::ptr::null_mut()
9784                         } }
9785                 }
9786         }
9787 }
9788 #[no_mangle]
9789 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
9790 /// but with all dynamically-allocated buffers duplicated in new buffers.
9791 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
9792 #[repr(C)]
9793 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
9794 /// This corresponds to std::vector in C++
9795 pub struct CVec_CVec_u8ZZ {
9796         /// The elements in the array.
9797         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9798         pub data: *mut crate::c_types::derived::CVec_u8Z,
9799         /// The number of elements pointed to by `data`.
9800         pub datalen: usize
9801 }
9802 impl CVec_CVec_u8ZZ {
9803         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
9804                 if self.datalen == 0 { return Vec::new(); }
9805                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9806                 self.data = std::ptr::null_mut();
9807                 self.datalen = 0;
9808                 ret
9809         }
9810         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
9811                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9812         }
9813 }
9814 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
9815         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
9816                 let datalen = v.len();
9817                 let data = Box::into_raw(v.into_boxed_slice());
9818                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9819         }
9820 }
9821 #[no_mangle]
9822 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9823 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
9824 impl Drop for CVec_CVec_u8ZZ {
9825         fn drop(&mut self) {
9826                 if self.datalen == 0 { return; }
9827                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9828         }
9829 }
9830 impl Clone for CVec_CVec_u8ZZ {
9831         fn clone(&self) -> Self {
9832                 let mut res = Vec::new();
9833                 if self.datalen == 0 { return Self::from(res); }
9834                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9835                 Self::from(res)
9836         }
9837 }
9838 #[repr(C)]
9839 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
9840 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
9841         /// A pointer to the contents in the success state.
9842         /// Reading from this pointer when `result_ok` is not set is undefined.
9843         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
9844         /// Note that this value is always NULL, as there are no contents in the Err variant
9845         pub err: *mut std::ffi::c_void,
9846 }
9847 #[repr(C)]
9848 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
9849 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
9850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9851 pub struct CResult_CVec_CVec_u8ZZNoneZ {
9852         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
9853         /// `err` or `result` depending on the state of `result_ok`.
9854         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
9855         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
9856         pub result_ok: bool,
9857 }
9858 #[no_mangle]
9859 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9860 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
9861         CResult_CVec_CVec_u8ZZNoneZ {
9862                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9863                         result: Box::into_raw(Box::new(o)),
9864                 },
9865                 result_ok: true,
9866         }
9867 }
9868 #[no_mangle]
9869 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9870 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
9871         CResult_CVec_CVec_u8ZZNoneZ {
9872                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9873                         err: std::ptr::null_mut(),
9874                 },
9875                 result_ok: false,
9876         }
9877 }
9878 #[no_mangle]
9879 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9880 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
9881 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
9882         fn drop(&mut self) {
9883                 if self.result_ok {
9884                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9885                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9886                         }
9887                 } else {
9888                 }
9889         }
9890 }
9891 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
9892         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
9893                 let contents = if o.result_ok {
9894                         let result = unsafe { o.contents.result };
9895                         unsafe { o.contents.result = std::ptr::null_mut() };
9896                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
9897                 } else {
9898                         let _ = unsafe { Box::from_raw(o.contents.err) };
9899                         o.contents.err = std::ptr::null_mut();
9900                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
9901                 };
9902                 Self {
9903                         contents,
9904                         result_ok: o.result_ok,
9905                 }
9906         }
9907 }
9908 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
9909         fn clone(&self) -> Self {
9910                 if self.result_ok {
9911                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9912                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
9913                         } }
9914                 } else {
9915                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9916                                 err: std::ptr::null_mut()
9917                         } }
9918                 }
9919         }
9920 }
9921 #[no_mangle]
9922 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9923 /// but with all dynamically-allocated buffers duplicated in new buffers.
9924 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
9925 #[repr(C)]
9926 /// The contents of CResult_InMemorySignerDecodeErrorZ
9927 pub union CResult_InMemorySignerDecodeErrorZPtr {
9928         /// A pointer to the contents in the success state.
9929         /// Reading from this pointer when `result_ok` is not set is undefined.
9930         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
9931         /// A pointer to the contents in the error state.
9932         /// Reading from this pointer when `result_ok` is set is undefined.
9933         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9934 }
9935 #[repr(C)]
9936 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
9937 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
9938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9939 pub struct CResult_InMemorySignerDecodeErrorZ {
9940         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
9941         /// `err` or `result` depending on the state of `result_ok`.
9942         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
9943         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
9944         pub result_ok: bool,
9945 }
9946 #[no_mangle]
9947 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9948 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
9949         CResult_InMemorySignerDecodeErrorZ {
9950                 contents: CResult_InMemorySignerDecodeErrorZPtr {
9951                         result: Box::into_raw(Box::new(o)),
9952                 },
9953                 result_ok: true,
9954         }
9955 }
9956 #[no_mangle]
9957 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9958 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
9959         CResult_InMemorySignerDecodeErrorZ {
9960                 contents: CResult_InMemorySignerDecodeErrorZPtr {
9961                         err: Box::into_raw(Box::new(e)),
9962                 },
9963                 result_ok: false,
9964         }
9965 }
9966 #[no_mangle]
9967 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9968 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
9969 impl Drop for CResult_InMemorySignerDecodeErrorZ {
9970         fn drop(&mut self) {
9971                 if self.result_ok {
9972                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9973                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9974                         }
9975                 } else {
9976                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9977                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9978                         }
9979                 }
9980         }
9981 }
9982 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
9983         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
9984                 let contents = if o.result_ok {
9985                         let result = unsafe { o.contents.result };
9986                         unsafe { o.contents.result = std::ptr::null_mut() };
9987                         CResult_InMemorySignerDecodeErrorZPtr { result }
9988                 } else {
9989                         let err = unsafe { o.contents.err };
9990                         unsafe { o.contents.err = std::ptr::null_mut(); }
9991                         CResult_InMemorySignerDecodeErrorZPtr { err }
9992                 };
9993                 Self {
9994                         contents,
9995                         result_ok: o.result_ok,
9996                 }
9997         }
9998 }
9999 impl Clone for CResult_InMemorySignerDecodeErrorZ {
10000         fn clone(&self) -> Self {
10001                 if self.result_ok {
10002                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
10003                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
10004                         } }
10005                 } else {
10006                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
10007                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10008                         } }
10009                 }
10010         }
10011 }
10012 #[no_mangle]
10013 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10014 /// but with all dynamically-allocated buffers duplicated in new buffers.
10015 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
10016 #[repr(C)]
10017 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
10018 /// This corresponds to std::vector in C++
10019 pub struct CVec_TxOutZ {
10020         /// The elements in the array.
10021         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10022         pub data: *mut crate::c_types::TxOut,
10023         /// The number of elements pointed to by `data`.
10024         pub datalen: usize
10025 }
10026 impl CVec_TxOutZ {
10027         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
10028                 if self.datalen == 0 { return Vec::new(); }
10029                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10030                 self.data = std::ptr::null_mut();
10031                 self.datalen = 0;
10032                 ret
10033         }
10034         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
10035                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10036         }
10037 }
10038 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
10039         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
10040                 let datalen = v.len();
10041                 let data = Box::into_raw(v.into_boxed_slice());
10042                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10043         }
10044 }
10045 #[no_mangle]
10046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10047 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
10048 impl Drop for CVec_TxOutZ {
10049         fn drop(&mut self) {
10050                 if self.datalen == 0 { return; }
10051                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10052         }
10053 }
10054 impl Clone for CVec_TxOutZ {
10055         fn clone(&self) -> Self {
10056                 let mut res = Vec::new();
10057                 if self.datalen == 0 { return Self::from(res); }
10058                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10059                 Self::from(res)
10060         }
10061 }
10062 #[repr(C)]
10063 /// The contents of CResult_TransactionNoneZ
10064 pub union CResult_TransactionNoneZPtr {
10065         /// A pointer to the contents in the success state.
10066         /// Reading from this pointer when `result_ok` is not set is undefined.
10067         pub result: *mut crate::c_types::Transaction,
10068         /// Note that this value is always NULL, as there are no contents in the Err variant
10069         pub err: *mut std::ffi::c_void,
10070 }
10071 #[repr(C)]
10072 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
10073 /// containing a crate::c_types::Transaction on success and a () on failure.
10074 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10075 pub struct CResult_TransactionNoneZ {
10076         /// The contents of this CResult_TransactionNoneZ, accessible via either
10077         /// `err` or `result` depending on the state of `result_ok`.
10078         pub contents: CResult_TransactionNoneZPtr,
10079         /// Whether this CResult_TransactionNoneZ represents a success state.
10080         pub result_ok: bool,
10081 }
10082 #[no_mangle]
10083 /// Creates a new CResult_TransactionNoneZ in the success state.
10084 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
10085         CResult_TransactionNoneZ {
10086                 contents: CResult_TransactionNoneZPtr {
10087                         result: Box::into_raw(Box::new(o)),
10088                 },
10089                 result_ok: true,
10090         }
10091 }
10092 #[no_mangle]
10093 /// Creates a new CResult_TransactionNoneZ in the error state.
10094 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
10095         CResult_TransactionNoneZ {
10096                 contents: CResult_TransactionNoneZPtr {
10097                         err: std::ptr::null_mut(),
10098                 },
10099                 result_ok: false,
10100         }
10101 }
10102 #[no_mangle]
10103 /// Frees any resources used by the CResult_TransactionNoneZ.
10104 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
10105 impl Drop for CResult_TransactionNoneZ {
10106         fn drop(&mut self) {
10107                 if self.result_ok {
10108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10110                         }
10111                 } else {
10112                 }
10113         }
10114 }
10115 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
10116         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
10117                 let contents = if o.result_ok {
10118                         let result = unsafe { o.contents.result };
10119                         unsafe { o.contents.result = std::ptr::null_mut() };
10120                         CResult_TransactionNoneZPtr { result }
10121                 } else {
10122                         let _ = unsafe { Box::from_raw(o.contents.err) };
10123                         o.contents.err = std::ptr::null_mut();
10124                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
10125                 };
10126                 Self {
10127                         contents,
10128                         result_ok: o.result_ok,
10129                 }
10130         }
10131 }
10132 #[repr(C)]
10133 /// The contents of CResult_NoneErrorZ
10134 pub union CResult_NoneErrorZPtr {
10135         /// Note that this value is always NULL, as there are no contents in the OK variant
10136         pub result: *mut std::ffi::c_void,
10137         /// A pointer to the contents in the error state.
10138         /// Reading from this pointer when `result_ok` is set is undefined.
10139         pub err: *mut crate::c_types::IOError,
10140 }
10141 #[repr(C)]
10142 /// A CResult_NoneErrorZ represents the result of a fallible operation,
10143 /// containing a () on success and a crate::c_types::IOError on failure.
10144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10145 pub struct CResult_NoneErrorZ {
10146         /// The contents of this CResult_NoneErrorZ, accessible via either
10147         /// `err` or `result` depending on the state of `result_ok`.
10148         pub contents: CResult_NoneErrorZPtr,
10149         /// Whether this CResult_NoneErrorZ represents a success state.
10150         pub result_ok: bool,
10151 }
10152 #[no_mangle]
10153 /// Creates a new CResult_NoneErrorZ in the success state.
10154 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
10155         CResult_NoneErrorZ {
10156                 contents: CResult_NoneErrorZPtr {
10157                         result: std::ptr::null_mut(),
10158                 },
10159                 result_ok: true,
10160         }
10161 }
10162 #[no_mangle]
10163 /// Creates a new CResult_NoneErrorZ in the error state.
10164 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
10165         CResult_NoneErrorZ {
10166                 contents: CResult_NoneErrorZPtr {
10167                         err: Box::into_raw(Box::new(e)),
10168                 },
10169                 result_ok: false,
10170         }
10171 }
10172 #[no_mangle]
10173 /// Frees any resources used by the CResult_NoneErrorZ.
10174 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
10175 impl Drop for CResult_NoneErrorZ {
10176         fn drop(&mut self) {
10177                 if self.result_ok {
10178                 } else {
10179                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10180                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10181                         }
10182                 }
10183         }
10184 }
10185 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
10186         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
10187                 let contents = if o.result_ok {
10188                         let _ = unsafe { Box::from_raw(o.contents.result) };
10189                         o.contents.result = std::ptr::null_mut();
10190                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
10191                 } else {
10192                         let err = unsafe { o.contents.err };
10193                         unsafe { o.contents.err = std::ptr::null_mut(); }
10194                         CResult_NoneErrorZPtr { err }
10195                 };
10196                 Self {
10197                         contents,
10198                         result_ok: o.result_ok,
10199                 }
10200         }
10201 }
10202 #[repr(C)]
10203 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
10204 /// This corresponds to std::vector in C++
10205 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
10206         /// The elements in the array.
10207         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10208         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10209         /// The number of elements pointed to by `data`.
10210         pub datalen: usize
10211 }
10212 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
10213         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
10214                 if self.datalen == 0 { return Vec::new(); }
10215                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10216                 self.data = std::ptr::null_mut();
10217                 self.datalen = 0;
10218                 ret
10219         }
10220         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
10221                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10222         }
10223 }
10224 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
10225         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
10226                 let datalen = v.len();
10227                 let data = Box::into_raw(v.into_boxed_slice());
10228                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10229         }
10230 }
10231 #[no_mangle]
10232 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10233 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
10234 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
10235         fn drop(&mut self) {
10236                 if self.datalen == 0 { return; }
10237                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10238         }
10239 }
10240 #[repr(C)]
10241 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
10242 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
10243         /// A pointer to the contents in the success state.
10244         /// Reading from this pointer when `result_ok` is not set is undefined.
10245         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
10246         /// A pointer to the contents in the error state.
10247         /// Reading from this pointer when `result_ok` is set is undefined.
10248         pub err: *mut crate::c_types::IOError,
10249 }
10250 #[repr(C)]
10251 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
10252 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
10253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10254 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10255         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
10256         /// `err` or `result` depending on the state of `result_ok`.
10257         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
10258         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
10259         pub result_ok: bool,
10260 }
10261 #[no_mangle]
10262 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
10263 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10264         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10265                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
10266                         result: Box::into_raw(Box::new(o)),
10267                 },
10268                 result_ok: true,
10269         }
10270 }
10271 #[no_mangle]
10272 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
10273 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10274         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10275                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
10276                         err: Box::into_raw(Box::new(e)),
10277                 },
10278                 result_ok: false,
10279         }
10280 }
10281 #[no_mangle]
10282 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
10283 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
10284 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10285         fn drop(&mut self) {
10286                 if self.result_ok {
10287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10289                         }
10290                 } else {
10291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10293                         }
10294                 }
10295         }
10296 }
10297 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
10298         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
10299                 let contents = if o.result_ok {
10300                         let result = unsafe { o.contents.result };
10301                         unsafe { o.contents.result = std::ptr::null_mut() };
10302                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
10303                 } else {
10304                         let err = unsafe { o.contents.err };
10305                         unsafe { o.contents.err = std::ptr::null_mut(); }
10306                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
10307                 };
10308                 Self {
10309                         contents,
10310                         result_ok: o.result_ok,
10311                 }
10312         }
10313 }
10314 #[repr(C)]
10315 /// The contents of CResult_NoneAPIErrorZ
10316 pub union CResult_NoneAPIErrorZPtr {
10317         /// Note that this value is always NULL, as there are no contents in the OK variant
10318         pub result: *mut std::ffi::c_void,
10319         /// A pointer to the contents in the error state.
10320         /// Reading from this pointer when `result_ok` is set is undefined.
10321         pub err: *mut crate::lightning::util::errors::APIError,
10322 }
10323 #[repr(C)]
10324 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
10325 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
10326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10327 pub struct CResult_NoneAPIErrorZ {
10328         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
10329         /// `err` or `result` depending on the state of `result_ok`.
10330         pub contents: CResult_NoneAPIErrorZPtr,
10331         /// Whether this CResult_NoneAPIErrorZ represents a success state.
10332         pub result_ok: bool,
10333 }
10334 #[no_mangle]
10335 /// Creates a new CResult_NoneAPIErrorZ in the success state.
10336 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
10337         CResult_NoneAPIErrorZ {
10338                 contents: CResult_NoneAPIErrorZPtr {
10339                         result: std::ptr::null_mut(),
10340                 },
10341                 result_ok: true,
10342         }
10343 }
10344 #[no_mangle]
10345 /// Creates a new CResult_NoneAPIErrorZ in the error state.
10346 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
10347         CResult_NoneAPIErrorZ {
10348                 contents: CResult_NoneAPIErrorZPtr {
10349                         err: Box::into_raw(Box::new(e)),
10350                 },
10351                 result_ok: false,
10352         }
10353 }
10354 #[no_mangle]
10355 /// Frees any resources used by the CResult_NoneAPIErrorZ.
10356 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
10357 impl Drop for CResult_NoneAPIErrorZ {
10358         fn drop(&mut self) {
10359                 if self.result_ok {
10360                 } else {
10361                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10362                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10363                         }
10364                 }
10365         }
10366 }
10367 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
10368         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
10369                 let contents = if o.result_ok {
10370                         let _ = unsafe { Box::from_raw(o.contents.result) };
10371                         o.contents.result = std::ptr::null_mut();
10372                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
10373                 } else {
10374                         let err = unsafe { o.contents.err };
10375                         unsafe { o.contents.err = std::ptr::null_mut(); }
10376                         CResult_NoneAPIErrorZPtr { err }
10377                 };
10378                 Self {
10379                         contents,
10380                         result_ok: o.result_ok,
10381                 }
10382         }
10383 }
10384 impl Clone for CResult_NoneAPIErrorZ {
10385         fn clone(&self) -> Self {
10386                 if self.result_ok {
10387                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
10388                                 result: std::ptr::null_mut()
10389                         } }
10390                 } else {
10391                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
10392                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10393                         } }
10394                 }
10395         }
10396 }
10397 #[no_mangle]
10398 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
10399 /// but with all dynamically-allocated buffers duplicated in new buffers.
10400 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
10401 #[repr(C)]
10402 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
10403 /// This corresponds to std::vector in C++
10404 pub struct CVec_CResult_NoneAPIErrorZZ {
10405         /// The elements in the array.
10406         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10407         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
10408         /// The number of elements pointed to by `data`.
10409         pub datalen: usize
10410 }
10411 impl CVec_CResult_NoneAPIErrorZZ {
10412         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
10413                 if self.datalen == 0 { return Vec::new(); }
10414                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10415                 self.data = std::ptr::null_mut();
10416                 self.datalen = 0;
10417                 ret
10418         }
10419         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
10420                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10421         }
10422 }
10423 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
10424         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
10425                 let datalen = v.len();
10426                 let data = Box::into_raw(v.into_boxed_slice());
10427                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10428         }
10429 }
10430 #[no_mangle]
10431 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10432 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
10433 impl Drop for CVec_CResult_NoneAPIErrorZZ {
10434         fn drop(&mut self) {
10435                 if self.datalen == 0 { return; }
10436                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10437         }
10438 }
10439 impl Clone for CVec_CResult_NoneAPIErrorZZ {
10440         fn clone(&self) -> Self {
10441                 let mut res = Vec::new();
10442                 if self.datalen == 0 { return Self::from(res); }
10443                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10444                 Self::from(res)
10445         }
10446 }
10447 #[repr(C)]
10448 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
10449 /// This corresponds to std::vector in C++
10450 pub struct CVec_APIErrorZ {
10451         /// The elements in the array.
10452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10453         pub data: *mut crate::lightning::util::errors::APIError,
10454         /// The number of elements pointed to by `data`.
10455         pub datalen: usize
10456 }
10457 impl CVec_APIErrorZ {
10458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
10459                 if self.datalen == 0 { return Vec::new(); }
10460                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10461                 self.data = std::ptr::null_mut();
10462                 self.datalen = 0;
10463                 ret
10464         }
10465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
10466                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10467         }
10468 }
10469 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
10470         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
10471                 let datalen = v.len();
10472                 let data = Box::into_raw(v.into_boxed_slice());
10473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10474         }
10475 }
10476 #[no_mangle]
10477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10478 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
10479 impl Drop for CVec_APIErrorZ {
10480         fn drop(&mut self) {
10481                 if self.datalen == 0 { return; }
10482                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10483         }
10484 }
10485 impl Clone for CVec_APIErrorZ {
10486         fn clone(&self) -> Self {
10487                 let mut res = Vec::new();
10488                 if self.datalen == 0 { return Self::from(res); }
10489                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10490                 Self::from(res)
10491         }
10492 }
10493 #[repr(C)]
10494 /// The contents of CResult_NonePaymentSendFailureZ
10495 pub union CResult_NonePaymentSendFailureZPtr {
10496         /// Note that this value is always NULL, as there are no contents in the OK variant
10497         pub result: *mut std::ffi::c_void,
10498         /// A pointer to the contents in the error state.
10499         /// Reading from this pointer when `result_ok` is set is undefined.
10500         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
10501 }
10502 #[repr(C)]
10503 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
10504 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
10505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10506 pub struct CResult_NonePaymentSendFailureZ {
10507         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
10508         /// `err` or `result` depending on the state of `result_ok`.
10509         pub contents: CResult_NonePaymentSendFailureZPtr,
10510         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
10511         pub result_ok: bool,
10512 }
10513 #[no_mangle]
10514 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
10515 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
10516         CResult_NonePaymentSendFailureZ {
10517                 contents: CResult_NonePaymentSendFailureZPtr {
10518                         result: std::ptr::null_mut(),
10519                 },
10520                 result_ok: true,
10521         }
10522 }
10523 #[no_mangle]
10524 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
10525 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
10526         CResult_NonePaymentSendFailureZ {
10527                 contents: CResult_NonePaymentSendFailureZPtr {
10528                         err: Box::into_raw(Box::new(e)),
10529                 },
10530                 result_ok: false,
10531         }
10532 }
10533 #[no_mangle]
10534 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
10535 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
10536 impl Drop for CResult_NonePaymentSendFailureZ {
10537         fn drop(&mut self) {
10538                 if self.result_ok {
10539                 } else {
10540                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10541                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10542                         }
10543                 }
10544         }
10545 }
10546 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
10547         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
10548                 let contents = if o.result_ok {
10549                         let _ = unsafe { Box::from_raw(o.contents.result) };
10550                         o.contents.result = std::ptr::null_mut();
10551                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
10552                 } else {
10553                         let err = unsafe { o.contents.err };
10554                         unsafe { o.contents.err = std::ptr::null_mut(); }
10555                         CResult_NonePaymentSendFailureZPtr { err }
10556                 };
10557                 Self {
10558                         contents,
10559                         result_ok: o.result_ok,
10560                 }
10561         }
10562 }
10563 impl Clone for CResult_NonePaymentSendFailureZ {
10564         fn clone(&self) -> Self {
10565                 if self.result_ok {
10566                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
10567                                 result: std::ptr::null_mut()
10568                         } }
10569                 } else {
10570                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
10571                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10572                         } }
10573                 }
10574         }
10575 }
10576 #[no_mangle]
10577 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
10578 /// but with all dynamically-allocated buffers duplicated in new buffers.
10579 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
10580 #[repr(C)]
10581 /// A tuple of 2 elements. See the individual fields for the types contained.
10582 pub struct C2Tuple_PaymentHashPaymentSecretZ {
10583         /// The element at position 0
10584         pub a: crate::c_types::ThirtyTwoBytes,
10585         /// The element at position 1
10586         pub b: crate::c_types::ThirtyTwoBytes,
10587 }
10588 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
10589         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
10590                 Self {
10591                         a: tup.0,
10592                         b: tup.1,
10593                 }
10594         }
10595 }
10596 impl C2Tuple_PaymentHashPaymentSecretZ {
10597         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
10598                 (self.a, self.b)
10599         }
10600 }
10601 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
10602 #[no_mangle]
10603 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
10604         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
10605 }
10606
10607 #[no_mangle]
10608 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
10609 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
10610 #[repr(C)]
10611 /// The contents of CResult_PaymentSecretAPIErrorZ
10612 pub union CResult_PaymentSecretAPIErrorZPtr {
10613         /// A pointer to the contents in the success state.
10614         /// Reading from this pointer when `result_ok` is not set is undefined.
10615         pub result: *mut crate::c_types::ThirtyTwoBytes,
10616         /// A pointer to the contents in the error state.
10617         /// Reading from this pointer when `result_ok` is set is undefined.
10618         pub err: *mut crate::lightning::util::errors::APIError,
10619 }
10620 #[repr(C)]
10621 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
10622 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10624 pub struct CResult_PaymentSecretAPIErrorZ {
10625         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
10626         /// `err` or `result` depending on the state of `result_ok`.
10627         pub contents: CResult_PaymentSecretAPIErrorZPtr,
10628         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
10629         pub result_ok: bool,
10630 }
10631 #[no_mangle]
10632 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
10633 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
10634         CResult_PaymentSecretAPIErrorZ {
10635                 contents: CResult_PaymentSecretAPIErrorZPtr {
10636                         result: Box::into_raw(Box::new(o)),
10637                 },
10638                 result_ok: true,
10639         }
10640 }
10641 #[no_mangle]
10642 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
10643 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
10644         CResult_PaymentSecretAPIErrorZ {
10645                 contents: CResult_PaymentSecretAPIErrorZPtr {
10646                         err: Box::into_raw(Box::new(e)),
10647                 },
10648                 result_ok: false,
10649         }
10650 }
10651 #[no_mangle]
10652 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
10653 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
10654 impl Drop for CResult_PaymentSecretAPIErrorZ {
10655         fn drop(&mut self) {
10656                 if self.result_ok {
10657                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10658                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10659                         }
10660                 } else {
10661                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10662                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10663                         }
10664                 }
10665         }
10666 }
10667 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
10668         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10669                 let contents = if o.result_ok {
10670                         let result = unsafe { o.contents.result };
10671                         unsafe { o.contents.result = std::ptr::null_mut() };
10672                         CResult_PaymentSecretAPIErrorZPtr { result }
10673                 } else {
10674                         let err = unsafe { o.contents.err };
10675                         unsafe { o.contents.err = std::ptr::null_mut(); }
10676                         CResult_PaymentSecretAPIErrorZPtr { err }
10677                 };
10678                 Self {
10679                         contents,
10680                         result_ok: o.result_ok,
10681                 }
10682         }
10683 }
10684 #[repr(C)]
10685 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10686 /// This corresponds to std::vector in C++
10687 pub struct CVec_ChannelMonitorZ {
10688         /// The elements in the array.
10689         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10690         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10691         /// The number of elements pointed to by `data`.
10692         pub datalen: usize
10693 }
10694 impl CVec_ChannelMonitorZ {
10695         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10696                 if self.datalen == 0 { return Vec::new(); }
10697                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10698                 self.data = std::ptr::null_mut();
10699                 self.datalen = 0;
10700                 ret
10701         }
10702         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10703                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10704         }
10705 }
10706 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10707         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10708                 let datalen = v.len();
10709                 let data = Box::into_raw(v.into_boxed_slice());
10710                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10711         }
10712 }
10713 #[no_mangle]
10714 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10715 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10716 impl Drop for CVec_ChannelMonitorZ {
10717         fn drop(&mut self) {
10718                 if self.datalen == 0 { return; }
10719                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10720         }
10721 }
10722 #[repr(C)]
10723 /// A tuple of 2 elements. See the individual fields for the types contained.
10724 pub struct C2Tuple_BlockHashChannelManagerZ {
10725         /// The element at position 0
10726         pub a: crate::c_types::ThirtyTwoBytes,
10727         /// The element at position 1
10728         pub b: crate::lightning::ln::channelmanager::ChannelManager,
10729 }
10730 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10731         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10732                 Self {
10733                         a: tup.0,
10734                         b: tup.1,
10735                 }
10736         }
10737 }
10738 impl C2Tuple_BlockHashChannelManagerZ {
10739         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10740                 (self.a, self.b)
10741         }
10742 }
10743 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10744 #[no_mangle]
10745 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10746         C2Tuple_BlockHashChannelManagerZ { a, b, }
10747 }
10748
10749 #[no_mangle]
10750 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10751 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10752 #[repr(C)]
10753 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10754 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10755         /// A pointer to the contents in the success state.
10756         /// Reading from this pointer when `result_ok` is not set is undefined.
10757         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10758         /// A pointer to the contents in the error state.
10759         /// Reading from this pointer when `result_ok` is set is undefined.
10760         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10761 }
10762 #[repr(C)]
10763 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10764 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10765 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10766 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10767         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10768         /// `err` or `result` depending on the state of `result_ok`.
10769         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10770         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10771         pub result_ok: bool,
10772 }
10773 #[no_mangle]
10774 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10775 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10776         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10777                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10778                         result: Box::into_raw(Box::new(o)),
10779                 },
10780                 result_ok: true,
10781         }
10782 }
10783 #[no_mangle]
10784 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10785 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10786         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10787                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10788                         err: Box::into_raw(Box::new(e)),
10789                 },
10790                 result_ok: false,
10791         }
10792 }
10793 #[no_mangle]
10794 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10795 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10796 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10797         fn drop(&mut self) {
10798                 if self.result_ok {
10799                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10800                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10801                         }
10802                 } else {
10803                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10804                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10805                         }
10806                 }
10807         }
10808 }
10809 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10810         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10811                 let contents = if o.result_ok {
10812                         let result = unsafe { o.contents.result };
10813                         unsafe { o.contents.result = std::ptr::null_mut() };
10814                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10815                 } else {
10816                         let err = unsafe { o.contents.err };
10817                         unsafe { o.contents.err = std::ptr::null_mut(); }
10818                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10819                 };
10820                 Self {
10821                         contents,
10822                         result_ok: o.result_ok,
10823                 }
10824         }
10825 }