Merge pull request #19 from TheBlueMatt/2021-04-invoice-incl
[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 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3578 /// This corresponds to std::vector in C++
3579 pub struct CVec_RouteHopZ {
3580         /// The elements in the array.
3581         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3582         pub data: *mut crate::lightning::routing::router::RouteHop,
3583         /// The number of elements pointed to by `data`.
3584         pub datalen: usize
3585 }
3586 impl CVec_RouteHopZ {
3587         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3588                 if self.datalen == 0 { return Vec::new(); }
3589                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3590                 self.data = std::ptr::null_mut();
3591                 self.datalen = 0;
3592                 ret
3593         }
3594         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3595                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3596         }
3597 }
3598 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3599         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3600                 let datalen = v.len();
3601                 let data = Box::into_raw(v.into_boxed_slice());
3602                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3603         }
3604 }
3605 #[no_mangle]
3606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3607 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3608 impl Drop for CVec_RouteHopZ {
3609         fn drop(&mut self) {
3610                 if self.datalen == 0 { return; }
3611                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3612         }
3613 }
3614 impl Clone for CVec_RouteHopZ {
3615         fn clone(&self) -> Self {
3616                 let mut res = Vec::new();
3617                 if self.datalen == 0 { return Self::from(res); }
3618                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3619                 Self::from(res)
3620         }
3621 }
3622 #[repr(C)]
3623 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3624 /// This corresponds to std::vector in C++
3625 pub struct CVec_CVec_RouteHopZZ {
3626         /// The elements in the array.
3627         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3628         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3629         /// The number of elements pointed to by `data`.
3630         pub datalen: usize
3631 }
3632 impl CVec_CVec_RouteHopZZ {
3633         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3634                 if self.datalen == 0 { return Vec::new(); }
3635                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3636                 self.data = std::ptr::null_mut();
3637                 self.datalen = 0;
3638                 ret
3639         }
3640         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3641                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3642         }
3643 }
3644 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3645         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3646                 let datalen = v.len();
3647                 let data = Box::into_raw(v.into_boxed_slice());
3648                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3649         }
3650 }
3651 #[no_mangle]
3652 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3653 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3654 impl Drop for CVec_CVec_RouteHopZZ {
3655         fn drop(&mut self) {
3656                 if self.datalen == 0 { return; }
3657                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3658         }
3659 }
3660 impl Clone for CVec_CVec_RouteHopZZ {
3661         fn clone(&self) -> Self {
3662                 let mut res = Vec::new();
3663                 if self.datalen == 0 { return Self::from(res); }
3664                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3665                 Self::from(res)
3666         }
3667 }
3668 #[repr(C)]
3669 /// The contents of CResult_RouteDecodeErrorZ
3670 pub union CResult_RouteDecodeErrorZPtr {
3671         /// A pointer to the contents in the success state.
3672         /// Reading from this pointer when `result_ok` is not set is undefined.
3673         pub result: *mut crate::lightning::routing::router::Route,
3674         /// A pointer to the contents in the error state.
3675         /// Reading from this pointer when `result_ok` is set is undefined.
3676         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3677 }
3678 #[repr(C)]
3679 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3680 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3682 pub struct CResult_RouteDecodeErrorZ {
3683         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3684         /// `err` or `result` depending on the state of `result_ok`.
3685         pub contents: CResult_RouteDecodeErrorZPtr,
3686         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3687         pub result_ok: bool,
3688 }
3689 #[no_mangle]
3690 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3691 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3692         CResult_RouteDecodeErrorZ {
3693                 contents: CResult_RouteDecodeErrorZPtr {
3694                         result: Box::into_raw(Box::new(o)),
3695                 },
3696                 result_ok: true,
3697         }
3698 }
3699 #[no_mangle]
3700 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3701 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3702         CResult_RouteDecodeErrorZ {
3703                 contents: CResult_RouteDecodeErrorZPtr {
3704                         err: Box::into_raw(Box::new(e)),
3705                 },
3706                 result_ok: false,
3707         }
3708 }
3709 #[no_mangle]
3710 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3711 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3712 impl Drop for CResult_RouteDecodeErrorZ {
3713         fn drop(&mut self) {
3714                 if self.result_ok {
3715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3717                         }
3718                 } else {
3719                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3720                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3721                         }
3722                 }
3723         }
3724 }
3725 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3726         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3727                 let contents = if o.result_ok {
3728                         let result = unsafe { o.contents.result };
3729                         unsafe { o.contents.result = std::ptr::null_mut() };
3730                         CResult_RouteDecodeErrorZPtr { result }
3731                 } else {
3732                         let err = unsafe { o.contents.err };
3733                         unsafe { o.contents.err = std::ptr::null_mut(); }
3734                         CResult_RouteDecodeErrorZPtr { err }
3735                 };
3736                 Self {
3737                         contents,
3738                         result_ok: o.result_ok,
3739                 }
3740         }
3741 }
3742 impl Clone for CResult_RouteDecodeErrorZ {
3743         fn clone(&self) -> Self {
3744                 if self.result_ok {
3745                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3746                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3747                         } }
3748                 } else {
3749                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3750                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3751                         } }
3752                 }
3753         }
3754 }
3755 #[no_mangle]
3756 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3757 /// but with all dynamically-allocated buffers duplicated in new buffers.
3758 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3759 #[repr(C)]
3760 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3761 /// This corresponds to std::vector in C++
3762 pub struct CVec_ChannelDetailsZ {
3763         /// The elements in the array.
3764         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3765         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3766         /// The number of elements pointed to by `data`.
3767         pub datalen: usize
3768 }
3769 impl CVec_ChannelDetailsZ {
3770         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3771                 if self.datalen == 0 { return Vec::new(); }
3772                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3773                 self.data = std::ptr::null_mut();
3774                 self.datalen = 0;
3775                 ret
3776         }
3777         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3778                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3779         }
3780 }
3781 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3782         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3783                 let datalen = v.len();
3784                 let data = Box::into_raw(v.into_boxed_slice());
3785                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3786         }
3787 }
3788 #[no_mangle]
3789 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3790 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3791 impl Drop for CVec_ChannelDetailsZ {
3792         fn drop(&mut self) {
3793                 if self.datalen == 0 { return; }
3794                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3795         }
3796 }
3797 impl Clone for CVec_ChannelDetailsZ {
3798         fn clone(&self) -> Self {
3799                 let mut res = Vec::new();
3800                 if self.datalen == 0 { return Self::from(res); }
3801                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3802                 Self::from(res)
3803         }
3804 }
3805 #[repr(C)]
3806 /// The contents of CResult_RouteLightningErrorZ
3807 pub union CResult_RouteLightningErrorZPtr {
3808         /// A pointer to the contents in the success state.
3809         /// Reading from this pointer when `result_ok` is not set is undefined.
3810         pub result: *mut crate::lightning::routing::router::Route,
3811         /// A pointer to the contents in the error state.
3812         /// Reading from this pointer when `result_ok` is set is undefined.
3813         pub err: *mut crate::lightning::ln::msgs::LightningError,
3814 }
3815 #[repr(C)]
3816 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3817 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3819 pub struct CResult_RouteLightningErrorZ {
3820         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3821         /// `err` or `result` depending on the state of `result_ok`.
3822         pub contents: CResult_RouteLightningErrorZPtr,
3823         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3824         pub result_ok: bool,
3825 }
3826 #[no_mangle]
3827 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3828 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3829         CResult_RouteLightningErrorZ {
3830                 contents: CResult_RouteLightningErrorZPtr {
3831                         result: Box::into_raw(Box::new(o)),
3832                 },
3833                 result_ok: true,
3834         }
3835 }
3836 #[no_mangle]
3837 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3838 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3839         CResult_RouteLightningErrorZ {
3840                 contents: CResult_RouteLightningErrorZPtr {
3841                         err: Box::into_raw(Box::new(e)),
3842                 },
3843                 result_ok: false,
3844         }
3845 }
3846 #[no_mangle]
3847 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3848 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3849 impl Drop for CResult_RouteLightningErrorZ {
3850         fn drop(&mut self) {
3851                 if self.result_ok {
3852                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3853                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3854                         }
3855                 } else {
3856                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3857                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3858                         }
3859                 }
3860         }
3861 }
3862 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3863         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3864                 let contents = if o.result_ok {
3865                         let result = unsafe { o.contents.result };
3866                         unsafe { o.contents.result = std::ptr::null_mut() };
3867                         CResult_RouteLightningErrorZPtr { result }
3868                 } else {
3869                         let err = unsafe { o.contents.err };
3870                         unsafe { o.contents.err = std::ptr::null_mut(); }
3871                         CResult_RouteLightningErrorZPtr { err }
3872                 };
3873                 Self {
3874                         contents,
3875                         result_ok: o.result_ok,
3876                 }
3877         }
3878 }
3879 impl Clone for CResult_RouteLightningErrorZ {
3880         fn clone(&self) -> Self {
3881                 if self.result_ok {
3882                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3883                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3884                         } }
3885                 } else {
3886                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3887                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3888                         } }
3889                 }
3890         }
3891 }
3892 #[no_mangle]
3893 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3894 /// but with all dynamically-allocated buffers duplicated in new buffers.
3895 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
3896 #[repr(C)]
3897 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3898 /// This corresponds to std::vector in C++
3899 pub struct CVec_MessageSendEventZ {
3900         /// The elements in the array.
3901         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3902         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3903         /// The number of elements pointed to by `data`.
3904         pub datalen: usize
3905 }
3906 impl CVec_MessageSendEventZ {
3907         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3908                 if self.datalen == 0 { return Vec::new(); }
3909                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3910                 self.data = std::ptr::null_mut();
3911                 self.datalen = 0;
3912                 ret
3913         }
3914         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3915                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3916         }
3917 }
3918 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3919         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3920                 let datalen = v.len();
3921                 let data = Box::into_raw(v.into_boxed_slice());
3922                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3923         }
3924 }
3925 #[no_mangle]
3926 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3927 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3928 impl Drop for CVec_MessageSendEventZ {
3929         fn drop(&mut self) {
3930                 if self.datalen == 0 { return; }
3931                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3932         }
3933 }
3934 impl Clone for CVec_MessageSendEventZ {
3935         fn clone(&self) -> Self {
3936                 let mut res = Vec::new();
3937                 if self.datalen == 0 { return Self::from(res); }
3938                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3939                 Self::from(res)
3940         }
3941 }
3942 #[repr(C)]
3943 /// The contents of CResult_boolLightningErrorZ
3944 pub union CResult_boolLightningErrorZPtr {
3945         /// A pointer to the contents in the success state.
3946         /// Reading from this pointer when `result_ok` is not set is undefined.
3947         pub result: *mut bool,
3948         /// A pointer to the contents in the error state.
3949         /// Reading from this pointer when `result_ok` is set is undefined.
3950         pub err: *mut crate::lightning::ln::msgs::LightningError,
3951 }
3952 #[repr(C)]
3953 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
3954 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
3955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3956 pub struct CResult_boolLightningErrorZ {
3957         /// The contents of this CResult_boolLightningErrorZ, accessible via either
3958         /// `err` or `result` depending on the state of `result_ok`.
3959         pub contents: CResult_boolLightningErrorZPtr,
3960         /// Whether this CResult_boolLightningErrorZ represents a success state.
3961         pub result_ok: bool,
3962 }
3963 #[no_mangle]
3964 /// Creates a new CResult_boolLightningErrorZ in the success state.
3965 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
3966         CResult_boolLightningErrorZ {
3967                 contents: CResult_boolLightningErrorZPtr {
3968                         result: Box::into_raw(Box::new(o)),
3969                 },
3970                 result_ok: true,
3971         }
3972 }
3973 #[no_mangle]
3974 /// Creates a new CResult_boolLightningErrorZ in the error state.
3975 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
3976         CResult_boolLightningErrorZ {
3977                 contents: CResult_boolLightningErrorZPtr {
3978                         err: Box::into_raw(Box::new(e)),
3979                 },
3980                 result_ok: false,
3981         }
3982 }
3983 #[no_mangle]
3984 /// Frees any resources used by the CResult_boolLightningErrorZ.
3985 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
3986 impl Drop for CResult_boolLightningErrorZ {
3987         fn drop(&mut self) {
3988                 if self.result_ok {
3989                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3990                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3991                         }
3992                 } else {
3993                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3994                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3995                         }
3996                 }
3997         }
3998 }
3999 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4000         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4001                 let contents = if o.result_ok {
4002                         let result = unsafe { o.contents.result };
4003                         unsafe { o.contents.result = std::ptr::null_mut() };
4004                         CResult_boolLightningErrorZPtr { result }
4005                 } else {
4006                         let err = unsafe { o.contents.err };
4007                         unsafe { o.contents.err = std::ptr::null_mut(); }
4008                         CResult_boolLightningErrorZPtr { err }
4009                 };
4010                 Self {
4011                         contents,
4012                         result_ok: o.result_ok,
4013                 }
4014         }
4015 }
4016 impl Clone for CResult_boolLightningErrorZ {
4017         fn clone(&self) -> Self {
4018                 if self.result_ok {
4019                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4020                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4021                         } }
4022                 } else {
4023                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4024                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4025                         } }
4026                 }
4027         }
4028 }
4029 #[no_mangle]
4030 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4031 /// but with all dynamically-allocated buffers duplicated in new buffers.
4032 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
4033 #[repr(C)]
4034 /// A tuple of 3 elements. See the individual fields for the types contained.
4035 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4036         /// The element at position 0
4037         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4038         /// The element at position 1
4039         pub b: crate::lightning::ln::msgs::ChannelUpdate,
4040         /// The element at position 2
4041         pub c: crate::lightning::ln::msgs::ChannelUpdate,
4042 }
4043 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4044         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4045                 Self {
4046                         a: tup.0,
4047                         b: tup.1,
4048                         c: tup.2,
4049                 }
4050         }
4051 }
4052 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4053         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4054                 (self.a, self.b, self.c)
4055         }
4056 }
4057 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4058         fn clone(&self) -> Self {
4059                 Self {
4060                         a: self.a.clone(),
4061                         b: self.b.clone(),
4062                         c: self.c.clone(),
4063                 }
4064         }
4065 }
4066 #[no_mangle]
4067 /// Creates a new tuple which has the same data as `orig`
4068 /// but with all dynamically-allocated buffers duplicated in new buffers.
4069 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
4070 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4071 #[no_mangle]
4072 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 {
4073         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4074 }
4075
4076 #[no_mangle]
4077 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
4078 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
4079 #[repr(C)]
4080 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4081 /// This corresponds to std::vector in C++
4082 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4083         /// The elements in the array.
4084         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4085         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
4086         /// The number of elements pointed to by `data`.
4087         pub datalen: usize
4088 }
4089 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4090         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
4091                 if self.datalen == 0 { return Vec::new(); }
4092                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4093                 self.data = std::ptr::null_mut();
4094                 self.datalen = 0;
4095                 ret
4096         }
4097         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
4098                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4099         }
4100 }
4101 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4102         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
4103                 let datalen = v.len();
4104                 let data = Box::into_raw(v.into_boxed_slice());
4105                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4106         }
4107 }
4108 #[no_mangle]
4109 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4110 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
4111 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4112         fn drop(&mut self) {
4113                 if self.datalen == 0 { return; }
4114                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4115         }
4116 }
4117 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4118         fn clone(&self) -> Self {
4119                 let mut res = Vec::new();
4120                 if self.datalen == 0 { return Self::from(res); }
4121                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4122                 Self::from(res)
4123         }
4124 }
4125 #[repr(C)]
4126 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4127 /// This corresponds to std::vector in C++
4128 pub struct CVec_NodeAnnouncementZ {
4129         /// The elements in the array.
4130         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4131         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
4132         /// The number of elements pointed to by `data`.
4133         pub datalen: usize
4134 }
4135 impl CVec_NodeAnnouncementZ {
4136         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
4137                 if self.datalen == 0 { return Vec::new(); }
4138                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4139                 self.data = std::ptr::null_mut();
4140                 self.datalen = 0;
4141                 ret
4142         }
4143         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
4144                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4145         }
4146 }
4147 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
4148         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
4149                 let datalen = v.len();
4150                 let data = Box::into_raw(v.into_boxed_slice());
4151                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4152         }
4153 }
4154 #[no_mangle]
4155 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4156 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
4157 impl Drop for CVec_NodeAnnouncementZ {
4158         fn drop(&mut self) {
4159                 if self.datalen == 0 { return; }
4160                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4161         }
4162 }
4163 impl Clone for CVec_NodeAnnouncementZ {
4164         fn clone(&self) -> Self {
4165                 let mut res = Vec::new();
4166                 if self.datalen == 0 { return Self::from(res); }
4167                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4168                 Self::from(res)
4169         }
4170 }
4171 #[repr(C)]
4172 /// The contents of CResult_NoneLightningErrorZ
4173 pub union CResult_NoneLightningErrorZPtr {
4174         /// Note that this value is always NULL, as there are no contents in the OK variant
4175         pub result: *mut std::ffi::c_void,
4176         /// A pointer to the contents in the error state.
4177         /// Reading from this pointer when `result_ok` is set is undefined.
4178         pub err: *mut crate::lightning::ln::msgs::LightningError,
4179 }
4180 #[repr(C)]
4181 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4182 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4184 pub struct CResult_NoneLightningErrorZ {
4185         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
4186         /// `err` or `result` depending on the state of `result_ok`.
4187         pub contents: CResult_NoneLightningErrorZPtr,
4188         /// Whether this CResult_NoneLightningErrorZ represents a success state.
4189         pub result_ok: bool,
4190 }
4191 #[no_mangle]
4192 /// Creates a new CResult_NoneLightningErrorZ in the success state.
4193 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
4194         CResult_NoneLightningErrorZ {
4195                 contents: CResult_NoneLightningErrorZPtr {
4196                         result: std::ptr::null_mut(),
4197                 },
4198                 result_ok: true,
4199         }
4200 }
4201 #[no_mangle]
4202 /// Creates a new CResult_NoneLightningErrorZ in the error state.
4203 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
4204         CResult_NoneLightningErrorZ {
4205                 contents: CResult_NoneLightningErrorZPtr {
4206                         err: Box::into_raw(Box::new(e)),
4207                 },
4208                 result_ok: false,
4209         }
4210 }
4211 #[no_mangle]
4212 /// Frees any resources used by the CResult_NoneLightningErrorZ.
4213 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
4214 impl Drop for CResult_NoneLightningErrorZ {
4215         fn drop(&mut self) {
4216                 if self.result_ok {
4217                 } else {
4218                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4219                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4220                         }
4221                 }
4222         }
4223 }
4224 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
4225         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
4226                 let contents = if o.result_ok {
4227                         let _ = unsafe { Box::from_raw(o.contents.result) };
4228                         o.contents.result = std::ptr::null_mut();
4229                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
4230                 } else {
4231                         let err = unsafe { o.contents.err };
4232                         unsafe { o.contents.err = std::ptr::null_mut(); }
4233                         CResult_NoneLightningErrorZPtr { err }
4234                 };
4235                 Self {
4236                         contents,
4237                         result_ok: o.result_ok,
4238                 }
4239         }
4240 }
4241 impl Clone for CResult_NoneLightningErrorZ {
4242         fn clone(&self) -> Self {
4243                 if self.result_ok {
4244                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
4245                                 result: std::ptr::null_mut()
4246                         } }
4247                 } else {
4248                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
4249                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4250                         } }
4251                 }
4252         }
4253 }
4254 #[no_mangle]
4255 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
4256 /// but with all dynamically-allocated buffers duplicated in new buffers.
4257 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
4258 #[repr(C)]
4259 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4260 /// This corresponds to std::vector in C++
4261 pub struct CVec_PublicKeyZ {
4262         /// The elements in the array.
4263         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4264         pub data: *mut crate::c_types::PublicKey,
4265         /// The number of elements pointed to by `data`.
4266         pub datalen: usize
4267 }
4268 impl CVec_PublicKeyZ {
4269         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4270                 if self.datalen == 0 { return Vec::new(); }
4271                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4272                 self.data = std::ptr::null_mut();
4273                 self.datalen = 0;
4274                 ret
4275         }
4276         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4277                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4278         }
4279 }
4280 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4281         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4282                 let datalen = v.len();
4283                 let data = Box::into_raw(v.into_boxed_slice());
4284                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4285         }
4286 }
4287 #[no_mangle]
4288 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4289 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4290 impl Drop for CVec_PublicKeyZ {
4291         fn drop(&mut self) {
4292                 if self.datalen == 0 { return; }
4293                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4294         }
4295 }
4296 #[repr(C)]
4297 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
4298 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
4299         /// A pointer to the contents in the success state.
4300         /// Reading from this pointer when `result_ok` is not set is undefined.
4301         pub result: *mut crate::c_types::derived::CVec_u8Z,
4302         /// A pointer to the contents in the error state.
4303         /// Reading from this pointer when `result_ok` is set is undefined.
4304         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4305 }
4306 #[repr(C)]
4307 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4308 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4309 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4310 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
4311         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4312         /// `err` or `result` depending on the state of `result_ok`.
4313         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
4314         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4315         pub result_ok: bool,
4316 }
4317 #[no_mangle]
4318 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
4319 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
4320         CResult_CVec_u8ZPeerHandleErrorZ {
4321                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4322                         result: Box::into_raw(Box::new(o)),
4323                 },
4324                 result_ok: true,
4325         }
4326 }
4327 #[no_mangle]
4328 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
4329 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
4330         CResult_CVec_u8ZPeerHandleErrorZ {
4331                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4332                         err: Box::into_raw(Box::new(e)),
4333                 },
4334                 result_ok: false,
4335         }
4336 }
4337 #[no_mangle]
4338 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
4339 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
4340 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
4341         fn drop(&mut self) {
4342                 if self.result_ok {
4343                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4344                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4345                         }
4346                 } else {
4347                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4348                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4349                         }
4350                 }
4351         }
4352 }
4353 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
4354         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4355                 let contents = if o.result_ok {
4356                         let result = unsafe { o.contents.result };
4357                         unsafe { o.contents.result = std::ptr::null_mut() };
4358                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
4359                 } else {
4360                         let err = unsafe { o.contents.err };
4361                         unsafe { o.contents.err = std::ptr::null_mut(); }
4362                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
4363                 };
4364                 Self {
4365                         contents,
4366                         result_ok: o.result_ok,
4367                 }
4368         }
4369 }
4370 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
4371         fn clone(&self) -> Self {
4372                 if self.result_ok {
4373                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4374                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
4375                         } }
4376                 } else {
4377                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4378                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4379                         } }
4380                 }
4381         }
4382 }
4383 #[no_mangle]
4384 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
4385 /// but with all dynamically-allocated buffers duplicated in new buffers.
4386 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
4387 #[repr(C)]
4388 /// The contents of CResult_NonePeerHandleErrorZ
4389 pub union CResult_NonePeerHandleErrorZPtr {
4390         /// Note that this value is always NULL, as there are no contents in the OK variant
4391         pub result: *mut std::ffi::c_void,
4392         /// A pointer to the contents in the error state.
4393         /// Reading from this pointer when `result_ok` is set is undefined.
4394         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4395 }
4396 #[repr(C)]
4397 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4398 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4400 pub struct CResult_NonePeerHandleErrorZ {
4401         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4402         /// `err` or `result` depending on the state of `result_ok`.
4403         pub contents: CResult_NonePeerHandleErrorZPtr,
4404         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
4405         pub result_ok: bool,
4406 }
4407 #[no_mangle]
4408 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
4409 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
4410         CResult_NonePeerHandleErrorZ {
4411                 contents: CResult_NonePeerHandleErrorZPtr {
4412                         result: std::ptr::null_mut(),
4413                 },
4414                 result_ok: true,
4415         }
4416 }
4417 #[no_mangle]
4418 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
4419 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
4420         CResult_NonePeerHandleErrorZ {
4421                 contents: CResult_NonePeerHandleErrorZPtr {
4422                         err: Box::into_raw(Box::new(e)),
4423                 },
4424                 result_ok: false,
4425         }
4426 }
4427 #[no_mangle]
4428 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
4429 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
4430 impl Drop for CResult_NonePeerHandleErrorZ {
4431         fn drop(&mut self) {
4432                 if self.result_ok {
4433                 } else {
4434                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4435                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4436                         }
4437                 }
4438         }
4439 }
4440 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
4441         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4442                 let contents = if o.result_ok {
4443                         let _ = unsafe { Box::from_raw(o.contents.result) };
4444                         o.contents.result = std::ptr::null_mut();
4445                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
4446                 } else {
4447                         let err = unsafe { o.contents.err };
4448                         unsafe { o.contents.err = std::ptr::null_mut(); }
4449                         CResult_NonePeerHandleErrorZPtr { err }
4450                 };
4451                 Self {
4452                         contents,
4453                         result_ok: o.result_ok,
4454                 }
4455         }
4456 }
4457 impl Clone for CResult_NonePeerHandleErrorZ {
4458         fn clone(&self) -> Self {
4459                 if self.result_ok {
4460                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
4461                                 result: std::ptr::null_mut()
4462                         } }
4463                 } else {
4464                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
4465                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4466                         } }
4467                 }
4468         }
4469 }
4470 #[no_mangle]
4471 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
4472 /// but with all dynamically-allocated buffers duplicated in new buffers.
4473 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
4474 #[repr(C)]
4475 /// The contents of CResult_boolPeerHandleErrorZ
4476 pub union CResult_boolPeerHandleErrorZPtr {
4477         /// A pointer to the contents in the success state.
4478         /// Reading from this pointer when `result_ok` is not set is undefined.
4479         pub result: *mut bool,
4480         /// A pointer to the contents in the error state.
4481         /// Reading from this pointer when `result_ok` is set is undefined.
4482         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4483 }
4484 #[repr(C)]
4485 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4486 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4488 pub struct CResult_boolPeerHandleErrorZ {
4489         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4490         /// `err` or `result` depending on the state of `result_ok`.
4491         pub contents: CResult_boolPeerHandleErrorZPtr,
4492         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
4493         pub result_ok: bool,
4494 }
4495 #[no_mangle]
4496 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
4497 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
4498         CResult_boolPeerHandleErrorZ {
4499                 contents: CResult_boolPeerHandleErrorZPtr {
4500                         result: Box::into_raw(Box::new(o)),
4501                 },
4502                 result_ok: true,
4503         }
4504 }
4505 #[no_mangle]
4506 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
4507 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
4508         CResult_boolPeerHandleErrorZ {
4509                 contents: CResult_boolPeerHandleErrorZPtr {
4510                         err: Box::into_raw(Box::new(e)),
4511                 },
4512                 result_ok: false,
4513         }
4514 }
4515 #[no_mangle]
4516 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
4517 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
4518 impl Drop for CResult_boolPeerHandleErrorZ {
4519         fn drop(&mut self) {
4520                 if self.result_ok {
4521                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4522                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4523                         }
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<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
4532         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4533                 let contents = if o.result_ok {
4534                         let result = unsafe { o.contents.result };
4535                         unsafe { o.contents.result = std::ptr::null_mut() };
4536                         CResult_boolPeerHandleErrorZPtr { result }
4537                 } else {
4538                         let err = unsafe { o.contents.err };
4539                         unsafe { o.contents.err = std::ptr::null_mut(); }
4540                         CResult_boolPeerHandleErrorZPtr { err }
4541                 };
4542                 Self {
4543                         contents,
4544                         result_ok: o.result_ok,
4545                 }
4546         }
4547 }
4548 impl Clone for CResult_boolPeerHandleErrorZ {
4549         fn clone(&self) -> Self {
4550                 if self.result_ok {
4551                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
4552                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4553                         } }
4554                 } else {
4555                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
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_boolPeerHandleErrorZ which has the same data as `orig`
4563 /// but with all dynamically-allocated buffers duplicated in new buffers.
4564 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
4565 #[repr(C)]
4566 /// The contents of CResult_TxOutAccessErrorZ
4567 pub union CResult_TxOutAccessErrorZPtr {
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 crate::c_types::TxOut,
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::chain::AccessError,
4574 }
4575 #[repr(C)]
4576 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4577 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4579 pub struct CResult_TxOutAccessErrorZ {
4580         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4581         /// `err` or `result` depending on the state of `result_ok`.
4582         pub contents: CResult_TxOutAccessErrorZPtr,
4583         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4584         pub result_ok: bool,
4585 }
4586 #[no_mangle]
4587 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4588 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4589         CResult_TxOutAccessErrorZ {
4590                 contents: CResult_TxOutAccessErrorZPtr {
4591                         result: Box::into_raw(Box::new(o)),
4592                 },
4593                 result_ok: true,
4594         }
4595 }
4596 #[no_mangle]
4597 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4598 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4599         CResult_TxOutAccessErrorZ {
4600                 contents: CResult_TxOutAccessErrorZPtr {
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_TxOutAccessErrorZ.
4608 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4609 impl Drop for CResult_TxOutAccessErrorZ {
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<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4623         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> 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_TxOutAccessErrorZPtr { result }
4628                 } else {
4629                         let err = unsafe { o.contents.err };
4630                         unsafe { o.contents.err = std::ptr::null_mut(); }
4631                         CResult_TxOutAccessErrorZPtr { err }
4632                 };
4633                 Self {
4634                         contents,
4635                         result_ok: o.result_ok,
4636                 }
4637         }
4638 }
4639 impl Clone for CResult_TxOutAccessErrorZ {
4640         fn clone(&self) -> Self {
4641                 if self.result_ok {
4642                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4643                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4644                         } }
4645                 } else {
4646                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4647                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4648                         } }
4649                 }
4650         }
4651 }
4652 #[no_mangle]
4653 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4654 /// but with all dynamically-allocated buffers duplicated in new buffers.
4655 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4656 #[repr(C)]
4657 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4658 pub enum COption_C2Tuple_usizeTransactionZZ {
4659         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4660         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4661         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4662         None
4663 }
4664 impl COption_C2Tuple_usizeTransactionZZ {
4665         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4666                 if let Self::Some(_) = self { true } else { false }
4667         }
4668         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4669                 if let Self::Some(v) = self { v } else { unreachable!() }
4670         }
4671 }
4672 #[no_mangle]
4673 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4674 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4675         COption_C2Tuple_usizeTransactionZZ::Some(o)
4676 }
4677 #[no_mangle]
4678 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4679 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4680         COption_C2Tuple_usizeTransactionZZ::None
4681 }
4682 #[no_mangle]
4683 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4684 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4685 #[repr(C)]
4686 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4687 /// This corresponds to std::vector in C++
4688 pub struct CVec_SpendableOutputDescriptorZ {
4689         /// The elements in the array.
4690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4691         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4692         /// The number of elements pointed to by `data`.
4693         pub datalen: usize
4694 }
4695 impl CVec_SpendableOutputDescriptorZ {
4696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
4697                 if self.datalen == 0 { return Vec::new(); }
4698                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4699                 self.data = std::ptr::null_mut();
4700                 self.datalen = 0;
4701                 ret
4702         }
4703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
4704                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4705         }
4706 }
4707 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4708         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4709                 let datalen = v.len();
4710                 let data = Box::into_raw(v.into_boxed_slice());
4711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4712         }
4713 }
4714 #[no_mangle]
4715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4716 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4717 impl Drop for CVec_SpendableOutputDescriptorZ {
4718         fn drop(&mut self) {
4719                 if self.datalen == 0 { return; }
4720                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4721         }
4722 }
4723 impl Clone for CVec_SpendableOutputDescriptorZ {
4724         fn clone(&self) -> Self {
4725                 let mut res = Vec::new();
4726                 if self.datalen == 0 { return Self::from(res); }
4727                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4728                 Self::from(res)
4729         }
4730 }
4731 #[repr(C)]
4732 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4733 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
4734         /// A pointer to the contents in the success state.
4735         /// Reading from this pointer when `result_ok` is not set is undefined.
4736         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
4737         /// A pointer to the contents in the error state.
4738         /// Reading from this pointer when `result_ok` is set is undefined.
4739         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4740 }
4741 #[repr(C)]
4742 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4743 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4745 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
4746         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4747         /// `err` or `result` depending on the state of `result_ok`.
4748         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
4749         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4750         pub result_ok: bool,
4751 }
4752 #[no_mangle]
4753 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
4754 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4755         CResult_DirectionalChannelInfoDecodeErrorZ {
4756                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4757                         result: Box::into_raw(Box::new(o)),
4758                 },
4759                 result_ok: true,
4760         }
4761 }
4762 #[no_mangle]
4763 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
4764 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4765         CResult_DirectionalChannelInfoDecodeErrorZ {
4766                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4767                         err: Box::into_raw(Box::new(e)),
4768                 },
4769                 result_ok: false,
4770         }
4771 }
4772 #[no_mangle]
4773 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
4774 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
4775 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
4776         fn drop(&mut self) {
4777                 if self.result_ok {
4778                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4779                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4780                         }
4781                 } else {
4782                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4783                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4784                         }
4785                 }
4786         }
4787 }
4788 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
4789         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4790                 let contents = if o.result_ok {
4791                         let result = unsafe { o.contents.result };
4792                         unsafe { o.contents.result = std::ptr::null_mut() };
4793                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
4794                 } else {
4795                         let err = unsafe { o.contents.err };
4796                         unsafe { o.contents.err = std::ptr::null_mut(); }
4797                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
4798                 };
4799                 Self {
4800                         contents,
4801                         result_ok: o.result_ok,
4802                 }
4803         }
4804 }
4805 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
4806         fn clone(&self) -> Self {
4807                 if self.result_ok {
4808                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4809                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
4810                         } }
4811                 } else {
4812                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4813                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4814                         } }
4815                 }
4816         }
4817 }
4818 #[no_mangle]
4819 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
4820 /// but with all dynamically-allocated buffers duplicated in new buffers.
4821 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
4822 #[repr(C)]
4823 /// The contents of CResult_ChannelInfoDecodeErrorZ
4824 pub union CResult_ChannelInfoDecodeErrorZPtr {
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::ChannelInfo,
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_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4834 /// containing a crate::lightning::routing::network_graph::ChannelInfo 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_ChannelInfoDecodeErrorZ {
4837         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4838         /// `err` or `result` depending on the state of `result_ok`.
4839         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
4840         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4841         pub result_ok: bool,
4842 }
4843 #[no_mangle]
4844 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
4845 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
4846         CResult_ChannelInfoDecodeErrorZ {
4847                 contents: CResult_ChannelInfoDecodeErrorZPtr {
4848                         result: Box::into_raw(Box::new(o)),
4849                 },
4850                 result_ok: true,
4851         }
4852 }
4853 #[no_mangle]
4854 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
4855 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
4856         CResult_ChannelInfoDecodeErrorZ {
4857                 contents: CResult_ChannelInfoDecodeErrorZPtr {
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_ChannelInfoDecodeErrorZ.
4865 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
4866 impl Drop for CResult_ChannelInfoDecodeErrorZ {
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::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
4880         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, 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_ChannelInfoDecodeErrorZPtr { result }
4885                 } else {
4886                         let err = unsafe { o.contents.err };
4887                         unsafe { o.contents.err = std::ptr::null_mut(); }
4888                         CResult_ChannelInfoDecodeErrorZPtr { err }
4889                 };
4890                 Self {
4891                         contents,
4892                         result_ok: o.result_ok,
4893                 }
4894         }
4895 }
4896 impl Clone for CResult_ChannelInfoDecodeErrorZ {
4897         fn clone(&self) -> Self {
4898                 if self.result_ok {
4899                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
4900                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
4901                         } }
4902                 } else {
4903                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
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_ChannelInfoDecodeErrorZ which has the same data as `orig`
4911 /// but with all dynamically-allocated buffers duplicated in new buffers.
4912 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
4913 #[repr(C)]
4914 /// The contents of CResult_RoutingFeesDecodeErrorZ
4915 pub union CResult_RoutingFeesDecodeErrorZPtr {
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::RoutingFees,
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_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4925 /// containing a crate::lightning::routing::network_graph::RoutingFees 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_RoutingFeesDecodeErrorZ {
4928         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4929         /// `err` or `result` depending on the state of `result_ok`.
4930         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
4931         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4932         pub result_ok: bool,
4933 }
4934 #[no_mangle]
4935 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
4936 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
4937         CResult_RoutingFeesDecodeErrorZ {
4938                 contents: CResult_RoutingFeesDecodeErrorZPtr {
4939                         result: Box::into_raw(Box::new(o)),
4940                 },
4941                 result_ok: true,
4942         }
4943 }
4944 #[no_mangle]
4945 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
4946 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
4947         CResult_RoutingFeesDecodeErrorZ {
4948                 contents: CResult_RoutingFeesDecodeErrorZPtr {
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_RoutingFeesDecodeErrorZ.
4956 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
4957 impl Drop for CResult_RoutingFeesDecodeErrorZ {
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::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
4971         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, 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_RoutingFeesDecodeErrorZPtr { result }
4976                 } else {
4977                         let err = unsafe { o.contents.err };
4978                         unsafe { o.contents.err = std::ptr::null_mut(); }
4979                         CResult_RoutingFeesDecodeErrorZPtr { err }
4980                 };
4981                 Self {
4982                         contents,
4983                         result_ok: o.result_ok,
4984                 }
4985         }
4986 }
4987 impl Clone for CResult_RoutingFeesDecodeErrorZ {
4988         fn clone(&self) -> Self {
4989                 if self.result_ok {
4990                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
4991                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
4992                         } }
4993                 } else {
4994                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
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_RoutingFeesDecodeErrorZ which has the same data as `orig`
5002 /// but with all dynamically-allocated buffers duplicated in new buffers.
5003 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
5004 #[repr(C)]
5005 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5006 /// This corresponds to std::vector in C++
5007 pub struct CVec_NetAddressZ {
5008         /// The elements in the array.
5009         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5010         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5011         /// The number of elements pointed to by `data`.
5012         pub datalen: usize
5013 }
5014 impl CVec_NetAddressZ {
5015         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5016                 if self.datalen == 0 { return Vec::new(); }
5017                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5018                 self.data = std::ptr::null_mut();
5019                 self.datalen = 0;
5020                 ret
5021         }
5022         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5023                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5024         }
5025 }
5026 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5027         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5028                 let datalen = v.len();
5029                 let data = Box::into_raw(v.into_boxed_slice());
5030                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5031         }
5032 }
5033 #[no_mangle]
5034 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5035 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5036 impl Drop for CVec_NetAddressZ {
5037         fn drop(&mut self) {
5038                 if self.datalen == 0 { return; }
5039                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5040         }
5041 }
5042 impl Clone for CVec_NetAddressZ {
5043         fn clone(&self) -> Self {
5044                 let mut res = Vec::new();
5045                 if self.datalen == 0 { return Self::from(res); }
5046                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5047                 Self::from(res)
5048         }
5049 }
5050 #[repr(C)]
5051 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5052 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5053         /// A pointer to the contents in the success state.
5054         /// Reading from this pointer when `result_ok` is not set is undefined.
5055         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
5056         /// A pointer to the contents in the error state.
5057         /// Reading from this pointer when `result_ok` is set is undefined.
5058         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5059 }
5060 #[repr(C)]
5061 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5062 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5064 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5065         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5066         /// `err` or `result` depending on the state of `result_ok`.
5067         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5068         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5069         pub result_ok: bool,
5070 }
5071 #[no_mangle]
5072 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5073 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5074         CResult_NodeAnnouncementInfoDecodeErrorZ {
5075                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5076                         result: Box::into_raw(Box::new(o)),
5077                 },
5078                 result_ok: true,
5079         }
5080 }
5081 #[no_mangle]
5082 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5083 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5084         CResult_NodeAnnouncementInfoDecodeErrorZ {
5085                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5086                         err: Box::into_raw(Box::new(e)),
5087                 },
5088                 result_ok: false,
5089         }
5090 }
5091 #[no_mangle]
5092 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5093 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5094 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5095         fn drop(&mut self) {
5096                 if self.result_ok {
5097                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5098                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5099                         }
5100                 } else {
5101                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5102                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5103                         }
5104                 }
5105         }
5106 }
5107 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5108         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5109                 let contents = if o.result_ok {
5110                         let result = unsafe { o.contents.result };
5111                         unsafe { o.contents.result = std::ptr::null_mut() };
5112                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5113                 } else {
5114                         let err = unsafe { o.contents.err };
5115                         unsafe { o.contents.err = std::ptr::null_mut(); }
5116                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5117                 };
5118                 Self {
5119                         contents,
5120                         result_ok: o.result_ok,
5121                 }
5122         }
5123 }
5124 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5125         fn clone(&self) -> Self {
5126                 if self.result_ok {
5127                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5128                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5129                         } }
5130                 } else {
5131                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5132                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5133                         } }
5134                 }
5135         }
5136 }
5137 #[no_mangle]
5138 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5139 /// but with all dynamically-allocated buffers duplicated in new buffers.
5140 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
5141 #[repr(C)]
5142 /// A dynamically-allocated array of u64s of arbitrary size.
5143 /// This corresponds to std::vector in C++
5144 pub struct CVec_u64Z {
5145         /// The elements in the array.
5146         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5147         pub data: *mut u64,
5148         /// The number of elements pointed to by `data`.
5149         pub datalen: usize
5150 }
5151 impl CVec_u64Z {
5152         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5153                 if self.datalen == 0 { return Vec::new(); }
5154                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5155                 self.data = std::ptr::null_mut();
5156                 self.datalen = 0;
5157                 ret
5158         }
5159         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5160                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5161         }
5162 }
5163 impl From<Vec<u64>> for CVec_u64Z {
5164         fn from(v: Vec<u64>) -> Self {
5165                 let datalen = v.len();
5166                 let data = Box::into_raw(v.into_boxed_slice());
5167                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5168         }
5169 }
5170 #[no_mangle]
5171 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5172 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5173 impl Drop for CVec_u64Z {
5174         fn drop(&mut self) {
5175                 if self.datalen == 0 { return; }
5176                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5177         }
5178 }
5179 impl Clone for CVec_u64Z {
5180         fn clone(&self) -> Self {
5181                 let mut res = Vec::new();
5182                 if self.datalen == 0 { return Self::from(res); }
5183                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5184                 Self::from(res)
5185         }
5186 }
5187 #[repr(C)]
5188 /// The contents of CResult_NodeInfoDecodeErrorZ
5189 pub union CResult_NodeInfoDecodeErrorZPtr {
5190         /// A pointer to the contents in the success state.
5191         /// Reading from this pointer when `result_ok` is not set is undefined.
5192         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
5193         /// A pointer to the contents in the error state.
5194         /// Reading from this pointer when `result_ok` is set is undefined.
5195         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5196 }
5197 #[repr(C)]
5198 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5199 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5200 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5201 pub struct CResult_NodeInfoDecodeErrorZ {
5202         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5203         /// `err` or `result` depending on the state of `result_ok`.
5204         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5205         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5206         pub result_ok: bool,
5207 }
5208 #[no_mangle]
5209 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5210 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5211         CResult_NodeInfoDecodeErrorZ {
5212                 contents: CResult_NodeInfoDecodeErrorZPtr {
5213                         result: Box::into_raw(Box::new(o)),
5214                 },
5215                 result_ok: true,
5216         }
5217 }
5218 #[no_mangle]
5219 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5220 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5221         CResult_NodeInfoDecodeErrorZ {
5222                 contents: CResult_NodeInfoDecodeErrorZPtr {
5223                         err: Box::into_raw(Box::new(e)),
5224                 },
5225                 result_ok: false,
5226         }
5227 }
5228 #[no_mangle]
5229 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5230 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5231 impl Drop for CResult_NodeInfoDecodeErrorZ {
5232         fn drop(&mut self) {
5233                 if self.result_ok {
5234                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5235                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5236                         }
5237                 } else {
5238                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5239                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5240                         }
5241                 }
5242         }
5243 }
5244 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5245         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5246                 let contents = if o.result_ok {
5247                         let result = unsafe { o.contents.result };
5248                         unsafe { o.contents.result = std::ptr::null_mut() };
5249                         CResult_NodeInfoDecodeErrorZPtr { result }
5250                 } else {
5251                         let err = unsafe { o.contents.err };
5252                         unsafe { o.contents.err = std::ptr::null_mut(); }
5253                         CResult_NodeInfoDecodeErrorZPtr { err }
5254                 };
5255                 Self {
5256                         contents,
5257                         result_ok: o.result_ok,
5258                 }
5259         }
5260 }
5261 impl Clone for CResult_NodeInfoDecodeErrorZ {
5262         fn clone(&self) -> Self {
5263                 if self.result_ok {
5264                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5265                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
5266                         } }
5267                 } else {
5268                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5269                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5270                         } }
5271                 }
5272         }
5273 }
5274 #[no_mangle]
5275 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5276 /// but with all dynamically-allocated buffers duplicated in new buffers.
5277 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
5278 #[repr(C)]
5279 /// The contents of CResult_NetworkGraphDecodeErrorZ
5280 pub union CResult_NetworkGraphDecodeErrorZPtr {
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::NetworkGraph,
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_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5290 /// containing a crate::lightning::routing::network_graph::NetworkGraph 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_NetworkGraphDecodeErrorZ {
5293         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5294         /// `err` or `result` depending on the state of `result_ok`.
5295         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5296         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5297         pub result_ok: bool,
5298 }
5299 #[no_mangle]
5300 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5301 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5302         CResult_NetworkGraphDecodeErrorZ {
5303                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5304                         result: Box::into_raw(Box::new(o)),
5305                 },
5306                 result_ok: true,
5307         }
5308 }
5309 #[no_mangle]
5310 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5311 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5312         CResult_NetworkGraphDecodeErrorZ {
5313                 contents: CResult_NetworkGraphDecodeErrorZPtr {
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_NetworkGraphDecodeErrorZ.
5321 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5322 impl Drop for CResult_NetworkGraphDecodeErrorZ {
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::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5336         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, 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_NetworkGraphDecodeErrorZPtr { result }
5341                 } else {
5342                         let err = unsafe { o.contents.err };
5343                         unsafe { o.contents.err = std::ptr::null_mut(); }
5344                         CResult_NetworkGraphDecodeErrorZPtr { err }
5345                 };
5346                 Self {
5347                         contents,
5348                         result_ok: o.result_ok,
5349                 }
5350         }
5351 }
5352 impl Clone for CResult_NetworkGraphDecodeErrorZ {
5353         fn clone(&self) -> Self {
5354                 if self.result_ok {
5355                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
5356                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
5357                         } }
5358                 } else {
5359                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
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_NetworkGraphDecodeErrorZ which has the same data as `orig`
5367 /// but with all dynamically-allocated buffers duplicated in new buffers.
5368 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
5369 #[repr(C)]
5370 /// The contents of CResult_InitFeaturesDecodeErrorZ
5371 pub union CResult_InitFeaturesDecodeErrorZPtr {
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::ln::features::InitFeatures,
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_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5381 /// containing a crate::lightning::ln::features::InitFeatures 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_InitFeaturesDecodeErrorZ {
5384         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5385         /// `err` or `result` depending on the state of `result_ok`.
5386         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5387         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5388         pub result_ok: bool,
5389 }
5390 #[no_mangle]
5391 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5392 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5393         CResult_InitFeaturesDecodeErrorZ {
5394                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5395                         result: Box::into_raw(Box::new(o)),
5396                 },
5397                 result_ok: true,
5398         }
5399 }
5400 #[no_mangle]
5401 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5402 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5403         CResult_InitFeaturesDecodeErrorZ {
5404                 contents: CResult_InitFeaturesDecodeErrorZPtr {
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_InitFeaturesDecodeErrorZ.
5412 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5413 impl Drop for CResult_InitFeaturesDecodeErrorZ {
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::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5427         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, 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_InitFeaturesDecodeErrorZPtr { result }
5432                 } else {
5433                         let err = unsafe { o.contents.err };
5434                         unsafe { o.contents.err = std::ptr::null_mut(); }
5435                         CResult_InitFeaturesDecodeErrorZPtr { err }
5436                 };
5437                 Self {
5438                         contents,
5439                         result_ok: o.result_ok,
5440                 }
5441         }
5442 }
5443 #[repr(C)]
5444 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5445 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5446         /// A pointer to the contents in the success state.
5447         /// Reading from this pointer when `result_ok` is not set is undefined.
5448         pub result: *mut crate::lightning::ln::features::NodeFeatures,
5449         /// A pointer to the contents in the error state.
5450         /// Reading from this pointer when `result_ok` is set is undefined.
5451         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5452 }
5453 #[repr(C)]
5454 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5455 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5456 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5457 pub struct CResult_NodeFeaturesDecodeErrorZ {
5458         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5459         /// `err` or `result` depending on the state of `result_ok`.
5460         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5461         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5462         pub result_ok: bool,
5463 }
5464 #[no_mangle]
5465 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5466 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5467         CResult_NodeFeaturesDecodeErrorZ {
5468                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5469                         result: Box::into_raw(Box::new(o)),
5470                 },
5471                 result_ok: true,
5472         }
5473 }
5474 #[no_mangle]
5475 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5476 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5477         CResult_NodeFeaturesDecodeErrorZ {
5478                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5479                         err: Box::into_raw(Box::new(e)),
5480                 },
5481                 result_ok: false,
5482         }
5483 }
5484 #[no_mangle]
5485 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5486 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5487 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5488         fn drop(&mut self) {
5489                 if self.result_ok {
5490                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5491                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5492                         }
5493                 } else {
5494                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5495                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5496                         }
5497                 }
5498         }
5499 }
5500 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5501         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5502                 let contents = if o.result_ok {
5503                         let result = unsafe { o.contents.result };
5504                         unsafe { o.contents.result = std::ptr::null_mut() };
5505                         CResult_NodeFeaturesDecodeErrorZPtr { result }
5506                 } else {
5507                         let err = unsafe { o.contents.err };
5508                         unsafe { o.contents.err = std::ptr::null_mut(); }
5509                         CResult_NodeFeaturesDecodeErrorZPtr { err }
5510                 };
5511                 Self {
5512                         contents,
5513                         result_ok: o.result_ok,
5514                 }
5515         }
5516 }
5517 #[repr(C)]
5518 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5519 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5520         /// A pointer to the contents in the success state.
5521         /// Reading from this pointer when `result_ok` is not set is undefined.
5522         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5523         /// A pointer to the contents in the error state.
5524         /// Reading from this pointer when `result_ok` is set is undefined.
5525         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5526 }
5527 #[repr(C)]
5528 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5529 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5531 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5532         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5533         /// `err` or `result` depending on the state of `result_ok`.
5534         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5535         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5536         pub result_ok: bool,
5537 }
5538 #[no_mangle]
5539 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5540 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5541         CResult_ChannelFeaturesDecodeErrorZ {
5542                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5543                         result: Box::into_raw(Box::new(o)),
5544                 },
5545                 result_ok: true,
5546         }
5547 }
5548 #[no_mangle]
5549 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5550 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5551         CResult_ChannelFeaturesDecodeErrorZ {
5552                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5553                         err: Box::into_raw(Box::new(e)),
5554                 },
5555                 result_ok: false,
5556         }
5557 }
5558 #[no_mangle]
5559 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5560 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5561 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5562         fn drop(&mut self) {
5563                 if self.result_ok {
5564                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5565                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5566                         }
5567                 } else {
5568                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5569                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5570                         }
5571                 }
5572         }
5573 }
5574 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5575         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5576                 let contents = if o.result_ok {
5577                         let result = unsafe { o.contents.result };
5578                         unsafe { o.contents.result = std::ptr::null_mut() };
5579                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
5580                 } else {
5581                         let err = unsafe { o.contents.err };
5582                         unsafe { o.contents.err = std::ptr::null_mut(); }
5583                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
5584                 };
5585                 Self {
5586                         contents,
5587                         result_ok: o.result_ok,
5588                 }
5589         }
5590 }
5591 #[repr(C)]
5592 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
5593 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
5594         /// A pointer to the contents in the success state.
5595         /// Reading from this pointer when `result_ok` is not set is undefined.
5596         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
5597         /// A pointer to the contents in the error state.
5598         /// Reading from this pointer when `result_ok` is set is undefined.
5599         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5600 }
5601 #[repr(C)]
5602 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5603 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5605 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
5606         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5607         /// `err` or `result` depending on the state of `result_ok`.
5608         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
5609         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5610         pub result_ok: bool,
5611 }
5612 #[no_mangle]
5613 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
5614 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
5615         CResult_InvoiceFeaturesDecodeErrorZ {
5616                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5617                         result: Box::into_raw(Box::new(o)),
5618                 },
5619                 result_ok: true,
5620         }
5621 }
5622 #[no_mangle]
5623 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
5624 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
5625         CResult_InvoiceFeaturesDecodeErrorZ {
5626                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5627                         err: Box::into_raw(Box::new(e)),
5628                 },
5629                 result_ok: false,
5630         }
5631 }
5632 #[no_mangle]
5633 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
5634 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
5635 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
5636         fn drop(&mut self) {
5637                 if self.result_ok {
5638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5640                         }
5641                 } else {
5642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5644                         }
5645                 }
5646         }
5647 }
5648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
5649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5650                 let contents = if o.result_ok {
5651                         let result = unsafe { o.contents.result };
5652                         unsafe { o.contents.result = std::ptr::null_mut() };
5653                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
5654                 } else {
5655                         let err = unsafe { o.contents.err };
5656                         unsafe { o.contents.err = std::ptr::null_mut(); }
5657                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
5658                 };
5659                 Self {
5660                         contents,
5661                         result_ok: o.result_ok,
5662                 }
5663         }
5664 }
5665 #[repr(C)]
5666 /// The contents of CResult_NetAddressu8Z
5667 pub union CResult_NetAddressu8ZPtr {
5668         /// A pointer to the contents in the success state.
5669         /// Reading from this pointer when `result_ok` is not set is undefined.
5670         pub result: *mut crate::lightning::ln::msgs::NetAddress,
5671         /// A pointer to the contents in the error state.
5672         /// Reading from this pointer when `result_ok` is set is undefined.
5673         pub err: *mut u8,
5674 }
5675 #[repr(C)]
5676 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5677 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5679 pub struct CResult_NetAddressu8Z {
5680         /// The contents of this CResult_NetAddressu8Z, accessible via either
5681         /// `err` or `result` depending on the state of `result_ok`.
5682         pub contents: CResult_NetAddressu8ZPtr,
5683         /// Whether this CResult_NetAddressu8Z represents a success state.
5684         pub result_ok: bool,
5685 }
5686 #[no_mangle]
5687 /// Creates a new CResult_NetAddressu8Z in the success state.
5688 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5689         CResult_NetAddressu8Z {
5690                 contents: CResult_NetAddressu8ZPtr {
5691                         result: Box::into_raw(Box::new(o)),
5692                 },
5693                 result_ok: true,
5694         }
5695 }
5696 #[no_mangle]
5697 /// Creates a new CResult_NetAddressu8Z in the error state.
5698 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5699         CResult_NetAddressu8Z {
5700                 contents: CResult_NetAddressu8ZPtr {
5701                         err: Box::into_raw(Box::new(e)),
5702                 },
5703                 result_ok: false,
5704         }
5705 }
5706 #[no_mangle]
5707 /// Frees any resources used by the CResult_NetAddressu8Z.
5708 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5709 impl Drop for CResult_NetAddressu8Z {
5710         fn drop(&mut self) {
5711                 if self.result_ok {
5712                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5713                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5714                         }
5715                 } else {
5716                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5717                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5718                         }
5719                 }
5720         }
5721 }
5722 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5723         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
5724                 let contents = if o.result_ok {
5725                         let result = unsafe { o.contents.result };
5726                         unsafe { o.contents.result = std::ptr::null_mut() };
5727                         CResult_NetAddressu8ZPtr { result }
5728                 } else {
5729                         let err = unsafe { o.contents.err };
5730                         unsafe { o.contents.err = std::ptr::null_mut(); }
5731                         CResult_NetAddressu8ZPtr { err }
5732                 };
5733                 Self {
5734                         contents,
5735                         result_ok: o.result_ok,
5736                 }
5737         }
5738 }
5739 impl Clone for CResult_NetAddressu8Z {
5740         fn clone(&self) -> Self {
5741                 if self.result_ok {
5742                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5743                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5744                         } }
5745                 } else {
5746                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5747                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5748                         } }
5749                 }
5750         }
5751 }
5752 #[no_mangle]
5753 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5754 /// but with all dynamically-allocated buffers duplicated in new buffers.
5755 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5756 #[repr(C)]
5757 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5758 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
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::c_types::derived::CResult_NetAddressu8Z,
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 crate::lightning::ln::msgs::DecodeError,
5765 }
5766 #[repr(C)]
5767 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5768 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5769 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5770 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5771         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5772         /// `err` or `result` depending on the state of `result_ok`.
5773         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5774         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5775         pub result_ok: bool,
5776 }
5777 #[no_mangle]
5778 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5779 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5780         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5781                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5782                         result: Box::into_raw(Box::new(o)),
5783                 },
5784                 result_ok: true,
5785         }
5786 }
5787 #[no_mangle]
5788 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5789 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5790         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5791                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
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_CResult_NetAddressu8ZDecodeErrorZ.
5799 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5800 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
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::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5814         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> 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_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5819                 } else {
5820                         let err = unsafe { o.contents.err };
5821                         unsafe { o.contents.err = std::ptr::null_mut(); }
5822                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5823                 };
5824                 Self {
5825                         contents,
5826                         result_ok: o.result_ok,
5827                 }
5828         }
5829 }
5830 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5831         fn clone(&self) -> Self {
5832                 if self.result_ok {
5833                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5834                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5835                         } }
5836                 } else {
5837                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5838                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5839                         } }
5840                 }
5841         }
5842 }
5843 #[no_mangle]
5844 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5845 /// but with all dynamically-allocated buffers duplicated in new buffers.
5846 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5847 #[repr(C)]
5848 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5849 /// This corresponds to std::vector in C++
5850 pub struct CVec_UpdateAddHTLCZ {
5851         /// The elements in the array.
5852         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5853         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
5854         /// The number of elements pointed to by `data`.
5855         pub datalen: usize
5856 }
5857 impl CVec_UpdateAddHTLCZ {
5858         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
5859                 if self.datalen == 0 { return Vec::new(); }
5860                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5861                 self.data = std::ptr::null_mut();
5862                 self.datalen = 0;
5863                 ret
5864         }
5865         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
5866                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5867         }
5868 }
5869 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
5870         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
5871                 let datalen = v.len();
5872                 let data = Box::into_raw(v.into_boxed_slice());
5873                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5874         }
5875 }
5876 #[no_mangle]
5877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5878 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
5879 impl Drop for CVec_UpdateAddHTLCZ {
5880         fn drop(&mut self) {
5881                 if self.datalen == 0 { return; }
5882                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5883         }
5884 }
5885 impl Clone for CVec_UpdateAddHTLCZ {
5886         fn clone(&self) -> Self {
5887                 let mut res = Vec::new();
5888                 if self.datalen == 0 { return Self::from(res); }
5889                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5890                 Self::from(res)
5891         }
5892 }
5893 #[repr(C)]
5894 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5895 /// This corresponds to std::vector in C++
5896 pub struct CVec_UpdateFulfillHTLCZ {
5897         /// The elements in the array.
5898         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5899         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
5900         /// The number of elements pointed to by `data`.
5901         pub datalen: usize
5902 }
5903 impl CVec_UpdateFulfillHTLCZ {
5904         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
5905                 if self.datalen == 0 { return Vec::new(); }
5906                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5907                 self.data = std::ptr::null_mut();
5908                 self.datalen = 0;
5909                 ret
5910         }
5911         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
5912                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5913         }
5914 }
5915 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
5916         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
5917                 let datalen = v.len();
5918                 let data = Box::into_raw(v.into_boxed_slice());
5919                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5920         }
5921 }
5922 #[no_mangle]
5923 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5924 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
5925 impl Drop for CVec_UpdateFulfillHTLCZ {
5926         fn drop(&mut self) {
5927                 if self.datalen == 0 { return; }
5928                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5929         }
5930 }
5931 impl Clone for CVec_UpdateFulfillHTLCZ {
5932         fn clone(&self) -> Self {
5933                 let mut res = Vec::new();
5934                 if self.datalen == 0 { return Self::from(res); }
5935                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5936                 Self::from(res)
5937         }
5938 }
5939 #[repr(C)]
5940 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5941 /// This corresponds to std::vector in C++
5942 pub struct CVec_UpdateFailHTLCZ {
5943         /// The elements in the array.
5944         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5945         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
5946         /// The number of elements pointed to by `data`.
5947         pub datalen: usize
5948 }
5949 impl CVec_UpdateFailHTLCZ {
5950         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
5951                 if self.datalen == 0 { return Vec::new(); }
5952                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5953                 self.data = std::ptr::null_mut();
5954                 self.datalen = 0;
5955                 ret
5956         }
5957         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
5958                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5959         }
5960 }
5961 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
5962         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
5963                 let datalen = v.len();
5964                 let data = Box::into_raw(v.into_boxed_slice());
5965                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5966         }
5967 }
5968 #[no_mangle]
5969 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5970 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
5971 impl Drop for CVec_UpdateFailHTLCZ {
5972         fn drop(&mut self) {
5973                 if self.datalen == 0 { return; }
5974                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5975         }
5976 }
5977 impl Clone for CVec_UpdateFailHTLCZ {
5978         fn clone(&self) -> Self {
5979                 let mut res = Vec::new();
5980                 if self.datalen == 0 { return Self::from(res); }
5981                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5982                 Self::from(res)
5983         }
5984 }
5985 #[repr(C)]
5986 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5987 /// This corresponds to std::vector in C++
5988 pub struct CVec_UpdateFailMalformedHTLCZ {
5989         /// The elements in the array.
5990         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5991         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
5992         /// The number of elements pointed to by `data`.
5993         pub datalen: usize
5994 }
5995 impl CVec_UpdateFailMalformedHTLCZ {
5996         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
5997                 if self.datalen == 0 { return Vec::new(); }
5998                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5999                 self.data = std::ptr::null_mut();
6000                 self.datalen = 0;
6001                 ret
6002         }
6003         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
6004                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6005         }
6006 }
6007 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
6008         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
6009                 let datalen = v.len();
6010                 let data = Box::into_raw(v.into_boxed_slice());
6011                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6012         }
6013 }
6014 #[no_mangle]
6015 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6016 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
6017 impl Drop for CVec_UpdateFailMalformedHTLCZ {
6018         fn drop(&mut self) {
6019                 if self.datalen == 0 { return; }
6020                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6021         }
6022 }
6023 impl Clone for CVec_UpdateFailMalformedHTLCZ {
6024         fn clone(&self) -> Self {
6025                 let mut res = Vec::new();
6026                 if self.datalen == 0 { return Self::from(res); }
6027                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6028                 Self::from(res)
6029         }
6030 }
6031 #[repr(C)]
6032 /// The contents of CResult_AcceptChannelDecodeErrorZ
6033 pub union CResult_AcceptChannelDecodeErrorZPtr {
6034         /// A pointer to the contents in the success state.
6035         /// Reading from this pointer when `result_ok` is not set is undefined.
6036         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
6037         /// A pointer to the contents in the error state.
6038         /// Reading from this pointer when `result_ok` is set is undefined.
6039         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6040 }
6041 #[repr(C)]
6042 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6043 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6045 pub struct CResult_AcceptChannelDecodeErrorZ {
6046         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6047         /// `err` or `result` depending on the state of `result_ok`.
6048         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
6049         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6050         pub result_ok: bool,
6051 }
6052 #[no_mangle]
6053 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
6054 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
6055         CResult_AcceptChannelDecodeErrorZ {
6056                 contents: CResult_AcceptChannelDecodeErrorZPtr {
6057                         result: Box::into_raw(Box::new(o)),
6058                 },
6059                 result_ok: true,
6060         }
6061 }
6062 #[no_mangle]
6063 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
6064 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
6065         CResult_AcceptChannelDecodeErrorZ {
6066                 contents: CResult_AcceptChannelDecodeErrorZPtr {
6067                         err: Box::into_raw(Box::new(e)),
6068                 },
6069                 result_ok: false,
6070         }
6071 }
6072 #[no_mangle]
6073 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
6074 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
6075 impl Drop for CResult_AcceptChannelDecodeErrorZ {
6076         fn drop(&mut self) {
6077                 if self.result_ok {
6078                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6079                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6080                         }
6081                 } else {
6082                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6083                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6084                         }
6085                 }
6086         }
6087 }
6088 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
6089         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
6090                 let contents = if o.result_ok {
6091                         let result = unsafe { o.contents.result };
6092                         unsafe { o.contents.result = std::ptr::null_mut() };
6093                         CResult_AcceptChannelDecodeErrorZPtr { result }
6094                 } else {
6095                         let err = unsafe { o.contents.err };
6096                         unsafe { o.contents.err = std::ptr::null_mut(); }
6097                         CResult_AcceptChannelDecodeErrorZPtr { err }
6098                 };
6099                 Self {
6100                         contents,
6101                         result_ok: o.result_ok,
6102                 }
6103         }
6104 }
6105 impl Clone for CResult_AcceptChannelDecodeErrorZ {
6106         fn clone(&self) -> Self {
6107                 if self.result_ok {
6108                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
6109                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
6110                         } }
6111                 } else {
6112                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
6113                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6114                         } }
6115                 }
6116         }
6117 }
6118 #[no_mangle]
6119 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
6120 /// but with all dynamically-allocated buffers duplicated in new buffers.
6121 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
6122 #[repr(C)]
6123 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6124 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
6125         /// A pointer to the contents in the success state.
6126         /// Reading from this pointer when `result_ok` is not set is undefined.
6127         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
6128         /// A pointer to the contents in the error state.
6129         /// Reading from this pointer when `result_ok` is set is undefined.
6130         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6131 }
6132 #[repr(C)]
6133 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6134 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6136 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
6137         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6138         /// `err` or `result` depending on the state of `result_ok`.
6139         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
6140         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6141         pub result_ok: bool,
6142 }
6143 #[no_mangle]
6144 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
6145 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6146         CResult_AnnouncementSignaturesDecodeErrorZ {
6147                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6148                         result: Box::into_raw(Box::new(o)),
6149                 },
6150                 result_ok: true,
6151         }
6152 }
6153 #[no_mangle]
6154 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
6155 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6156         CResult_AnnouncementSignaturesDecodeErrorZ {
6157                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6158                         err: Box::into_raw(Box::new(e)),
6159                 },
6160                 result_ok: false,
6161         }
6162 }
6163 #[no_mangle]
6164 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
6165 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
6166 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
6167         fn drop(&mut self) {
6168                 if self.result_ok {
6169                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6170                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6171                         }
6172                 } else {
6173                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6174                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6175                         }
6176                 }
6177         }
6178 }
6179 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6180         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6181                 let contents = if o.result_ok {
6182                         let result = unsafe { o.contents.result };
6183                         unsafe { o.contents.result = std::ptr::null_mut() };
6184                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6185                 } else {
6186                         let err = unsafe { o.contents.err };
6187                         unsafe { o.contents.err = std::ptr::null_mut(); }
6188                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6189                 };
6190                 Self {
6191                         contents,
6192                         result_ok: o.result_ok,
6193                 }
6194         }
6195 }
6196 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6197         fn clone(&self) -> Self {
6198                 if self.result_ok {
6199                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6200                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6201                         } }
6202                 } else {
6203                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6204                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6205                         } }
6206                 }
6207         }
6208 }
6209 #[no_mangle]
6210 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6211 /// but with all dynamically-allocated buffers duplicated in new buffers.
6212 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6213 #[repr(C)]
6214 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6215 pub union CResult_ChannelReestablishDecodeErrorZPtr {
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::ChannelReestablish,
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_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6225 /// containing a crate::lightning::ln::msgs::ChannelReestablish 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_ChannelReestablishDecodeErrorZ {
6228         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6229         /// `err` or `result` depending on the state of `result_ok`.
6230         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6231         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6232         pub result_ok: bool,
6233 }
6234 #[no_mangle]
6235 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6236 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6237         CResult_ChannelReestablishDecodeErrorZ {
6238                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6239                         result: Box::into_raw(Box::new(o)),
6240                 },
6241                 result_ok: true,
6242         }
6243 }
6244 #[no_mangle]
6245 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6246 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6247         CResult_ChannelReestablishDecodeErrorZ {
6248                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
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_ChannelReestablishDecodeErrorZ.
6256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6257 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
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::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6271         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, 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_ChannelReestablishDecodeErrorZPtr { result }
6276                 } else {
6277                         let err = unsafe { o.contents.err };
6278                         unsafe { o.contents.err = std::ptr::null_mut(); }
6279                         CResult_ChannelReestablishDecodeErrorZPtr { err }
6280                 };
6281                 Self {
6282                         contents,
6283                         result_ok: o.result_ok,
6284                 }
6285         }
6286 }
6287 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6288         fn clone(&self) -> Self {
6289                 if self.result_ok {
6290                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6291                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6292                         } }
6293                 } else {
6294                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
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_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6302 /// but with all dynamically-allocated buffers duplicated in new buffers.
6303 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6304 #[repr(C)]
6305 /// The contents of CResult_ClosingSignedDecodeErrorZ
6306 pub union CResult_ClosingSignedDecodeErrorZPtr {
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::ClosingSigned,
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_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6316 /// containing a crate::lightning::ln::msgs::ClosingSigned 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_ClosingSignedDecodeErrorZ {
6319         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6320         /// `err` or `result` depending on the state of `result_ok`.
6321         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6322         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6323         pub result_ok: bool,
6324 }
6325 #[no_mangle]
6326 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6327 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6328         CResult_ClosingSignedDecodeErrorZ {
6329                 contents: CResult_ClosingSignedDecodeErrorZPtr {
6330                         result: Box::into_raw(Box::new(o)),
6331                 },
6332                 result_ok: true,
6333         }
6334 }
6335 #[no_mangle]
6336 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6337 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6338         CResult_ClosingSignedDecodeErrorZ {
6339                 contents: CResult_ClosingSignedDecodeErrorZPtr {
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_ClosingSignedDecodeErrorZ.
6347 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6348 impl Drop for CResult_ClosingSignedDecodeErrorZ {
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::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6362         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, 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_ClosingSignedDecodeErrorZPtr { result }
6367                 } else {
6368                         let err = unsafe { o.contents.err };
6369                         unsafe { o.contents.err = std::ptr::null_mut(); }
6370                         CResult_ClosingSignedDecodeErrorZPtr { err }
6371                 };
6372                 Self {
6373                         contents,
6374                         result_ok: o.result_ok,
6375                 }
6376         }
6377 }
6378 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6379         fn clone(&self) -> Self {
6380                 if self.result_ok {
6381                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6382                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6383                         } }
6384                 } else {
6385                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
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_ClosingSignedDecodeErrorZ which has the same data as `orig`
6393 /// but with all dynamically-allocated buffers duplicated in new buffers.
6394 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6395 #[repr(C)]
6396 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6397 pub union CResult_CommitmentSignedDecodeErrorZPtr {
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::CommitmentSigned,
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_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6407 /// containing a crate::lightning::ln::msgs::CommitmentSigned 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_CommitmentSignedDecodeErrorZ {
6410         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6411         /// `err` or `result` depending on the state of `result_ok`.
6412         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6413         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6414         pub result_ok: bool,
6415 }
6416 #[no_mangle]
6417 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6418 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6419         CResult_CommitmentSignedDecodeErrorZ {
6420                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6421                         result: Box::into_raw(Box::new(o)),
6422                 },
6423                 result_ok: true,
6424         }
6425 }
6426 #[no_mangle]
6427 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6428 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6429         CResult_CommitmentSignedDecodeErrorZ {
6430                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
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_CommitmentSignedDecodeErrorZ.
6438 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6439 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
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::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6453         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, 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_CommitmentSignedDecodeErrorZPtr { result }
6458                 } else {
6459                         let err = unsafe { o.contents.err };
6460                         unsafe { o.contents.err = std::ptr::null_mut(); }
6461                         CResult_CommitmentSignedDecodeErrorZPtr { err }
6462                 };
6463                 Self {
6464                         contents,
6465                         result_ok: o.result_ok,
6466                 }
6467         }
6468 }
6469 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6470         fn clone(&self) -> Self {
6471                 if self.result_ok {
6472                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6473                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6474                         } }
6475                 } else {
6476                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
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_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6484 /// but with all dynamically-allocated buffers duplicated in new buffers.
6485 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6486 #[repr(C)]
6487 /// The contents of CResult_FundingCreatedDecodeErrorZ
6488 pub union CResult_FundingCreatedDecodeErrorZPtr {
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::FundingCreated,
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_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6498 /// containing a crate::lightning::ln::msgs::FundingCreated 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_FundingCreatedDecodeErrorZ {
6501         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6502         /// `err` or `result` depending on the state of `result_ok`.
6503         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6504         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6505         pub result_ok: bool,
6506 }
6507 #[no_mangle]
6508 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6509 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6510         CResult_FundingCreatedDecodeErrorZ {
6511                 contents: CResult_FundingCreatedDecodeErrorZPtr {
6512                         result: Box::into_raw(Box::new(o)),
6513                 },
6514                 result_ok: true,
6515         }
6516 }
6517 #[no_mangle]
6518 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6519 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6520         CResult_FundingCreatedDecodeErrorZ {
6521                 contents: CResult_FundingCreatedDecodeErrorZPtr {
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_FundingCreatedDecodeErrorZ.
6529 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6530 impl Drop for CResult_FundingCreatedDecodeErrorZ {
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::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, 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_FundingCreatedDecodeErrorZPtr { result }
6549                 } else {
6550                         let err = unsafe { o.contents.err };
6551                         unsafe { o.contents.err = std::ptr::null_mut(); }
6552                         CResult_FundingCreatedDecodeErrorZPtr { err }
6553                 };
6554                 Self {
6555                         contents,
6556                         result_ok: o.result_ok,
6557                 }
6558         }
6559 }
6560 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6561         fn clone(&self) -> Self {
6562                 if self.result_ok {
6563                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6564                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6565                         } }
6566                 } else {
6567                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
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_FundingCreatedDecodeErrorZ which has the same data as `orig`
6575 /// but with all dynamically-allocated buffers duplicated in new buffers.
6576 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6577 #[repr(C)]
6578 /// The contents of CResult_FundingSignedDecodeErrorZ
6579 pub union CResult_FundingSignedDecodeErrorZPtr {
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::FundingSigned,
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_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6589 /// containing a crate::lightning::ln::msgs::FundingSigned 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_FundingSignedDecodeErrorZ {
6592         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6593         /// `err` or `result` depending on the state of `result_ok`.
6594         pub contents: CResult_FundingSignedDecodeErrorZPtr,
6595         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6596         pub result_ok: bool,
6597 }
6598 #[no_mangle]
6599 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6600 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6601         CResult_FundingSignedDecodeErrorZ {
6602                 contents: CResult_FundingSignedDecodeErrorZPtr {
6603                         result: Box::into_raw(Box::new(o)),
6604                 },
6605                 result_ok: true,
6606         }
6607 }
6608 #[no_mangle]
6609 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6610 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6611         CResult_FundingSignedDecodeErrorZ {
6612                 contents: CResult_FundingSignedDecodeErrorZPtr {
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_FundingSignedDecodeErrorZ.
6620 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6621 impl Drop for CResult_FundingSignedDecodeErrorZ {
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::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6635         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, 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_FundingSignedDecodeErrorZPtr { result }
6640                 } else {
6641                         let err = unsafe { o.contents.err };
6642                         unsafe { o.contents.err = std::ptr::null_mut(); }
6643                         CResult_FundingSignedDecodeErrorZPtr { err }
6644                 };
6645                 Self {
6646                         contents,
6647                         result_ok: o.result_ok,
6648                 }
6649         }
6650 }
6651 impl Clone for CResult_FundingSignedDecodeErrorZ {
6652         fn clone(&self) -> Self {
6653                 if self.result_ok {
6654                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6655                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6656                         } }
6657                 } else {
6658                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
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_FundingSignedDecodeErrorZ which has the same data as `orig`
6666 /// but with all dynamically-allocated buffers duplicated in new buffers.
6667 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6668 #[repr(C)]
6669 /// The contents of CResult_FundingLockedDecodeErrorZ
6670 pub union CResult_FundingLockedDecodeErrorZPtr {
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::FundingLocked,
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_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6680 /// containing a crate::lightning::ln::msgs::FundingLocked 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_FundingLockedDecodeErrorZ {
6683         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6684         /// `err` or `result` depending on the state of `result_ok`.
6685         pub contents: CResult_FundingLockedDecodeErrorZPtr,
6686         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6687         pub result_ok: bool,
6688 }
6689 #[no_mangle]
6690 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6691 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6692         CResult_FundingLockedDecodeErrorZ {
6693                 contents: CResult_FundingLockedDecodeErrorZPtr {
6694                         result: Box::into_raw(Box::new(o)),
6695                 },
6696                 result_ok: true,
6697         }
6698 }
6699 #[no_mangle]
6700 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6701 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6702         CResult_FundingLockedDecodeErrorZ {
6703                 contents: CResult_FundingLockedDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ.
6711 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6712 impl Drop for CResult_FundingLockedDecodeErrorZ {
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::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6726         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, 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_FundingLockedDecodeErrorZPtr { result }
6731                 } else {
6732                         let err = unsafe { o.contents.err };
6733                         unsafe { o.contents.err = std::ptr::null_mut(); }
6734                         CResult_FundingLockedDecodeErrorZPtr { err }
6735                 };
6736                 Self {
6737                         contents,
6738                         result_ok: o.result_ok,
6739                 }
6740         }
6741 }
6742 impl Clone for CResult_FundingLockedDecodeErrorZ {
6743         fn clone(&self) -> Self {
6744                 if self.result_ok {
6745                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6746                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6747                         } }
6748                 } else {
6749                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ which has the same data as `orig`
6757 /// but with all dynamically-allocated buffers duplicated in new buffers.
6758 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6759 #[repr(C)]
6760 /// The contents of CResult_InitDecodeErrorZ
6761 pub union CResult_InitDecodeErrorZPtr {
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::Init,
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_InitDecodeErrorZ represents the result of a fallible operation,
6771 /// containing a crate::lightning::ln::msgs::Init 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_InitDecodeErrorZ {
6774         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6775         /// `err` or `result` depending on the state of `result_ok`.
6776         pub contents: CResult_InitDecodeErrorZPtr,
6777         /// Whether this CResult_InitDecodeErrorZ represents a success state.
6778         pub result_ok: bool,
6779 }
6780 #[no_mangle]
6781 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6782 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6783         CResult_InitDecodeErrorZ {
6784                 contents: CResult_InitDecodeErrorZPtr {
6785                         result: Box::into_raw(Box::new(o)),
6786                 },
6787                 result_ok: true,
6788         }
6789 }
6790 #[no_mangle]
6791 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6792 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6793         CResult_InitDecodeErrorZ {
6794                 contents: CResult_InitDecodeErrorZPtr {
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_InitDecodeErrorZ.
6802 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6803 impl Drop for CResult_InitDecodeErrorZ {
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::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6817         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, 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_InitDecodeErrorZPtr { result }
6822                 } else {
6823                         let err = unsafe { o.contents.err };
6824                         unsafe { o.contents.err = std::ptr::null_mut(); }
6825                         CResult_InitDecodeErrorZPtr { err }
6826                 };
6827                 Self {
6828                         contents,
6829                         result_ok: o.result_ok,
6830                 }
6831         }
6832 }
6833 impl Clone for CResult_InitDecodeErrorZ {
6834         fn clone(&self) -> Self {
6835                 if self.result_ok {
6836                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
6837                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
6838                         } }
6839                 } else {
6840                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
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_InitDecodeErrorZ which has the same data as `orig`
6848 /// but with all dynamically-allocated buffers duplicated in new buffers.
6849 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
6850 #[repr(C)]
6851 /// The contents of CResult_OpenChannelDecodeErrorZ
6852 pub union CResult_OpenChannelDecodeErrorZPtr {
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::OpenChannel,
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_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6862 /// containing a crate::lightning::ln::msgs::OpenChannel 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_OpenChannelDecodeErrorZ {
6865         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6866         /// `err` or `result` depending on the state of `result_ok`.
6867         pub contents: CResult_OpenChannelDecodeErrorZPtr,
6868         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6869         pub result_ok: bool,
6870 }
6871 #[no_mangle]
6872 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
6873 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
6874         CResult_OpenChannelDecodeErrorZ {
6875                 contents: CResult_OpenChannelDecodeErrorZPtr {
6876                         result: Box::into_raw(Box::new(o)),
6877                 },
6878                 result_ok: true,
6879         }
6880 }
6881 #[no_mangle]
6882 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
6883 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
6884         CResult_OpenChannelDecodeErrorZ {
6885                 contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ.
6893 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
6894 impl Drop for CResult_OpenChannelDecodeErrorZ {
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::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
6908         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, 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_OpenChannelDecodeErrorZPtr { result }
6913                 } else {
6914                         let err = unsafe { o.contents.err };
6915                         unsafe { o.contents.err = std::ptr::null_mut(); }
6916                         CResult_OpenChannelDecodeErrorZPtr { err }
6917                 };
6918                 Self {
6919                         contents,
6920                         result_ok: o.result_ok,
6921                 }
6922         }
6923 }
6924 impl Clone for CResult_OpenChannelDecodeErrorZ {
6925         fn clone(&self) -> Self {
6926                 if self.result_ok {
6927                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
6928                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
6929                         } }
6930                 } else {
6931                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ which has the same data as `orig`
6939 /// but with all dynamically-allocated buffers duplicated in new buffers.
6940 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
6941 #[repr(C)]
6942 /// The contents of CResult_RevokeAndACKDecodeErrorZ
6943 pub union CResult_RevokeAndACKDecodeErrorZPtr {
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::RevokeAndACK,
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_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
6953 /// containing a crate::lightning::ln::msgs::RevokeAndACK 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_RevokeAndACKDecodeErrorZ {
6956         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
6957         /// `err` or `result` depending on the state of `result_ok`.
6958         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
6959         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
6960         pub result_ok: bool,
6961 }
6962 #[no_mangle]
6963 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
6964 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
6965         CResult_RevokeAndACKDecodeErrorZ {
6966                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
6967                         result: Box::into_raw(Box::new(o)),
6968                 },
6969                 result_ok: true,
6970         }
6971 }
6972 #[no_mangle]
6973 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
6974 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
6975         CResult_RevokeAndACKDecodeErrorZ {
6976                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ.
6984 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
6985 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
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::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
6999         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, 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_RevokeAndACKDecodeErrorZPtr { result }
7004                 } else {
7005                         let err = unsafe { o.contents.err };
7006                         unsafe { o.contents.err = std::ptr::null_mut(); }
7007                         CResult_RevokeAndACKDecodeErrorZPtr { err }
7008                 };
7009                 Self {
7010                         contents,
7011                         result_ok: o.result_ok,
7012                 }
7013         }
7014 }
7015 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
7016         fn clone(&self) -> Self {
7017                 if self.result_ok {
7018                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7019                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
7020                         } }
7021                 } else {
7022                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ which has the same data as `orig`
7030 /// but with all dynamically-allocated buffers duplicated in new buffers.
7031 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
7032 #[repr(C)]
7033 /// The contents of CResult_ShutdownDecodeErrorZ
7034 pub union CResult_ShutdownDecodeErrorZPtr {
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::Shutdown,
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_ShutdownDecodeErrorZ represents the result of a fallible operation,
7044 /// containing a crate::lightning::ln::msgs::Shutdown 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_ShutdownDecodeErrorZ {
7047         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7048         /// `err` or `result` depending on the state of `result_ok`.
7049         pub contents: CResult_ShutdownDecodeErrorZPtr,
7050         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7051         pub result_ok: bool,
7052 }
7053 #[no_mangle]
7054 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
7055 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
7056         CResult_ShutdownDecodeErrorZ {
7057                 contents: CResult_ShutdownDecodeErrorZPtr {
7058                         result: Box::into_raw(Box::new(o)),
7059                 },
7060                 result_ok: true,
7061         }
7062 }
7063 #[no_mangle]
7064 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
7065 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
7066         CResult_ShutdownDecodeErrorZ {
7067                 contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ.
7075 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
7076 impl Drop for CResult_ShutdownDecodeErrorZ {
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::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
7090         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, 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_ShutdownDecodeErrorZPtr { result }
7095                 } else {
7096                         let err = unsafe { o.contents.err };
7097                         unsafe { o.contents.err = std::ptr::null_mut(); }
7098                         CResult_ShutdownDecodeErrorZPtr { err }
7099                 };
7100                 Self {
7101                         contents,
7102                         result_ok: o.result_ok,
7103                 }
7104         }
7105 }
7106 impl Clone for CResult_ShutdownDecodeErrorZ {
7107         fn clone(&self) -> Self {
7108                 if self.result_ok {
7109                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
7110                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
7111                         } }
7112                 } else {
7113                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ which has the same data as `orig`
7121 /// but with all dynamically-allocated buffers duplicated in new buffers.
7122 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
7123 #[repr(C)]
7124 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
7125 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
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::UpdateFailHTLC,
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_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7135 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ {
7138         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7139         /// `err` or `result` depending on the state of `result_ok`.
7140         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
7141         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7142         pub result_ok: bool,
7143 }
7144 #[no_mangle]
7145 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
7146 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
7147         CResult_UpdateFailHTLCDecodeErrorZ {
7148                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7149                         result: Box::into_raw(Box::new(o)),
7150                 },
7151                 result_ok: true,
7152         }
7153 }
7154 #[no_mangle]
7155 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
7156 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
7157         CResult_UpdateFailHTLCDecodeErrorZ {
7158                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ.
7166 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
7167 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
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::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, 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_UpdateFailHTLCDecodeErrorZPtr { result }
7186                 } else {
7187                         let err = unsafe { o.contents.err };
7188                         unsafe { o.contents.err = std::ptr::null_mut(); }
7189                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7190                 };
7191                 Self {
7192                         contents,
7193                         result_ok: o.result_ok,
7194                 }
7195         }
7196 }
7197 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7198         fn clone(&self) -> Self {
7199                 if self.result_ok {
7200                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7201                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7202                         } }
7203                 } else {
7204                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7212 /// but with all dynamically-allocated buffers duplicated in new buffers.
7213 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7214 #[repr(C)]
7215 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7216 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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::UpdateFailMalformedHTLC,
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_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7226 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
7229         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7230         /// `err` or `result` depending on the state of `result_ok`.
7231         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7232         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7233         pub result_ok: bool,
7234 }
7235 #[no_mangle]
7236 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7237 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7238         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7239                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7240                         result: Box::into_raw(Box::new(o)),
7241                 },
7242                 result_ok: true,
7243         }
7244 }
7245 #[no_mangle]
7246 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7247 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7248         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7249                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ.
7257 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7258 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
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::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7272         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7277                 } else {
7278                         let err = unsafe { o.contents.err };
7279                         unsafe { o.contents.err = std::ptr::null_mut(); }
7280                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7281                 };
7282                 Self {
7283                         contents,
7284                         result_ok: o.result_ok,
7285                 }
7286         }
7287 }
7288 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7289         fn clone(&self) -> Self {
7290                 if self.result_ok {
7291                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7292                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7293                         } }
7294                 } else {
7295                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7303 /// but with all dynamically-allocated buffers duplicated in new buffers.
7304 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7305 #[repr(C)]
7306 /// The contents of CResult_UpdateFeeDecodeErrorZ
7307 pub union CResult_UpdateFeeDecodeErrorZPtr {
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::UpdateFee,
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_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7317 /// containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
7320         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7321         /// `err` or `result` depending on the state of `result_ok`.
7322         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7323         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7324         pub result_ok: bool,
7325 }
7326 #[no_mangle]
7327 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7328 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7329         CResult_UpdateFeeDecodeErrorZ {
7330                 contents: CResult_UpdateFeeDecodeErrorZPtr {
7331                         result: Box::into_raw(Box::new(o)),
7332                 },
7333                 result_ok: true,
7334         }
7335 }
7336 #[no_mangle]
7337 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7338 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7339         CResult_UpdateFeeDecodeErrorZ {
7340                 contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ.
7348 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7349 impl Drop for CResult_UpdateFeeDecodeErrorZ {
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::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7363         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, 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_UpdateFeeDecodeErrorZPtr { result }
7368                 } else {
7369                         let err = unsafe { o.contents.err };
7370                         unsafe { o.contents.err = std::ptr::null_mut(); }
7371                         CResult_UpdateFeeDecodeErrorZPtr { err }
7372                 };
7373                 Self {
7374                         contents,
7375                         result_ok: o.result_ok,
7376                 }
7377         }
7378 }
7379 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7380         fn clone(&self) -> Self {
7381                 if self.result_ok {
7382                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7383                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7384                         } }
7385                 } else {
7386                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ which has the same data as `orig`
7394 /// but with all dynamically-allocated buffers duplicated in new buffers.
7395 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7396 #[repr(C)]
7397 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7398 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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::UpdateFulfillHTLC,
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_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7408 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
7411         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7412         /// `err` or `result` depending on the state of `result_ok`.
7413         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7414         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7415         pub result_ok: bool,
7416 }
7417 #[no_mangle]
7418 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7419 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7420         CResult_UpdateFulfillHTLCDecodeErrorZ {
7421                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7422                         result: Box::into_raw(Box::new(o)),
7423                 },
7424                 result_ok: true,
7425         }
7426 }
7427 #[no_mangle]
7428 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7429 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7430         CResult_UpdateFulfillHTLCDecodeErrorZ {
7431                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ.
7439 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7440 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
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::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7454         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, 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_UpdateFulfillHTLCDecodeErrorZPtr { result }
7459                 } else {
7460                         let err = unsafe { o.contents.err };
7461                         unsafe { o.contents.err = std::ptr::null_mut(); }
7462                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7463                 };
7464                 Self {
7465                         contents,
7466                         result_ok: o.result_ok,
7467                 }
7468         }
7469 }
7470 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7471         fn clone(&self) -> Self {
7472                 if self.result_ok {
7473                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7474                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7475                         } }
7476                 } else {
7477                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7485 /// but with all dynamically-allocated buffers duplicated in new buffers.
7486 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7487 #[repr(C)]
7488 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7489 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
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::UpdateAddHTLC,
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_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7499 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
7502         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7503         /// `err` or `result` depending on the state of `result_ok`.
7504         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7505         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7506         pub result_ok: bool,
7507 }
7508 #[no_mangle]
7509 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7510 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7511         CResult_UpdateAddHTLCDecodeErrorZ {
7512                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7513                         result: Box::into_raw(Box::new(o)),
7514                 },
7515                 result_ok: true,
7516         }
7517 }
7518 #[no_mangle]
7519 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7520 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7521         CResult_UpdateAddHTLCDecodeErrorZ {
7522                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ.
7530 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7531 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
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::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, 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_UpdateAddHTLCDecodeErrorZPtr { result }
7550                 } else {
7551                         let err = unsafe { o.contents.err };
7552                         unsafe { o.contents.err = std::ptr::null_mut(); }
7553                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7554                 };
7555                 Self {
7556                         contents,
7557                         result_ok: o.result_ok,
7558                 }
7559         }
7560 }
7561 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7562         fn clone(&self) -> Self {
7563                 if self.result_ok {
7564                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7566                         } }
7567                 } else {
7568                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7576 /// but with all dynamically-allocated buffers duplicated in new buffers.
7577 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7578 #[repr(C)]
7579 /// The contents of CResult_PingDecodeErrorZ
7580 pub union CResult_PingDecodeErrorZPtr {
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::Ping,
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_PingDecodeErrorZ represents the result of a fallible operation,
7590 /// containing a crate::lightning::ln::msgs::Ping 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_PingDecodeErrorZ {
7593         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7594         /// `err` or `result` depending on the state of `result_ok`.
7595         pub contents: CResult_PingDecodeErrorZPtr,
7596         /// Whether this CResult_PingDecodeErrorZ represents a success state.
7597         pub result_ok: bool,
7598 }
7599 #[no_mangle]
7600 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7601 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7602         CResult_PingDecodeErrorZ {
7603                 contents: CResult_PingDecodeErrorZPtr {
7604                         result: Box::into_raw(Box::new(o)),
7605                 },
7606                 result_ok: true,
7607         }
7608 }
7609 #[no_mangle]
7610 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7611 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7612         CResult_PingDecodeErrorZ {
7613                 contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ.
7621 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7622 impl Drop for CResult_PingDecodeErrorZ {
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::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7636         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, 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_PingDecodeErrorZPtr { result }
7641                 } else {
7642                         let err = unsafe { o.contents.err };
7643                         unsafe { o.contents.err = std::ptr::null_mut(); }
7644                         CResult_PingDecodeErrorZPtr { err }
7645                 };
7646                 Self {
7647                         contents,
7648                         result_ok: o.result_ok,
7649                 }
7650         }
7651 }
7652 impl Clone for CResult_PingDecodeErrorZ {
7653         fn clone(&self) -> Self {
7654                 if self.result_ok {
7655                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7656                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7657                         } }
7658                 } else {
7659                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ which has the same data as `orig`
7667 /// but with all dynamically-allocated buffers duplicated in new buffers.
7668 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7669 #[repr(C)]
7670 /// The contents of CResult_PongDecodeErrorZ
7671 pub union CResult_PongDecodeErrorZPtr {
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::Pong,
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_PongDecodeErrorZ represents the result of a fallible operation,
7681 /// containing a crate::lightning::ln::msgs::Pong 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_PongDecodeErrorZ {
7684         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7685         /// `err` or `result` depending on the state of `result_ok`.
7686         pub contents: CResult_PongDecodeErrorZPtr,
7687         /// Whether this CResult_PongDecodeErrorZ represents a success state.
7688         pub result_ok: bool,
7689 }
7690 #[no_mangle]
7691 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7692 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7693         CResult_PongDecodeErrorZ {
7694                 contents: CResult_PongDecodeErrorZPtr {
7695                         result: Box::into_raw(Box::new(o)),
7696                 },
7697                 result_ok: true,
7698         }
7699 }
7700 #[no_mangle]
7701 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7702 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7703         CResult_PongDecodeErrorZ {
7704                 contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ.
7712 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7713 impl Drop for CResult_PongDecodeErrorZ {
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::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, 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_PongDecodeErrorZPtr { result }
7732                 } else {
7733                         let err = unsafe { o.contents.err };
7734                         unsafe { o.contents.err = std::ptr::null_mut(); }
7735                         CResult_PongDecodeErrorZPtr { err }
7736                 };
7737                 Self {
7738                         contents,
7739                         result_ok: o.result_ok,
7740                 }
7741         }
7742 }
7743 impl Clone for CResult_PongDecodeErrorZ {
7744         fn clone(&self) -> Self {
7745                 if self.result_ok {
7746                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7747                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7748                         } }
7749                 } else {
7750                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ which has the same data as `orig`
7758 /// but with all dynamically-allocated buffers duplicated in new buffers.
7759 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7760 #[repr(C)]
7761 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7762 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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::UnsignedChannelAnnouncement,
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_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7772 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ {
7775         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7776         /// `err` or `result` depending on the state of `result_ok`.
7777         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7778         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7779         pub result_ok: bool,
7780 }
7781 #[no_mangle]
7782 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7783 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7784         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7785                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7786                         result: Box::into_raw(Box::new(o)),
7787                 },
7788                 result_ok: true,
7789         }
7790 }
7791 #[no_mangle]
7792 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7793 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7794         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7795                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ.
7803 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7804 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
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::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7818         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
7823                 } else {
7824                         let err = unsafe { o.contents.err };
7825                         unsafe { o.contents.err = std::ptr::null_mut(); }
7826                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
7827                 };
7828                 Self {
7829                         contents,
7830                         result_ok: o.result_ok,
7831                 }
7832         }
7833 }
7834 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7835         fn clone(&self) -> Self {
7836                 if self.result_ok {
7837                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7838                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7839                         } }
7840                 } else {
7841                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7849 /// but with all dynamically-allocated buffers duplicated in new buffers.
7850 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
7851 #[repr(C)]
7852 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
7853 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
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::ChannelAnnouncement,
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_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7863 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ {
7866         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7867         /// `err` or `result` depending on the state of `result_ok`.
7868         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
7869         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7870         pub result_ok: bool,
7871 }
7872 #[no_mangle]
7873 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
7874 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
7875         CResult_ChannelAnnouncementDecodeErrorZ {
7876                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7877                         result: Box::into_raw(Box::new(o)),
7878                 },
7879                 result_ok: true,
7880         }
7881 }
7882 #[no_mangle]
7883 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
7884 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
7885         CResult_ChannelAnnouncementDecodeErrorZ {
7886                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ.
7894 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
7895 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
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::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
7909         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, 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_ChannelAnnouncementDecodeErrorZPtr { result }
7914                 } else {
7915                         let err = unsafe { o.contents.err };
7916                         unsafe { o.contents.err = std::ptr::null_mut(); }
7917                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
7918                 };
7919                 Self {
7920                         contents,
7921                         result_ok: o.result_ok,
7922                 }
7923         }
7924 }
7925 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
7926         fn clone(&self) -> Self {
7927                 if self.result_ok {
7928                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7929                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7930                         } }
7931                 } else {
7932                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7940 /// but with all dynamically-allocated buffers duplicated in new buffers.
7941 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
7942 #[repr(C)]
7943 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
7944 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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::UnsignedChannelUpdate,
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_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7954 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate 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_UnsignedChannelUpdateDecodeErrorZ {
7957         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
7958         /// `err` or `result` depending on the state of `result_ok`.
7959         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
7960         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
7961         pub result_ok: bool,
7962 }
7963 #[no_mangle]
7964 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
7965 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
7966         CResult_UnsignedChannelUpdateDecodeErrorZ {
7967                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7968                         result: Box::into_raw(Box::new(o)),
7969                 },
7970                 result_ok: true,
7971         }
7972 }
7973 #[no_mangle]
7974 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
7975 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
7976         CResult_UnsignedChannelUpdateDecodeErrorZ {
7977                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ.
7985 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
7986 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
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::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
8000         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, 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_UnsignedChannelUpdateDecodeErrorZPtr { result }
8005                 } else {
8006                         let err = unsafe { o.contents.err };
8007                         unsafe { o.contents.err = std::ptr::null_mut(); }
8008                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
8009                 };
8010                 Self {
8011                         contents,
8012                         result_ok: o.result_ok,
8013                 }
8014         }
8015 }
8016 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
8017         fn clone(&self) -> Self {
8018                 if self.result_ok {
8019                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8020                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
8021                         } }
8022                 } else {
8023                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
8031 /// but with all dynamically-allocated buffers duplicated in new buffers.
8032 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
8033 #[repr(C)]
8034 /// The contents of CResult_ChannelUpdateDecodeErrorZ
8035 pub union CResult_ChannelUpdateDecodeErrorZPtr {
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::ChannelUpdate,
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_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8045 /// containing a crate::lightning::ln::msgs::ChannelUpdate 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_ChannelUpdateDecodeErrorZ {
8048         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8049         /// `err` or `result` depending on the state of `result_ok`.
8050         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
8051         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8052         pub result_ok: bool,
8053 }
8054 #[no_mangle]
8055 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
8056 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
8057         CResult_ChannelUpdateDecodeErrorZ {
8058                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8059                         result: Box::into_raw(Box::new(o)),
8060                 },
8061                 result_ok: true,
8062         }
8063 }
8064 #[no_mangle]
8065 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
8066 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
8067         CResult_ChannelUpdateDecodeErrorZ {
8068                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
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_ChannelUpdateDecodeErrorZ.
8076 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
8077 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
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::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
8091         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, 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_ChannelUpdateDecodeErrorZPtr { result }
8096                 } else {
8097                         let err = unsafe { o.contents.err };
8098                         unsafe { o.contents.err = std::ptr::null_mut(); }
8099                         CResult_ChannelUpdateDecodeErrorZPtr { err }
8100                 };
8101                 Self {
8102                         contents,
8103                         result_ok: o.result_ok,
8104                 }
8105         }
8106 }
8107 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
8108         fn clone(&self) -> Self {
8109                 if self.result_ok {
8110                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8111                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
8112                         } }
8113                 } else {
8114                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
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_ChannelUpdateDecodeErrorZ which has the same data as `orig`
8122 /// but with all dynamically-allocated buffers duplicated in new buffers.
8123 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
8124 #[repr(C)]
8125 /// The contents of CResult_ErrorMessageDecodeErrorZ
8126 pub union CResult_ErrorMessageDecodeErrorZPtr {
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::ErrorMessage,
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_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8136 /// containing a crate::lightning::ln::msgs::ErrorMessage 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_ErrorMessageDecodeErrorZ {
8139         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8140         /// `err` or `result` depending on the state of `result_ok`.
8141         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
8142         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8143         pub result_ok: bool,
8144 }
8145 #[no_mangle]
8146 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
8147 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
8148         CResult_ErrorMessageDecodeErrorZ {
8149                 contents: CResult_ErrorMessageDecodeErrorZPtr {
8150                         result: Box::into_raw(Box::new(o)),
8151                 },
8152                 result_ok: true,
8153         }
8154 }
8155 #[no_mangle]
8156 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
8157 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
8158         CResult_ErrorMessageDecodeErrorZ {
8159                 contents: CResult_ErrorMessageDecodeErrorZPtr {
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_ErrorMessageDecodeErrorZ.
8167 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
8168 impl Drop for CResult_ErrorMessageDecodeErrorZ {
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::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8182         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, 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_ErrorMessageDecodeErrorZPtr { result }
8187                 } else {
8188                         let err = unsafe { o.contents.err };
8189                         unsafe { o.contents.err = std::ptr::null_mut(); }
8190                         CResult_ErrorMessageDecodeErrorZPtr { err }
8191                 };
8192                 Self {
8193                         contents,
8194                         result_ok: o.result_ok,
8195                 }
8196         }
8197 }
8198 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8199         fn clone(&self) -> Self {
8200                 if self.result_ok {
8201                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8202                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8203                         } }
8204                 } else {
8205                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
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_ErrorMessageDecodeErrorZ which has the same data as `orig`
8213 /// but with all dynamically-allocated buffers duplicated in new buffers.
8214 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8215 #[repr(C)]
8216 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8217 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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::UnsignedNodeAnnouncement,
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_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8227 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement 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_UnsignedNodeAnnouncementDecodeErrorZ {
8230         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8231         /// `err` or `result` depending on the state of `result_ok`.
8232         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8233         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8234         pub result_ok: bool,
8235 }
8236 #[no_mangle]
8237 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8238 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8239         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8240                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8241                         result: Box::into_raw(Box::new(o)),
8242                 },
8243                 result_ok: true,
8244         }
8245 }
8246 #[no_mangle]
8247 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8248 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8249         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8250                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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_UnsignedNodeAnnouncementDecodeErrorZ.
8258 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8259 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
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::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8273         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, 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_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8278                 } else {
8279                         let err = unsafe { o.contents.err };
8280                         unsafe { o.contents.err = std::ptr::null_mut(); }
8281                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8282                 };
8283                 Self {
8284                         contents,
8285                         result_ok: o.result_ok,
8286                 }
8287         }
8288 }
8289 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8290         fn clone(&self) -> Self {
8291                 if self.result_ok {
8292                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8293                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8294                         } }
8295                 } else {
8296                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8304 /// but with all dynamically-allocated buffers duplicated in new buffers.
8305 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8306 #[repr(C)]
8307 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8308 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
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::NodeAnnouncement,
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_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8318 /// containing a crate::lightning::ln::msgs::NodeAnnouncement 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_NodeAnnouncementDecodeErrorZ {
8321         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8322         /// `err` or `result` depending on the state of `result_ok`.
8323         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8324         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8325         pub result_ok: bool,
8326 }
8327 #[no_mangle]
8328 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8329 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8330         CResult_NodeAnnouncementDecodeErrorZ {
8331                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8332                         result: Box::into_raw(Box::new(o)),
8333                 },
8334                 result_ok: true,
8335         }
8336 }
8337 #[no_mangle]
8338 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8339 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8340         CResult_NodeAnnouncementDecodeErrorZ {
8341                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
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_NodeAnnouncementDecodeErrorZ.
8349 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8350 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
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::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8364         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, 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_NodeAnnouncementDecodeErrorZPtr { result }
8369                 } else {
8370                         let err = unsafe { o.contents.err };
8371                         unsafe { o.contents.err = std::ptr::null_mut(); }
8372                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
8373                 };
8374                 Self {
8375                         contents,
8376                         result_ok: o.result_ok,
8377                 }
8378         }
8379 }
8380 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8381         fn clone(&self) -> Self {
8382                 if self.result_ok {
8383                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8384                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8385                         } }
8386                 } else {
8387                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
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_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8395 /// but with all dynamically-allocated buffers duplicated in new buffers.
8396 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8397 #[repr(C)]
8398 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8399 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
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::QueryShortChannelIds,
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_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8409 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds 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_QueryShortChannelIdsDecodeErrorZ {
8412         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8413         /// `err` or `result` depending on the state of `result_ok`.
8414         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8415         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8416         pub result_ok: bool,
8417 }
8418 #[no_mangle]
8419 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8420 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8421         CResult_QueryShortChannelIdsDecodeErrorZ {
8422                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8423                         result: Box::into_raw(Box::new(o)),
8424                 },
8425                 result_ok: true,
8426         }
8427 }
8428 #[no_mangle]
8429 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8430 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8431         CResult_QueryShortChannelIdsDecodeErrorZ {
8432                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
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_QueryShortChannelIdsDecodeErrorZ.
8440 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8441 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
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::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8455         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, 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_QueryShortChannelIdsDecodeErrorZPtr { result }
8460                 } else {
8461                         let err = unsafe { o.contents.err };
8462                         unsafe { o.contents.err = std::ptr::null_mut(); }
8463                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8464                 };
8465                 Self {
8466                         contents,
8467                         result_ok: o.result_ok,
8468                 }
8469         }
8470 }
8471 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8472         fn clone(&self) -> Self {
8473                 if self.result_ok {
8474                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8475                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8476                         } }
8477                 } else {
8478                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
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_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8486 /// but with all dynamically-allocated buffers duplicated in new buffers.
8487 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8488 #[repr(C)]
8489 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8490 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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::ReplyShortChannelIdsEnd,
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_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8500 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd 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_ReplyShortChannelIdsEndDecodeErrorZ {
8503         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8504         /// `err` or `result` depending on the state of `result_ok`.
8505         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8506         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8507         pub result_ok: bool,
8508 }
8509 #[no_mangle]
8510 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8511 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8512         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8513                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8514                         result: Box::into_raw(Box::new(o)),
8515                 },
8516                 result_ok: true,
8517         }
8518 }
8519 #[no_mangle]
8520 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8521 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8522         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8523                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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_ReplyShortChannelIdsEndDecodeErrorZ.
8531 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8532 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
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::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8546         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, 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_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8551                 } else {
8552                         let err = unsafe { o.contents.err };
8553                         unsafe { o.contents.err = std::ptr::null_mut(); }
8554                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8555                 };
8556                 Self {
8557                         contents,
8558                         result_ok: o.result_ok,
8559                 }
8560         }
8561 }
8562 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8563         fn clone(&self) -> Self {
8564                 if self.result_ok {
8565                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8566                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8567                         } }
8568                 } else {
8569                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8577 /// but with all dynamically-allocated buffers duplicated in new buffers.
8578 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8579 #[repr(C)]
8580 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8581 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
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::QueryChannelRange,
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_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8591 /// containing a crate::lightning::ln::msgs::QueryChannelRange 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_QueryChannelRangeDecodeErrorZ {
8594         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8595         /// `err` or `result` depending on the state of `result_ok`.
8596         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8597         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8598         pub result_ok: bool,
8599 }
8600 #[no_mangle]
8601 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8602 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8603         CResult_QueryChannelRangeDecodeErrorZ {
8604                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8605                         result: Box::into_raw(Box::new(o)),
8606                 },
8607                 result_ok: true,
8608         }
8609 }
8610 #[no_mangle]
8611 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8612 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8613         CResult_QueryChannelRangeDecodeErrorZ {
8614                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
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_QueryChannelRangeDecodeErrorZ.
8622 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8623 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
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::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8637         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, 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_QueryChannelRangeDecodeErrorZPtr { result }
8642                 } else {
8643                         let err = unsafe { o.contents.err };
8644                         unsafe { o.contents.err = std::ptr::null_mut(); }
8645                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
8646                 };
8647                 Self {
8648                         contents,
8649                         result_ok: o.result_ok,
8650                 }
8651         }
8652 }
8653 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8654         fn clone(&self) -> Self {
8655                 if self.result_ok {
8656                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8657                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8658                         } }
8659                 } else {
8660                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
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_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8668 /// but with all dynamically-allocated buffers duplicated in new buffers.
8669 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8670 #[repr(C)]
8671 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8672 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
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::ReplyChannelRange,
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_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8682 /// containing a crate::lightning::ln::msgs::ReplyChannelRange 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_ReplyChannelRangeDecodeErrorZ {
8685         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8686         /// `err` or `result` depending on the state of `result_ok`.
8687         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8688         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8689         pub result_ok: bool,
8690 }
8691 #[no_mangle]
8692 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8693 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8694         CResult_ReplyChannelRangeDecodeErrorZ {
8695                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8696                         result: Box::into_raw(Box::new(o)),
8697                 },
8698                 result_ok: true,
8699         }
8700 }
8701 #[no_mangle]
8702 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8703 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8704         CResult_ReplyChannelRangeDecodeErrorZ {
8705                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
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_ReplyChannelRangeDecodeErrorZ.
8713 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8714 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
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::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8728         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, 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_ReplyChannelRangeDecodeErrorZPtr { result }
8733                 } else {
8734                         let err = unsafe { o.contents.err };
8735                         unsafe { o.contents.err = std::ptr::null_mut(); }
8736                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8737                 };
8738                 Self {
8739                         contents,
8740                         result_ok: o.result_ok,
8741                 }
8742         }
8743 }
8744 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8745         fn clone(&self) -> Self {
8746                 if self.result_ok {
8747                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8748                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8749                         } }
8750                 } else {
8751                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
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_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8759 /// but with all dynamically-allocated buffers duplicated in new buffers.
8760 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8761 #[repr(C)]
8762 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8763 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
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::GossipTimestampFilter,
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_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8773 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter 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_GossipTimestampFilterDecodeErrorZ {
8776         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8777         /// `err` or `result` depending on the state of `result_ok`.
8778         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8779         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8780         pub result_ok: bool,
8781 }
8782 #[no_mangle]
8783 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8784 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8785         CResult_GossipTimestampFilterDecodeErrorZ {
8786                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8787                         result: Box::into_raw(Box::new(o)),
8788                 },
8789                 result_ok: true,
8790         }
8791 }
8792 #[no_mangle]
8793 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8794 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8795         CResult_GossipTimestampFilterDecodeErrorZ {
8796                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
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_GossipTimestampFilterDecodeErrorZ.
8804 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8805 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
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::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
8819         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, 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_GossipTimestampFilterDecodeErrorZPtr { result }
8824                 } else {
8825                         let err = unsafe { o.contents.err };
8826                         unsafe { o.contents.err = std::ptr::null_mut(); }
8827                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
8828                 };
8829                 Self {
8830                         contents,
8831                         result_ok: o.result_ok,
8832                 }
8833         }
8834 }
8835 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
8836         fn clone(&self) -> Self {
8837                 if self.result_ok {
8838                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8839                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
8840                         } }
8841                 } else {
8842                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
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_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
8850 /// but with all dynamically-allocated buffers duplicated in new buffers.
8851 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
8852 #[repr(C)]
8853 /// The contents of CResult_InvoiceSignOrCreationErrorZ
8854 pub union CResult_InvoiceSignOrCreationErrorZPtr {
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_invoice::Invoice,
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_invoice::SignOrCreationError,
8861 }
8862 #[repr(C)]
8863 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
8864 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
8865 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8866 pub struct CResult_InvoiceSignOrCreationErrorZ {
8867         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
8868         /// `err` or `result` depending on the state of `result_ok`.
8869         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
8870         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
8871         pub result_ok: bool,
8872 }
8873 #[no_mangle]
8874 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
8875 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
8876         CResult_InvoiceSignOrCreationErrorZ {
8877                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
8878                         result: Box::into_raw(Box::new(o)),
8879                 },
8880                 result_ok: true,
8881         }
8882 }
8883 #[no_mangle]
8884 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
8885 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
8886         CResult_InvoiceSignOrCreationErrorZ {
8887                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
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_InvoiceSignOrCreationErrorZ.
8895 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
8896 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
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_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
8910         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> 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_InvoiceSignOrCreationErrorZPtr { result }
8915                 } else {
8916                         let err = unsafe { o.contents.err };
8917                         unsafe { o.contents.err = std::ptr::null_mut(); }
8918                         CResult_InvoiceSignOrCreationErrorZPtr { err }
8919                 };
8920                 Self {
8921                         contents,
8922                         result_ok: o.result_ok,
8923                 }
8924         }
8925 }
8926 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
8927         fn clone(&self) -> Self {
8928                 if self.result_ok {
8929                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
8930                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8931                         } }
8932                 } else {
8933                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
8934                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
8935                         } }
8936                 }
8937         }
8938 }
8939 #[no_mangle]
8940 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
8941 /// but with all dynamically-allocated buffers duplicated in new buffers.
8942 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { orig.clone() }
8943 #[repr(C)]
8944 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
8945 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
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::chain::keysinterface::SpendableOutputDescriptor,
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_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
8955 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor 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_SpendableOutputDescriptorDecodeErrorZ {
8958         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
8959         /// `err` or `result` depending on the state of `result_ok`.
8960         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
8961         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
8962         pub result_ok: bool,
8963 }
8964 #[no_mangle]
8965 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
8966 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
8967         CResult_SpendableOutputDescriptorDecodeErrorZ {
8968                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8969                         result: Box::into_raw(Box::new(o)),
8970                 },
8971                 result_ok: true,
8972         }
8973 }
8974 #[no_mangle]
8975 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
8976 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
8977         CResult_SpendableOutputDescriptorDecodeErrorZ {
8978                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
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_SpendableOutputDescriptorDecodeErrorZ.
8986 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
8987 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
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::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
9001         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, 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_SpendableOutputDescriptorDecodeErrorZPtr { result }
9006                 } else {
9007                         let err = unsafe { o.contents.err };
9008                         unsafe { o.contents.err = std::ptr::null_mut(); }
9009                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
9010                 };
9011                 Self {
9012                         contents,
9013                         result_ok: o.result_ok,
9014                 }
9015         }
9016 }
9017 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
9018         fn clone(&self) -> Self {
9019                 if self.result_ok {
9020                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
9021                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
9022                         } }
9023                 } else {
9024                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
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_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9032 /// but with all dynamically-allocated buffers duplicated in new buffers.
9033 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
9034 #[repr(C)]
9035 /// A tuple of 2 elements. See the individual fields for the types contained.
9036 pub struct C2Tuple_SignatureCVec_SignatureZZ {
9037         /// The element at position 0
9038         pub a: crate::c_types::Signature,
9039         /// The element at position 1
9040         pub b: crate::c_types::derived::CVec_SignatureZ,
9041 }
9042 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
9043         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
9044                 Self {
9045                         a: tup.0,
9046                         b: tup.1,
9047                 }
9048         }
9049 }
9050 impl C2Tuple_SignatureCVec_SignatureZZ {
9051         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
9052                 (self.a, self.b)
9053         }
9054 }
9055 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
9056         fn clone(&self) -> Self {
9057                 Self {
9058                         a: self.a.clone(),
9059                         b: self.b.clone(),
9060                 }
9061         }
9062 }
9063 #[no_mangle]
9064 /// Creates a new tuple which has the same data as `orig`
9065 /// but with all dynamically-allocated buffers duplicated in new buffers.
9066 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
9067 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9068 #[no_mangle]
9069 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
9070         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
9071 }
9072
9073 #[no_mangle]
9074 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9075 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
9076 #[repr(C)]
9077 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
9078 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9079         /// A pointer to the contents in the success state.
9080         /// Reading from this pointer when `result_ok` is not set is undefined.
9081         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
9082         /// Note that this value is always NULL, as there are no contents in the Err variant
9083         pub err: *mut std::ffi::c_void,
9084 }
9085 #[repr(C)]
9086 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
9087 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
9088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9089 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9090         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
9091         /// `err` or `result` depending on the state of `result_ok`.
9092         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
9093         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
9094         pub result_ok: bool,
9095 }
9096 #[no_mangle]
9097 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9098 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9099         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9100                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9101                         result: Box::into_raw(Box::new(o)),
9102                 },
9103                 result_ok: true,
9104         }
9105 }
9106 #[no_mangle]
9107 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9108 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9109         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9110                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9111                         err: std::ptr::null_mut(),
9112                 },
9113                 result_ok: false,
9114         }
9115 }
9116 #[no_mangle]
9117 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9118 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
9119 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9120         fn drop(&mut self) {
9121                 if self.result_ok {
9122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9124                         }
9125                 } else {
9126                 }
9127         }
9128 }
9129 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9130         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
9131                 let contents = if o.result_ok {
9132                         let result = unsafe { o.contents.result };
9133                         unsafe { o.contents.result = std::ptr::null_mut() };
9134                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
9135                 } else {
9136                         let _ = unsafe { Box::from_raw(o.contents.err) };
9137                         o.contents.err = std::ptr::null_mut();
9138                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
9139                 };
9140                 Self {
9141                         contents,
9142                         result_ok: o.result_ok,
9143                 }
9144         }
9145 }
9146 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
9147         fn clone(&self) -> Self {
9148                 if self.result_ok {
9149                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9150                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
9151                         } }
9152                 } else {
9153                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
9154                                 err: std::ptr::null_mut()
9155                         } }
9156                 }
9157         }
9158 }
9159 #[no_mangle]
9160 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9161 /// but with all dynamically-allocated buffers duplicated in new buffers.
9162 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
9163 #[repr(C)]
9164 /// The contents of CResult_SignatureNoneZ
9165 pub union CResult_SignatureNoneZPtr {
9166         /// A pointer to the contents in the success state.
9167         /// Reading from this pointer when `result_ok` is not set is undefined.
9168         pub result: *mut crate::c_types::Signature,
9169         /// Note that this value is always NULL, as there are no contents in the Err variant
9170         pub err: *mut std::ffi::c_void,
9171 }
9172 #[repr(C)]
9173 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
9174 /// containing a crate::c_types::Signature on success and a () on failure.
9175 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9176 pub struct CResult_SignatureNoneZ {
9177         /// The contents of this CResult_SignatureNoneZ, accessible via either
9178         /// `err` or `result` depending on the state of `result_ok`.
9179         pub contents: CResult_SignatureNoneZPtr,
9180         /// Whether this CResult_SignatureNoneZ represents a success state.
9181         pub result_ok: bool,
9182 }
9183 #[no_mangle]
9184 /// Creates a new CResult_SignatureNoneZ in the success state.
9185 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
9186         CResult_SignatureNoneZ {
9187                 contents: CResult_SignatureNoneZPtr {
9188                         result: Box::into_raw(Box::new(o)),
9189                 },
9190                 result_ok: true,
9191         }
9192 }
9193 #[no_mangle]
9194 /// Creates a new CResult_SignatureNoneZ in the error state.
9195 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
9196         CResult_SignatureNoneZ {
9197                 contents: CResult_SignatureNoneZPtr {
9198                         err: std::ptr::null_mut(),
9199                 },
9200                 result_ok: false,
9201         }
9202 }
9203 #[no_mangle]
9204 /// Frees any resources used by the CResult_SignatureNoneZ.
9205 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
9206 impl Drop for CResult_SignatureNoneZ {
9207         fn drop(&mut self) {
9208                 if self.result_ok {
9209                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9210                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9211                         }
9212                 } else {
9213                 }
9214         }
9215 }
9216 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
9217         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
9218                 let contents = if o.result_ok {
9219                         let result = unsafe { o.contents.result };
9220                         unsafe { o.contents.result = std::ptr::null_mut() };
9221                         CResult_SignatureNoneZPtr { result }
9222                 } else {
9223                         let _ = unsafe { Box::from_raw(o.contents.err) };
9224                         o.contents.err = std::ptr::null_mut();
9225                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
9226                 };
9227                 Self {
9228                         contents,
9229                         result_ok: o.result_ok,
9230                 }
9231         }
9232 }
9233 impl Clone for CResult_SignatureNoneZ {
9234         fn clone(&self) -> Self {
9235                 if self.result_ok {
9236                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
9237                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
9238                         } }
9239                 } else {
9240                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
9241                                 err: std::ptr::null_mut()
9242                         } }
9243                 }
9244         }
9245 }
9246 #[no_mangle]
9247 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9248 /// but with all dynamically-allocated buffers duplicated in new buffers.
9249 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
9250 #[repr(C)]
9251 /// The contents of CResult_SignDecodeErrorZ
9252 pub union CResult_SignDecodeErrorZPtr {
9253         /// A pointer to the contents in the success state.
9254         /// Reading from this pointer when `result_ok` is not set is undefined.
9255         pub result: *mut crate::lightning::chain::keysinterface::Sign,
9256         /// A pointer to the contents in the error state.
9257         /// Reading from this pointer when `result_ok` is set is undefined.
9258         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9259 }
9260 #[repr(C)]
9261 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
9262 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
9263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9264 pub struct CResult_SignDecodeErrorZ {
9265         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
9266         /// `err` or `result` depending on the state of `result_ok`.
9267         pub contents: CResult_SignDecodeErrorZPtr,
9268         /// Whether this CResult_SignDecodeErrorZ represents a success state.
9269         pub result_ok: bool,
9270 }
9271 #[no_mangle]
9272 /// Creates a new CResult_SignDecodeErrorZ in the success state.
9273 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
9274         CResult_SignDecodeErrorZ {
9275                 contents: CResult_SignDecodeErrorZPtr {
9276                         result: Box::into_raw(Box::new(o)),
9277                 },
9278                 result_ok: true,
9279         }
9280 }
9281 #[no_mangle]
9282 /// Creates a new CResult_SignDecodeErrorZ in the error state.
9283 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
9284         CResult_SignDecodeErrorZ {
9285                 contents: CResult_SignDecodeErrorZPtr {
9286                         err: Box::into_raw(Box::new(e)),
9287                 },
9288                 result_ok: false,
9289         }
9290 }
9291 #[no_mangle]
9292 /// Frees any resources used by the CResult_SignDecodeErrorZ.
9293 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
9294 impl Drop for CResult_SignDecodeErrorZ {
9295         fn drop(&mut self) {
9296                 if self.result_ok {
9297                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9298                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9299                         }
9300                 } else {
9301                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9302                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9303                         }
9304                 }
9305         }
9306 }
9307 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
9308         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
9309                 let contents = if o.result_ok {
9310                         let result = unsafe { o.contents.result };
9311                         unsafe { o.contents.result = std::ptr::null_mut() };
9312                         CResult_SignDecodeErrorZPtr { result }
9313                 } else {
9314                         let err = unsafe { o.contents.err };
9315                         unsafe { o.contents.err = std::ptr::null_mut(); }
9316                         CResult_SignDecodeErrorZPtr { err }
9317                 };
9318                 Self {
9319                         contents,
9320                         result_ok: o.result_ok,
9321                 }
9322         }
9323 }
9324 impl Clone for CResult_SignDecodeErrorZ {
9325         fn clone(&self) -> Self {
9326                 if self.result_ok {
9327                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
9328                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
9329                         } }
9330                 } else {
9331                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
9332                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9333                         } }
9334                 }
9335         }
9336 }
9337 #[no_mangle]
9338 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9339 /// but with all dynamically-allocated buffers duplicated in new buffers.
9340 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
9341 #[repr(C)]
9342 /// The contents of CResult_RecoverableSignatureNoneZ
9343 pub union CResult_RecoverableSignatureNoneZPtr {
9344         /// A pointer to the contents in the success state.
9345         /// Reading from this pointer when `result_ok` is not set is undefined.
9346         pub result: *mut crate::c_types::RecoverableSignature,
9347         /// Note that this value is always NULL, as there are no contents in the Err variant
9348         pub err: *mut std::ffi::c_void,
9349 }
9350 #[repr(C)]
9351 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
9352 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
9353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9354 pub struct CResult_RecoverableSignatureNoneZ {
9355         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
9356         /// `err` or `result` depending on the state of `result_ok`.
9357         pub contents: CResult_RecoverableSignatureNoneZPtr,
9358         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
9359         pub result_ok: bool,
9360 }
9361 #[no_mangle]
9362 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
9363 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
9364         CResult_RecoverableSignatureNoneZ {
9365                 contents: CResult_RecoverableSignatureNoneZPtr {
9366                         result: Box::into_raw(Box::new(o)),
9367                 },
9368                 result_ok: true,
9369         }
9370 }
9371 #[no_mangle]
9372 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
9373 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
9374         CResult_RecoverableSignatureNoneZ {
9375                 contents: CResult_RecoverableSignatureNoneZPtr {
9376                         err: std::ptr::null_mut(),
9377                 },
9378                 result_ok: false,
9379         }
9380 }
9381 #[no_mangle]
9382 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
9383 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
9384 impl Drop for CResult_RecoverableSignatureNoneZ {
9385         fn drop(&mut self) {
9386                 if self.result_ok {
9387                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9388                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9389                         }
9390                 } else {
9391                 }
9392         }
9393 }
9394 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
9395         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
9396                 let contents = if o.result_ok {
9397                         let result = unsafe { o.contents.result };
9398                         unsafe { o.contents.result = std::ptr::null_mut() };
9399                         CResult_RecoverableSignatureNoneZPtr { result }
9400                 } else {
9401                         let _ = unsafe { Box::from_raw(o.contents.err) };
9402                         o.contents.err = std::ptr::null_mut();
9403                         CResult_RecoverableSignatureNoneZPtr { err: std::ptr::null_mut() }
9404                 };
9405                 Self {
9406                         contents,
9407                         result_ok: o.result_ok,
9408                 }
9409         }
9410 }
9411 impl Clone for CResult_RecoverableSignatureNoneZ {
9412         fn clone(&self) -> Self {
9413                 if self.result_ok {
9414                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
9415                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
9416                         } }
9417                 } else {
9418                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
9419                                 err: std::ptr::null_mut()
9420                         } }
9421                 }
9422         }
9423 }
9424 #[no_mangle]
9425 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
9426 /// but with all dynamically-allocated buffers duplicated in new buffers.
9427 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { orig.clone() }
9428 #[repr(C)]
9429 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
9430 /// This corresponds to std::vector in C++
9431 pub struct CVec_CVec_u8ZZ {
9432         /// The elements in the array.
9433         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9434         pub data: *mut crate::c_types::derived::CVec_u8Z,
9435         /// The number of elements pointed to by `data`.
9436         pub datalen: usize
9437 }
9438 impl CVec_CVec_u8ZZ {
9439         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
9440                 if self.datalen == 0 { return Vec::new(); }
9441                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9442                 self.data = std::ptr::null_mut();
9443                 self.datalen = 0;
9444                 ret
9445         }
9446         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
9447                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9448         }
9449 }
9450 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
9451         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
9452                 let datalen = v.len();
9453                 let data = Box::into_raw(v.into_boxed_slice());
9454                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9455         }
9456 }
9457 #[no_mangle]
9458 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9459 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
9460 impl Drop for CVec_CVec_u8ZZ {
9461         fn drop(&mut self) {
9462                 if self.datalen == 0 { return; }
9463                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9464         }
9465 }
9466 impl Clone for CVec_CVec_u8ZZ {
9467         fn clone(&self) -> Self {
9468                 let mut res = Vec::new();
9469                 if self.datalen == 0 { return Self::from(res); }
9470                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9471                 Self::from(res)
9472         }
9473 }
9474 #[repr(C)]
9475 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
9476 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
9477         /// A pointer to the contents in the success state.
9478         /// Reading from this pointer when `result_ok` is not set is undefined.
9479         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
9480         /// Note that this value is always NULL, as there are no contents in the Err variant
9481         pub err: *mut std::ffi::c_void,
9482 }
9483 #[repr(C)]
9484 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
9485 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
9486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9487 pub struct CResult_CVec_CVec_u8ZZNoneZ {
9488         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
9489         /// `err` or `result` depending on the state of `result_ok`.
9490         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
9491         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
9492         pub result_ok: bool,
9493 }
9494 #[no_mangle]
9495 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9496 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
9497         CResult_CVec_CVec_u8ZZNoneZ {
9498                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9499                         result: Box::into_raw(Box::new(o)),
9500                 },
9501                 result_ok: true,
9502         }
9503 }
9504 #[no_mangle]
9505 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9506 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
9507         CResult_CVec_CVec_u8ZZNoneZ {
9508                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9509                         err: std::ptr::null_mut(),
9510                 },
9511                 result_ok: false,
9512         }
9513 }
9514 #[no_mangle]
9515 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9516 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
9517 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
9518         fn drop(&mut self) {
9519                 if self.result_ok {
9520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9522                         }
9523                 } else {
9524                 }
9525         }
9526 }
9527 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
9528         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
9529                 let contents = if o.result_ok {
9530                         let result = unsafe { o.contents.result };
9531                         unsafe { o.contents.result = std::ptr::null_mut() };
9532                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
9533                 } else {
9534                         let _ = unsafe { Box::from_raw(o.contents.err) };
9535                         o.contents.err = std::ptr::null_mut();
9536                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
9537                 };
9538                 Self {
9539                         contents,
9540                         result_ok: o.result_ok,
9541                 }
9542         }
9543 }
9544 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
9545         fn clone(&self) -> Self {
9546                 if self.result_ok {
9547                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9548                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
9549                         } }
9550                 } else {
9551                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9552                                 err: std::ptr::null_mut()
9553                         } }
9554                 }
9555         }
9556 }
9557 #[no_mangle]
9558 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9559 /// but with all dynamically-allocated buffers duplicated in new buffers.
9560 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
9561 #[repr(C)]
9562 /// The contents of CResult_InMemorySignerDecodeErrorZ
9563 pub union CResult_InMemorySignerDecodeErrorZPtr {
9564         /// A pointer to the contents in the success state.
9565         /// Reading from this pointer when `result_ok` is not set is undefined.
9566         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
9567         /// A pointer to the contents in the error state.
9568         /// Reading from this pointer when `result_ok` is set is undefined.
9569         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9570 }
9571 #[repr(C)]
9572 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
9573 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
9574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9575 pub struct CResult_InMemorySignerDecodeErrorZ {
9576         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
9577         /// `err` or `result` depending on the state of `result_ok`.
9578         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
9579         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
9580         pub result_ok: bool,
9581 }
9582 #[no_mangle]
9583 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9584 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
9585         CResult_InMemorySignerDecodeErrorZ {
9586                 contents: CResult_InMemorySignerDecodeErrorZPtr {
9587                         result: Box::into_raw(Box::new(o)),
9588                 },
9589                 result_ok: true,
9590         }
9591 }
9592 #[no_mangle]
9593 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9594 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
9595         CResult_InMemorySignerDecodeErrorZ {
9596                 contents: CResult_InMemorySignerDecodeErrorZPtr {
9597                         err: Box::into_raw(Box::new(e)),
9598                 },
9599                 result_ok: false,
9600         }
9601 }
9602 #[no_mangle]
9603 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9604 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
9605 impl Drop for CResult_InMemorySignerDecodeErrorZ {
9606         fn drop(&mut self) {
9607                 if self.result_ok {
9608                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9609                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9610                         }
9611                 } else {
9612                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9613                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9614                         }
9615                 }
9616         }
9617 }
9618 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
9619         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
9620                 let contents = if o.result_ok {
9621                         let result = unsafe { o.contents.result };
9622                         unsafe { o.contents.result = std::ptr::null_mut() };
9623                         CResult_InMemorySignerDecodeErrorZPtr { result }
9624                 } else {
9625                         let err = unsafe { o.contents.err };
9626                         unsafe { o.contents.err = std::ptr::null_mut(); }
9627                         CResult_InMemorySignerDecodeErrorZPtr { err }
9628                 };
9629                 Self {
9630                         contents,
9631                         result_ok: o.result_ok,
9632                 }
9633         }
9634 }
9635 impl Clone for CResult_InMemorySignerDecodeErrorZ {
9636         fn clone(&self) -> Self {
9637                 if self.result_ok {
9638                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
9639                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
9640                         } }
9641                 } else {
9642                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
9643                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9644                         } }
9645                 }
9646         }
9647 }
9648 #[no_mangle]
9649 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9650 /// but with all dynamically-allocated buffers duplicated in new buffers.
9651 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
9652 #[repr(C)]
9653 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
9654 /// This corresponds to std::vector in C++
9655 pub struct CVec_TxOutZ {
9656         /// The elements in the array.
9657         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9658         pub data: *mut crate::c_types::TxOut,
9659         /// The number of elements pointed to by `data`.
9660         pub datalen: usize
9661 }
9662 impl CVec_TxOutZ {
9663         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
9664                 if self.datalen == 0 { return Vec::new(); }
9665                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9666                 self.data = std::ptr::null_mut();
9667                 self.datalen = 0;
9668                 ret
9669         }
9670         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
9671                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9672         }
9673 }
9674 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
9675         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
9676                 let datalen = v.len();
9677                 let data = Box::into_raw(v.into_boxed_slice());
9678                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9679         }
9680 }
9681 #[no_mangle]
9682 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9683 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
9684 impl Drop for CVec_TxOutZ {
9685         fn drop(&mut self) {
9686                 if self.datalen == 0 { return; }
9687                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9688         }
9689 }
9690 impl Clone for CVec_TxOutZ {
9691         fn clone(&self) -> Self {
9692                 let mut res = Vec::new();
9693                 if self.datalen == 0 { return Self::from(res); }
9694                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9695                 Self::from(res)
9696         }
9697 }
9698 #[repr(C)]
9699 /// The contents of CResult_TransactionNoneZ
9700 pub union CResult_TransactionNoneZPtr {
9701         /// A pointer to the contents in the success state.
9702         /// Reading from this pointer when `result_ok` is not set is undefined.
9703         pub result: *mut crate::c_types::Transaction,
9704         /// Note that this value is always NULL, as there are no contents in the Err variant
9705         pub err: *mut std::ffi::c_void,
9706 }
9707 #[repr(C)]
9708 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
9709 /// containing a crate::c_types::Transaction on success and a () on failure.
9710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9711 pub struct CResult_TransactionNoneZ {
9712         /// The contents of this CResult_TransactionNoneZ, accessible via either
9713         /// `err` or `result` depending on the state of `result_ok`.
9714         pub contents: CResult_TransactionNoneZPtr,
9715         /// Whether this CResult_TransactionNoneZ represents a success state.
9716         pub result_ok: bool,
9717 }
9718 #[no_mangle]
9719 /// Creates a new CResult_TransactionNoneZ in the success state.
9720 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
9721         CResult_TransactionNoneZ {
9722                 contents: CResult_TransactionNoneZPtr {
9723                         result: Box::into_raw(Box::new(o)),
9724                 },
9725                 result_ok: true,
9726         }
9727 }
9728 #[no_mangle]
9729 /// Creates a new CResult_TransactionNoneZ in the error state.
9730 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
9731         CResult_TransactionNoneZ {
9732                 contents: CResult_TransactionNoneZPtr {
9733                         err: std::ptr::null_mut(),
9734                 },
9735                 result_ok: false,
9736         }
9737 }
9738 #[no_mangle]
9739 /// Frees any resources used by the CResult_TransactionNoneZ.
9740 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
9741 impl Drop for CResult_TransactionNoneZ {
9742         fn drop(&mut self) {
9743                 if self.result_ok {
9744                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9745                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9746                         }
9747                 } else {
9748                 }
9749         }
9750 }
9751 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
9752         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
9753                 let contents = if o.result_ok {
9754                         let result = unsafe { o.contents.result };
9755                         unsafe { o.contents.result = std::ptr::null_mut() };
9756                         CResult_TransactionNoneZPtr { result }
9757                 } else {
9758                         let _ = unsafe { Box::from_raw(o.contents.err) };
9759                         o.contents.err = std::ptr::null_mut();
9760                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
9761                 };
9762                 Self {
9763                         contents,
9764                         result_ok: o.result_ok,
9765                 }
9766         }
9767 }
9768 #[repr(C)]
9769 /// The contents of CResult_NoneErrorZ
9770 pub union CResult_NoneErrorZPtr {
9771         /// Note that this value is always NULL, as there are no contents in the OK variant
9772         pub result: *mut std::ffi::c_void,
9773         /// A pointer to the contents in the error state.
9774         /// Reading from this pointer when `result_ok` is set is undefined.
9775         pub err: *mut crate::c_types::IOError,
9776 }
9777 #[repr(C)]
9778 /// A CResult_NoneErrorZ represents the result of a fallible operation,
9779 /// containing a () on success and a crate::c_types::IOError on failure.
9780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9781 pub struct CResult_NoneErrorZ {
9782         /// The contents of this CResult_NoneErrorZ, accessible via either
9783         /// `err` or `result` depending on the state of `result_ok`.
9784         pub contents: CResult_NoneErrorZPtr,
9785         /// Whether this CResult_NoneErrorZ represents a success state.
9786         pub result_ok: bool,
9787 }
9788 #[no_mangle]
9789 /// Creates a new CResult_NoneErrorZ in the success state.
9790 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
9791         CResult_NoneErrorZ {
9792                 contents: CResult_NoneErrorZPtr {
9793                         result: std::ptr::null_mut(),
9794                 },
9795                 result_ok: true,
9796         }
9797 }
9798 #[no_mangle]
9799 /// Creates a new CResult_NoneErrorZ in the error state.
9800 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
9801         CResult_NoneErrorZ {
9802                 contents: CResult_NoneErrorZPtr {
9803                         err: Box::into_raw(Box::new(e)),
9804                 },
9805                 result_ok: false,
9806         }
9807 }
9808 #[no_mangle]
9809 /// Frees any resources used by the CResult_NoneErrorZ.
9810 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
9811 impl Drop for CResult_NoneErrorZ {
9812         fn drop(&mut self) {
9813                 if self.result_ok {
9814                 } else {
9815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9817                         }
9818                 }
9819         }
9820 }
9821 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
9822         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
9823                 let contents = if o.result_ok {
9824                         let _ = unsafe { Box::from_raw(o.contents.result) };
9825                         o.contents.result = std::ptr::null_mut();
9826                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
9827                 } else {
9828                         let err = unsafe { o.contents.err };
9829                         unsafe { o.contents.err = std::ptr::null_mut(); }
9830                         CResult_NoneErrorZPtr { err }
9831                 };
9832                 Self {
9833                         contents,
9834                         result_ok: o.result_ok,
9835                 }
9836         }
9837 }
9838 #[repr(C)]
9839 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
9840 /// This corresponds to std::vector in C++
9841 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
9842         /// The elements in the array.
9843         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9844         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9845         /// The number of elements pointed to by `data`.
9846         pub datalen: usize
9847 }
9848 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
9849         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
9850                 if self.datalen == 0 { return Vec::new(); }
9851                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9852                 self.data = std::ptr::null_mut();
9853                 self.datalen = 0;
9854                 ret
9855         }
9856         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
9857                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9858         }
9859 }
9860 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
9861         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
9862                 let datalen = v.len();
9863                 let data = Box::into_raw(v.into_boxed_slice());
9864                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9865         }
9866 }
9867 #[no_mangle]
9868 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9869 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
9870 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
9871         fn drop(&mut self) {
9872                 if self.datalen == 0 { return; }
9873                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9874         }
9875 }
9876 #[repr(C)]
9877 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
9878 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9879         /// A pointer to the contents in the success state.
9880         /// Reading from this pointer when `result_ok` is not set is undefined.
9881         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
9882         /// A pointer to the contents in the error state.
9883         /// Reading from this pointer when `result_ok` is set is undefined.
9884         pub err: *mut crate::c_types::IOError,
9885 }
9886 #[repr(C)]
9887 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
9888 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
9889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9890 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9891         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
9892         /// `err` or `result` depending on the state of `result_ok`.
9893         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
9894         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
9895         pub result_ok: bool,
9896 }
9897 #[no_mangle]
9898 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9899 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9900         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9901                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9902                         result: Box::into_raw(Box::new(o)),
9903                 },
9904                 result_ok: true,
9905         }
9906 }
9907 #[no_mangle]
9908 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9909 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9910         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9911                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9912                         err: Box::into_raw(Box::new(e)),
9913                 },
9914                 result_ok: false,
9915         }
9916 }
9917 #[no_mangle]
9918 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9919 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
9920 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9921         fn drop(&mut self) {
9922                 if self.result_ok {
9923                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9924                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9925                         }
9926                 } else {
9927                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9928                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9929                         }
9930                 }
9931         }
9932 }
9933 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9934         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
9935                 let contents = if o.result_ok {
9936                         let result = unsafe { o.contents.result };
9937                         unsafe { o.contents.result = std::ptr::null_mut() };
9938                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
9939                 } else {
9940                         let err = unsafe { o.contents.err };
9941                         unsafe { o.contents.err = std::ptr::null_mut(); }
9942                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
9943                 };
9944                 Self {
9945                         contents,
9946                         result_ok: o.result_ok,
9947                 }
9948         }
9949 }
9950 #[repr(C)]
9951 /// The contents of CResult_NoneAPIErrorZ
9952 pub union CResult_NoneAPIErrorZPtr {
9953         /// Note that this value is always NULL, as there are no contents in the OK variant
9954         pub result: *mut std::ffi::c_void,
9955         /// A pointer to the contents in the error state.
9956         /// Reading from this pointer when `result_ok` is set is undefined.
9957         pub err: *mut crate::lightning::util::errors::APIError,
9958 }
9959 #[repr(C)]
9960 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
9961 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
9962 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9963 pub struct CResult_NoneAPIErrorZ {
9964         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
9965         /// `err` or `result` depending on the state of `result_ok`.
9966         pub contents: CResult_NoneAPIErrorZPtr,
9967         /// Whether this CResult_NoneAPIErrorZ represents a success state.
9968         pub result_ok: bool,
9969 }
9970 #[no_mangle]
9971 /// Creates a new CResult_NoneAPIErrorZ in the success state.
9972 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
9973         CResult_NoneAPIErrorZ {
9974                 contents: CResult_NoneAPIErrorZPtr {
9975                         result: std::ptr::null_mut(),
9976                 },
9977                 result_ok: true,
9978         }
9979 }
9980 #[no_mangle]
9981 /// Creates a new CResult_NoneAPIErrorZ in the error state.
9982 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
9983         CResult_NoneAPIErrorZ {
9984                 contents: CResult_NoneAPIErrorZPtr {
9985                         err: Box::into_raw(Box::new(e)),
9986                 },
9987                 result_ok: false,
9988         }
9989 }
9990 #[no_mangle]
9991 /// Frees any resources used by the CResult_NoneAPIErrorZ.
9992 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
9993 impl Drop for CResult_NoneAPIErrorZ {
9994         fn drop(&mut self) {
9995                 if self.result_ok {
9996                 } else {
9997                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9998                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9999                         }
10000                 }
10001         }
10002 }
10003 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
10004         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
10005                 let contents = if o.result_ok {
10006                         let _ = unsafe { Box::from_raw(o.contents.result) };
10007                         o.contents.result = std::ptr::null_mut();
10008                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
10009                 } else {
10010                         let err = unsafe { o.contents.err };
10011                         unsafe { o.contents.err = std::ptr::null_mut(); }
10012                         CResult_NoneAPIErrorZPtr { err }
10013                 };
10014                 Self {
10015                         contents,
10016                         result_ok: o.result_ok,
10017                 }
10018         }
10019 }
10020 impl Clone for CResult_NoneAPIErrorZ {
10021         fn clone(&self) -> Self {
10022                 if self.result_ok {
10023                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
10024                                 result: std::ptr::null_mut()
10025                         } }
10026                 } else {
10027                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
10028                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10029                         } }
10030                 }
10031         }
10032 }
10033 #[no_mangle]
10034 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
10035 /// but with all dynamically-allocated buffers duplicated in new buffers.
10036 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
10037 #[repr(C)]
10038 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
10039 /// This corresponds to std::vector in C++
10040 pub struct CVec_CResult_NoneAPIErrorZZ {
10041         /// The elements in the array.
10042         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10043         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
10044         /// The number of elements pointed to by `data`.
10045         pub datalen: usize
10046 }
10047 impl CVec_CResult_NoneAPIErrorZZ {
10048         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
10049                 if self.datalen == 0 { return Vec::new(); }
10050                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10051                 self.data = std::ptr::null_mut();
10052                 self.datalen = 0;
10053                 ret
10054         }
10055         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
10056                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10057         }
10058 }
10059 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
10060         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
10061                 let datalen = v.len();
10062                 let data = Box::into_raw(v.into_boxed_slice());
10063                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10064         }
10065 }
10066 #[no_mangle]
10067 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10068 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
10069 impl Drop for CVec_CResult_NoneAPIErrorZZ {
10070         fn drop(&mut self) {
10071                 if self.datalen == 0 { return; }
10072                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10073         }
10074 }
10075 impl Clone for CVec_CResult_NoneAPIErrorZZ {
10076         fn clone(&self) -> Self {
10077                 let mut res = Vec::new();
10078                 if self.datalen == 0 { return Self::from(res); }
10079                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10080                 Self::from(res)
10081         }
10082 }
10083 #[repr(C)]
10084 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
10085 /// This corresponds to std::vector in C++
10086 pub struct CVec_APIErrorZ {
10087         /// The elements in the array.
10088         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10089         pub data: *mut crate::lightning::util::errors::APIError,
10090         /// The number of elements pointed to by `data`.
10091         pub datalen: usize
10092 }
10093 impl CVec_APIErrorZ {
10094         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
10095                 if self.datalen == 0 { return Vec::new(); }
10096                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10097                 self.data = std::ptr::null_mut();
10098                 self.datalen = 0;
10099                 ret
10100         }
10101         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
10102                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10103         }
10104 }
10105 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
10106         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
10107                 let datalen = v.len();
10108                 let data = Box::into_raw(v.into_boxed_slice());
10109                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10110         }
10111 }
10112 #[no_mangle]
10113 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10114 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
10115 impl Drop for CVec_APIErrorZ {
10116         fn drop(&mut self) {
10117                 if self.datalen == 0 { return; }
10118                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10119         }
10120 }
10121 impl Clone for CVec_APIErrorZ {
10122         fn clone(&self) -> Self {
10123                 let mut res = Vec::new();
10124                 if self.datalen == 0 { return Self::from(res); }
10125                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
10126                 Self::from(res)
10127         }
10128 }
10129 #[repr(C)]
10130 /// The contents of CResult_NonePaymentSendFailureZ
10131 pub union CResult_NonePaymentSendFailureZPtr {
10132         /// Note that this value is always NULL, as there are no contents in the OK variant
10133         pub result: *mut std::ffi::c_void,
10134         /// A pointer to the contents in the error state.
10135         /// Reading from this pointer when `result_ok` is set is undefined.
10136         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
10137 }
10138 #[repr(C)]
10139 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
10140 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
10141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10142 pub struct CResult_NonePaymentSendFailureZ {
10143         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
10144         /// `err` or `result` depending on the state of `result_ok`.
10145         pub contents: CResult_NonePaymentSendFailureZPtr,
10146         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
10147         pub result_ok: bool,
10148 }
10149 #[no_mangle]
10150 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
10151 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
10152         CResult_NonePaymentSendFailureZ {
10153                 contents: CResult_NonePaymentSendFailureZPtr {
10154                         result: std::ptr::null_mut(),
10155                 },
10156                 result_ok: true,
10157         }
10158 }
10159 #[no_mangle]
10160 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
10161 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
10162         CResult_NonePaymentSendFailureZ {
10163                 contents: CResult_NonePaymentSendFailureZPtr {
10164                         err: Box::into_raw(Box::new(e)),
10165                 },
10166                 result_ok: false,
10167         }
10168 }
10169 #[no_mangle]
10170 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
10171 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
10172 impl Drop for CResult_NonePaymentSendFailureZ {
10173         fn drop(&mut self) {
10174                 if self.result_ok {
10175                 } else {
10176                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10177                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10178                         }
10179                 }
10180         }
10181 }
10182 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
10183         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
10184                 let contents = if o.result_ok {
10185                         let _ = unsafe { Box::from_raw(o.contents.result) };
10186                         o.contents.result = std::ptr::null_mut();
10187                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
10188                 } else {
10189                         let err = unsafe { o.contents.err };
10190                         unsafe { o.contents.err = std::ptr::null_mut(); }
10191                         CResult_NonePaymentSendFailureZPtr { err }
10192                 };
10193                 Self {
10194                         contents,
10195                         result_ok: o.result_ok,
10196                 }
10197         }
10198 }
10199 impl Clone for CResult_NonePaymentSendFailureZ {
10200         fn clone(&self) -> Self {
10201                 if self.result_ok {
10202                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
10203                                 result: std::ptr::null_mut()
10204                         } }
10205                 } else {
10206                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
10207                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10208                         } }
10209                 }
10210         }
10211 }
10212 #[no_mangle]
10213 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
10214 /// but with all dynamically-allocated buffers duplicated in new buffers.
10215 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
10216 #[repr(C)]
10217 /// A tuple of 2 elements. See the individual fields for the types contained.
10218 pub struct C2Tuple_PaymentHashPaymentSecretZ {
10219         /// The element at position 0
10220         pub a: crate::c_types::ThirtyTwoBytes,
10221         /// The element at position 1
10222         pub b: crate::c_types::ThirtyTwoBytes,
10223 }
10224 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
10225         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
10226                 Self {
10227                         a: tup.0,
10228                         b: tup.1,
10229                 }
10230         }
10231 }
10232 impl C2Tuple_PaymentHashPaymentSecretZ {
10233         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
10234                 (self.a, self.b)
10235         }
10236 }
10237 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
10238 #[no_mangle]
10239 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
10240         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
10241 }
10242
10243 #[no_mangle]
10244 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
10245 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
10246 #[repr(C)]
10247 /// The contents of CResult_PaymentSecretAPIErrorZ
10248 pub union CResult_PaymentSecretAPIErrorZPtr {
10249         /// A pointer to the contents in the success state.
10250         /// Reading from this pointer when `result_ok` is not set is undefined.
10251         pub result: *mut crate::c_types::ThirtyTwoBytes,
10252         /// A pointer to the contents in the error state.
10253         /// Reading from this pointer when `result_ok` is set is undefined.
10254         pub err: *mut crate::lightning::util::errors::APIError,
10255 }
10256 #[repr(C)]
10257 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
10258 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10259 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10260 pub struct CResult_PaymentSecretAPIErrorZ {
10261         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
10262         /// `err` or `result` depending on the state of `result_ok`.
10263         pub contents: CResult_PaymentSecretAPIErrorZPtr,
10264         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
10265         pub result_ok: bool,
10266 }
10267 #[no_mangle]
10268 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
10269 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
10270         CResult_PaymentSecretAPIErrorZ {
10271                 contents: CResult_PaymentSecretAPIErrorZPtr {
10272                         result: Box::into_raw(Box::new(o)),
10273                 },
10274                 result_ok: true,
10275         }
10276 }
10277 #[no_mangle]
10278 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
10279 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
10280         CResult_PaymentSecretAPIErrorZ {
10281                 contents: CResult_PaymentSecretAPIErrorZPtr {
10282                         err: Box::into_raw(Box::new(e)),
10283                 },
10284                 result_ok: false,
10285         }
10286 }
10287 #[no_mangle]
10288 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
10289 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
10290 impl Drop for CResult_PaymentSecretAPIErrorZ {
10291         fn drop(&mut self) {
10292                 if self.result_ok {
10293                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10294                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10295                         }
10296                 } else {
10297                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10298                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10299                         }
10300                 }
10301         }
10302 }
10303 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
10304         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10305                 let contents = if o.result_ok {
10306                         let result = unsafe { o.contents.result };
10307                         unsafe { o.contents.result = std::ptr::null_mut() };
10308                         CResult_PaymentSecretAPIErrorZPtr { result }
10309                 } else {
10310                         let err = unsafe { o.contents.err };
10311                         unsafe { o.contents.err = std::ptr::null_mut(); }
10312                         CResult_PaymentSecretAPIErrorZPtr { err }
10313                 };
10314                 Self {
10315                         contents,
10316                         result_ok: o.result_ok,
10317                 }
10318         }
10319 }
10320 #[repr(C)]
10321 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10322 /// This corresponds to std::vector in C++
10323 pub struct CVec_ChannelMonitorZ {
10324         /// The elements in the array.
10325         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10326         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10327         /// The number of elements pointed to by `data`.
10328         pub datalen: usize
10329 }
10330 impl CVec_ChannelMonitorZ {
10331         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10332                 if self.datalen == 0 { return Vec::new(); }
10333                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10334                 self.data = std::ptr::null_mut();
10335                 self.datalen = 0;
10336                 ret
10337         }
10338         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10339                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
10340         }
10341 }
10342 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10343         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10344                 let datalen = v.len();
10345                 let data = Box::into_raw(v.into_boxed_slice());
10346                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10347         }
10348 }
10349 #[no_mangle]
10350 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10351 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10352 impl Drop for CVec_ChannelMonitorZ {
10353         fn drop(&mut self) {
10354                 if self.datalen == 0 { return; }
10355                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10356         }
10357 }
10358 #[repr(C)]
10359 /// A tuple of 2 elements. See the individual fields for the types contained.
10360 pub struct C2Tuple_BlockHashChannelManagerZ {
10361         /// The element at position 0
10362         pub a: crate::c_types::ThirtyTwoBytes,
10363         /// The element at position 1
10364         pub b: crate::lightning::ln::channelmanager::ChannelManager,
10365 }
10366 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10367         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10368                 Self {
10369                         a: tup.0,
10370                         b: tup.1,
10371                 }
10372         }
10373 }
10374 impl C2Tuple_BlockHashChannelManagerZ {
10375         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10376                 (self.a, self.b)
10377         }
10378 }
10379 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10380 #[no_mangle]
10381 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10382         C2Tuple_BlockHashChannelManagerZ { a, b, }
10383 }
10384
10385 #[no_mangle]
10386 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10387 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10388 #[repr(C)]
10389 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10390 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10391         /// A pointer to the contents in the success state.
10392         /// Reading from this pointer when `result_ok` is not set is undefined.
10393         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10394         /// A pointer to the contents in the error state.
10395         /// Reading from this pointer when `result_ok` is set is undefined.
10396         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10397 }
10398 #[repr(C)]
10399 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10400 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10402 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10403         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10404         /// `err` or `result` depending on the state of `result_ok`.
10405         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10406         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10407         pub result_ok: bool,
10408 }
10409 #[no_mangle]
10410 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10411 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10412         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10413                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10414                         result: Box::into_raw(Box::new(o)),
10415                 },
10416                 result_ok: true,
10417         }
10418 }
10419 #[no_mangle]
10420 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10421 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10422         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10423                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10424                         err: Box::into_raw(Box::new(e)),
10425                 },
10426                 result_ok: false,
10427         }
10428 }
10429 #[no_mangle]
10430 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10431 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10432 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10433         fn drop(&mut self) {
10434                 if self.result_ok {
10435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10437                         }
10438                 } else {
10439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10441                         }
10442                 }
10443         }
10444 }
10445 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10446         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10447                 let contents = if o.result_ok {
10448                         let result = unsafe { o.contents.result };
10449                         unsafe { o.contents.result = std::ptr::null_mut() };
10450                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10451                 } else {
10452                         let err = unsafe { o.contents.err };
10453                         unsafe { o.contents.err = std::ptr::null_mut(); }
10454                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10455                 };
10456                 Self {
10457                         contents,
10458                         result_ok: o.result_ok,
10459                 }
10460         }
10461 }