Merge pull request #18 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, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
1267         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> 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, u8>> for CResult_CVec_SignatureZNoneZ {
1337         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> 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 /// A dynamically-allocated array of crate::lightning_invoice::RawTaggedFields of arbitrary size.
1372 /// This corresponds to std::vector in C++
1373 pub struct CVec_RawTaggedFieldZ {
1374         /// The elements in the array.
1375         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1376         pub data: *mut crate::lightning_invoice::RawTaggedField,
1377         /// The number of elements pointed to by `data`.
1378         pub datalen: usize
1379 }
1380 impl CVec_RawTaggedFieldZ {
1381         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RawTaggedField> {
1382                 if self.datalen == 0 { return Vec::new(); }
1383                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1384                 self.data = std::ptr::null_mut();
1385                 self.datalen = 0;
1386                 ret
1387         }
1388         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RawTaggedField] {
1389                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1390         }
1391 }
1392 impl From<Vec<crate::lightning_invoice::RawTaggedField>> for CVec_RawTaggedFieldZ {
1393         fn from(v: Vec<crate::lightning_invoice::RawTaggedField>) -> Self {
1394                 let datalen = v.len();
1395                 let data = Box::into_raw(v.into_boxed_slice());
1396                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1397         }
1398 }
1399 #[no_mangle]
1400 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1401 pub extern "C" fn CVec_RawTaggedFieldZ_free(_res: CVec_RawTaggedFieldZ) { }
1402 impl Drop for CVec_RawTaggedFieldZ {
1403         fn drop(&mut self) {
1404                 if self.datalen == 0 { return; }
1405                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1406         }
1407 }
1408 impl Clone for CVec_RawTaggedFieldZ {
1409         fn clone(&self) -> Self {
1410                 let mut res = Vec::new();
1411                 if self.datalen == 0 { return Self::from(res); }
1412                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1413                 Self::from(res)
1414         }
1415 }
1416 #[repr(C)]
1417 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
1418 /// This corresponds to std::vector in C++
1419 pub struct CVec_u5Z {
1420         /// The elements in the array.
1421         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1422         pub data: *mut crate::c_types::u5,
1423         /// The number of elements pointed to by `data`.
1424         pub datalen: usize
1425 }
1426 impl CVec_u5Z {
1427         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
1428                 if self.datalen == 0 { return Vec::new(); }
1429                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1430                 self.data = std::ptr::null_mut();
1431                 self.datalen = 0;
1432                 ret
1433         }
1434         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
1435                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1436         }
1437 }
1438 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
1439         fn from(v: Vec<crate::c_types::u5>) -> Self {
1440                 let datalen = v.len();
1441                 let data = Box::into_raw(v.into_boxed_slice());
1442                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1443         }
1444 }
1445 #[no_mangle]
1446 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1447 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
1448 impl Drop for CVec_u5Z {
1449         fn drop(&mut self) {
1450                 if self.datalen == 0 { return; }
1451                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1452         }
1453 }
1454 impl Clone for CVec_u5Z {
1455         fn clone(&self) -> Self {
1456                 let mut res = Vec::new();
1457                 if self.datalen == 0 { return Self::from(res); }
1458                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1459                 Self::from(res)
1460         }
1461 }
1462 #[repr(C)]
1463 /// A dynamically-allocated array of u8s of arbitrary size.
1464 /// This corresponds to std::vector in C++
1465 pub struct CVec_u8Z {
1466         /// The elements in the array.
1467         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1468         pub data: *mut u8,
1469         /// The number of elements pointed to by `data`.
1470         pub datalen: usize
1471 }
1472 impl CVec_u8Z {
1473         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
1474                 if self.datalen == 0 { return Vec::new(); }
1475                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1476                 self.data = std::ptr::null_mut();
1477                 self.datalen = 0;
1478                 ret
1479         }
1480         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
1481                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1482         }
1483 }
1484 impl From<Vec<u8>> for CVec_u8Z {
1485         fn from(v: Vec<u8>) -> Self {
1486                 let datalen = v.len();
1487                 let data = Box::into_raw(v.into_boxed_slice());
1488                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1489         }
1490 }
1491 #[no_mangle]
1492 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1493 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1494 impl Drop for CVec_u8Z {
1495         fn drop(&mut self) {
1496                 if self.datalen == 0 { return; }
1497                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1498         }
1499 }
1500 impl Clone for CVec_u8Z {
1501         fn clone(&self) -> Self {
1502                 let mut res = Vec::new();
1503                 if self.datalen == 0 { return Self::from(res); }
1504                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1505                 Self::from(res)
1506         }
1507 }
1508 #[repr(C)]
1509 /// A tuple of 3 elements. See the individual fields for the types contained.
1510 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1511         /// The element at position 0
1512         pub a: crate::lightning_invoice::RawInvoice,
1513         /// The element at position 1
1514         pub b: crate::c_types::ThirtyTwoBytes,
1515         /// The element at position 2
1516         pub c: crate::lightning_invoice::InvoiceSignature,
1517 }
1518 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1519         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
1520                 Self {
1521                         a: tup.0,
1522                         b: tup.1,
1523                         c: tup.2,
1524                 }
1525         }
1526 }
1527 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
1528         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
1529                 (self.a, self.b, self.c)
1530         }
1531 }
1532 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
1533 #[no_mangle]
1534 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 {
1535         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
1536 }
1537
1538 #[no_mangle]
1539 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
1540 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
1541 #[repr(C)]
1542 /// The contents of CResult_PayeePubKeyErrorZ
1543 pub union CResult_PayeePubKeyErrorZPtr {
1544         /// A pointer to the contents in the success state.
1545         /// Reading from this pointer when `result_ok` is not set is undefined.
1546         pub result: *mut crate::lightning_invoice::PayeePubKey,
1547         /// A pointer to the contents in the error state.
1548         /// Reading from this pointer when `result_ok` is set is undefined.
1549         pub err: *mut crate::c_types::Secp256k1Error,
1550 }
1551 #[repr(C)]
1552 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
1553 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
1554 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1555 pub struct CResult_PayeePubKeyErrorZ {
1556         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
1557         /// `err` or `result` depending on the state of `result_ok`.
1558         pub contents: CResult_PayeePubKeyErrorZPtr,
1559         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
1560         pub result_ok: bool,
1561 }
1562 #[no_mangle]
1563 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
1564 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
1565         CResult_PayeePubKeyErrorZ {
1566                 contents: CResult_PayeePubKeyErrorZPtr {
1567                         result: Box::into_raw(Box::new(o)),
1568                 },
1569                 result_ok: true,
1570         }
1571 }
1572 #[no_mangle]
1573 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
1574 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
1575         CResult_PayeePubKeyErrorZ {
1576                 contents: CResult_PayeePubKeyErrorZPtr {
1577                         err: Box::into_raw(Box::new(e)),
1578                 },
1579                 result_ok: false,
1580         }
1581 }
1582 #[no_mangle]
1583 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
1584 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
1585 impl Drop for CResult_PayeePubKeyErrorZ {
1586         fn drop(&mut self) {
1587                 if self.result_ok {
1588                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1589                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1590                         }
1591                 } else {
1592                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1593                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1594                         }
1595                 }
1596         }
1597 }
1598 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
1599         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
1600                 let contents = if o.result_ok {
1601                         let result = unsafe { o.contents.result };
1602                         unsafe { o.contents.result = std::ptr::null_mut() };
1603                         CResult_PayeePubKeyErrorZPtr { result }
1604                 } else {
1605                         let err = unsafe { o.contents.err };
1606                         unsafe { o.contents.err = std::ptr::null_mut(); }
1607                         CResult_PayeePubKeyErrorZPtr { err }
1608                 };
1609                 Self {
1610                         contents,
1611                         result_ok: o.result_ok,
1612                 }
1613         }
1614 }
1615 #[repr(C)]
1616 /// A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
1617 /// This corresponds to std::vector in C++
1618 pub struct CVec_RouteHintZ {
1619         /// The elements in the array.
1620         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1621         pub data: *mut crate::lightning_invoice::RouteHint,
1622         /// The number of elements pointed to by `data`.
1623         pub datalen: usize
1624 }
1625 impl CVec_RouteHintZ {
1626         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RouteHint> {
1627                 if self.datalen == 0 { return Vec::new(); }
1628                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1629                 self.data = std::ptr::null_mut();
1630                 self.datalen = 0;
1631                 ret
1632         }
1633         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RouteHint] {
1634                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1635         }
1636 }
1637 impl From<Vec<crate::lightning_invoice::RouteHint>> for CVec_RouteHintZ {
1638         fn from(v: Vec<crate::lightning_invoice::RouteHint>) -> Self {
1639                 let datalen = v.len();
1640                 let data = Box::into_raw(v.into_boxed_slice());
1641                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1642         }
1643 }
1644 #[no_mangle]
1645 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1646 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
1647 impl Drop for CVec_RouteHintZ {
1648         fn drop(&mut self) {
1649                 if self.datalen == 0 { return; }
1650                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1651         }
1652 }
1653 impl Clone for CVec_RouteHintZ {
1654         fn clone(&self) -> Self {
1655                 let mut res = Vec::new();
1656                 if self.datalen == 0 { return Self::from(res); }
1657                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1658                 Self::from(res)
1659         }
1660 }
1661 #[repr(C)]
1662 #[derive(Clone)]
1663 /// An enum which can either contain a u64 or not
1664 pub enum COption_u64Z {
1665         /// When we're in this state, this COption_u64Z contains a u64
1666         Some(u64),
1667         /// When we're in this state, this COption_u64Z contains nothing
1668         None
1669 }
1670 impl COption_u64Z {
1671         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1672                 if let Self::Some(_) = self { true } else { false }
1673         }
1674         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
1675                 if let Self::Some(v) = self { v } else { unreachable!() }
1676         }
1677 }
1678 #[no_mangle]
1679 /// Constructs a new COption_u64Z containing a u64
1680 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
1681         COption_u64Z::Some(o)
1682 }
1683 #[no_mangle]
1684 /// Constructs a new COption_u64Z containing nothing
1685 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
1686         COption_u64Z::None
1687 }
1688 #[no_mangle]
1689 /// Frees any resources associated with the u64, if we are in the Some state
1690 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
1691 #[no_mangle]
1692 /// Creates a new COption_u64Z which has the same data as `orig`
1693 /// but with all dynamically-allocated buffers duplicated in new buffers.
1694 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
1695 #[repr(C)]
1696 /// The contents of CResult_PositiveTimestampCreationErrorZ
1697 pub union CResult_PositiveTimestampCreationErrorZPtr {
1698         /// A pointer to the contents in the success state.
1699         /// Reading from this pointer when `result_ok` is not set is undefined.
1700         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
1701         /// A pointer to the contents in the error state.
1702         /// Reading from this pointer when `result_ok` is set is undefined.
1703         pub err: *mut crate::lightning_invoice::CreationError,
1704 }
1705 #[repr(C)]
1706 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
1707 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
1708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1709 pub struct CResult_PositiveTimestampCreationErrorZ {
1710         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
1711         /// `err` or `result` depending on the state of `result_ok`.
1712         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
1713         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
1714         pub result_ok: bool,
1715 }
1716 #[no_mangle]
1717 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
1718 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
1719         CResult_PositiveTimestampCreationErrorZ {
1720                 contents: CResult_PositiveTimestampCreationErrorZPtr {
1721                         result: Box::into_raw(Box::new(o)),
1722                 },
1723                 result_ok: true,
1724         }
1725 }
1726 #[no_mangle]
1727 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
1728 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
1729         CResult_PositiveTimestampCreationErrorZ {
1730                 contents: CResult_PositiveTimestampCreationErrorZPtr {
1731                         err: Box::into_raw(Box::new(e)),
1732                 },
1733                 result_ok: false,
1734         }
1735 }
1736 #[no_mangle]
1737 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
1738 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
1739 impl Drop for CResult_PositiveTimestampCreationErrorZ {
1740         fn drop(&mut self) {
1741                 if self.result_ok {
1742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1744                         }
1745                 } else {
1746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1748                         }
1749                 }
1750         }
1751 }
1752 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
1753         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
1754                 let contents = if o.result_ok {
1755                         let result = unsafe { o.contents.result };
1756                         unsafe { o.contents.result = std::ptr::null_mut() };
1757                         CResult_PositiveTimestampCreationErrorZPtr { result }
1758                 } else {
1759                         let err = unsafe { o.contents.err };
1760                         unsafe { o.contents.err = std::ptr::null_mut(); }
1761                         CResult_PositiveTimestampCreationErrorZPtr { err }
1762                 };
1763                 Self {
1764                         contents,
1765                         result_ok: o.result_ok,
1766                 }
1767         }
1768 }
1769 impl Clone for CResult_PositiveTimestampCreationErrorZ {
1770         fn clone(&self) -> Self {
1771                 if self.result_ok {
1772                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
1773                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
1774                         } }
1775                 } else {
1776                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
1777                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
1778                         } }
1779                 }
1780         }
1781 }
1782 #[no_mangle]
1783 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
1784 /// but with all dynamically-allocated buffers duplicated in new buffers.
1785 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { orig.clone() }
1786 #[repr(C)]
1787 /// The contents of CResult_NoneSemanticErrorZ
1788 pub union CResult_NoneSemanticErrorZPtr {
1789         /// Note that this value is always NULL, as there are no contents in the OK variant
1790         pub result: *mut std::ffi::c_void,
1791         /// A pointer to the contents in the error state.
1792         /// Reading from this pointer when `result_ok` is set is undefined.
1793         pub err: *mut crate::lightning_invoice::SemanticError,
1794 }
1795 #[repr(C)]
1796 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
1797 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
1798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1799 pub struct CResult_NoneSemanticErrorZ {
1800         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
1801         /// `err` or `result` depending on the state of `result_ok`.
1802         pub contents: CResult_NoneSemanticErrorZPtr,
1803         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
1804         pub result_ok: bool,
1805 }
1806 #[no_mangle]
1807 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
1808 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
1809         CResult_NoneSemanticErrorZ {
1810                 contents: CResult_NoneSemanticErrorZPtr {
1811                         result: std::ptr::null_mut(),
1812                 },
1813                 result_ok: true,
1814         }
1815 }
1816 #[no_mangle]
1817 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
1818 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
1819         CResult_NoneSemanticErrorZ {
1820                 contents: CResult_NoneSemanticErrorZPtr {
1821                         err: Box::into_raw(Box::new(e)),
1822                 },
1823                 result_ok: false,
1824         }
1825 }
1826 #[no_mangle]
1827 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
1828 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
1829 impl Drop for CResult_NoneSemanticErrorZ {
1830         fn drop(&mut self) {
1831                 if self.result_ok {
1832                 } else {
1833                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1834                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1835                         }
1836                 }
1837         }
1838 }
1839 impl From<crate::c_types::CResultTempl<u8, crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
1840         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning_invoice::SemanticError>) -> Self {
1841                 let contents = if o.result_ok {
1842                         let _ = unsafe { Box::from_raw(o.contents.result) };
1843                         o.contents.result = std::ptr::null_mut();
1844                         CResult_NoneSemanticErrorZPtr { result: std::ptr::null_mut() }
1845                 } else {
1846                         let err = unsafe { o.contents.err };
1847                         unsafe { o.contents.err = std::ptr::null_mut(); }
1848                         CResult_NoneSemanticErrorZPtr { err }
1849                 };
1850                 Self {
1851                         contents,
1852                         result_ok: o.result_ok,
1853                 }
1854         }
1855 }
1856 impl Clone for CResult_NoneSemanticErrorZ {
1857         fn clone(&self) -> Self {
1858                 if self.result_ok {
1859                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
1860                                 result: std::ptr::null_mut()
1861                         } }
1862                 } else {
1863                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
1864                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
1865                         } }
1866                 }
1867         }
1868 }
1869 #[no_mangle]
1870 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
1871 /// but with all dynamically-allocated buffers duplicated in new buffers.
1872 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { orig.clone() }
1873 #[repr(C)]
1874 /// The contents of CResult_InvoiceSemanticErrorZ
1875 pub union CResult_InvoiceSemanticErrorZPtr {
1876         /// A pointer to the contents in the success state.
1877         /// Reading from this pointer when `result_ok` is not set is undefined.
1878         pub result: *mut crate::lightning_invoice::Invoice,
1879         /// A pointer to the contents in the error state.
1880         /// Reading from this pointer when `result_ok` is set is undefined.
1881         pub err: *mut crate::lightning_invoice::SemanticError,
1882 }
1883 #[repr(C)]
1884 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
1885 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
1886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1887 pub struct CResult_InvoiceSemanticErrorZ {
1888         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
1889         /// `err` or `result` depending on the state of `result_ok`.
1890         pub contents: CResult_InvoiceSemanticErrorZPtr,
1891         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
1892         pub result_ok: bool,
1893 }
1894 #[no_mangle]
1895 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
1896 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
1897         CResult_InvoiceSemanticErrorZ {
1898                 contents: CResult_InvoiceSemanticErrorZPtr {
1899                         result: Box::into_raw(Box::new(o)),
1900                 },
1901                 result_ok: true,
1902         }
1903 }
1904 #[no_mangle]
1905 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
1906 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
1907         CResult_InvoiceSemanticErrorZ {
1908                 contents: CResult_InvoiceSemanticErrorZPtr {
1909                         err: Box::into_raw(Box::new(e)),
1910                 },
1911                 result_ok: false,
1912         }
1913 }
1914 #[no_mangle]
1915 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
1916 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
1917 impl Drop for CResult_InvoiceSemanticErrorZ {
1918         fn drop(&mut self) {
1919                 if self.result_ok {
1920                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1921                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1922                         }
1923                 } else {
1924                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1925                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1926                         }
1927                 }
1928         }
1929 }
1930 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
1931         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
1932                 let contents = if o.result_ok {
1933                         let result = unsafe { o.contents.result };
1934                         unsafe { o.contents.result = std::ptr::null_mut() };
1935                         CResult_InvoiceSemanticErrorZPtr { result }
1936                 } else {
1937                         let err = unsafe { o.contents.err };
1938                         unsafe { o.contents.err = std::ptr::null_mut(); }
1939                         CResult_InvoiceSemanticErrorZPtr { err }
1940                 };
1941                 Self {
1942                         contents,
1943                         result_ok: o.result_ok,
1944                 }
1945         }
1946 }
1947 impl Clone for CResult_InvoiceSemanticErrorZ {
1948         fn clone(&self) -> Self {
1949                 if self.result_ok {
1950                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
1951                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
1952                         } }
1953                 } else {
1954                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
1955                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
1956                         } }
1957                 }
1958         }
1959 }
1960 #[no_mangle]
1961 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
1962 /// but with all dynamically-allocated buffers duplicated in new buffers.
1963 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { orig.clone() }
1964 #[repr(C)]
1965 /// The contents of CResult_DescriptionCreationErrorZ
1966 pub union CResult_DescriptionCreationErrorZPtr {
1967         /// A pointer to the contents in the success state.
1968         /// Reading from this pointer when `result_ok` is not set is undefined.
1969         pub result: *mut crate::lightning_invoice::Description,
1970         /// A pointer to the contents in the error state.
1971         /// Reading from this pointer when `result_ok` is set is undefined.
1972         pub err: *mut crate::lightning_invoice::CreationError,
1973 }
1974 #[repr(C)]
1975 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
1976 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
1977 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1978 pub struct CResult_DescriptionCreationErrorZ {
1979         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
1980         /// `err` or `result` depending on the state of `result_ok`.
1981         pub contents: CResult_DescriptionCreationErrorZPtr,
1982         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
1983         pub result_ok: bool,
1984 }
1985 #[no_mangle]
1986 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
1987 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
1988         CResult_DescriptionCreationErrorZ {
1989                 contents: CResult_DescriptionCreationErrorZPtr {
1990                         result: Box::into_raw(Box::new(o)),
1991                 },
1992                 result_ok: true,
1993         }
1994 }
1995 #[no_mangle]
1996 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
1997 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
1998         CResult_DescriptionCreationErrorZ {
1999                 contents: CResult_DescriptionCreationErrorZPtr {
2000                         err: Box::into_raw(Box::new(e)),
2001                 },
2002                 result_ok: false,
2003         }
2004 }
2005 #[no_mangle]
2006 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
2007 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
2008 impl Drop for CResult_DescriptionCreationErrorZ {
2009         fn drop(&mut self) {
2010                 if self.result_ok {
2011                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2012                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2013                         }
2014                 } else {
2015                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2016                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2017                         }
2018                 }
2019         }
2020 }
2021 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
2022         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
2023                 let contents = if o.result_ok {
2024                         let result = unsafe { o.contents.result };
2025                         unsafe { o.contents.result = std::ptr::null_mut() };
2026                         CResult_DescriptionCreationErrorZPtr { result }
2027                 } else {
2028                         let err = unsafe { o.contents.err };
2029                         unsafe { o.contents.err = std::ptr::null_mut(); }
2030                         CResult_DescriptionCreationErrorZPtr { err }
2031                 };
2032                 Self {
2033                         contents,
2034                         result_ok: o.result_ok,
2035                 }
2036         }
2037 }
2038 impl Clone for CResult_DescriptionCreationErrorZ {
2039         fn clone(&self) -> Self {
2040                 if self.result_ok {
2041                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
2042                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
2043                         } }
2044                 } else {
2045                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
2046                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2047                         } }
2048                 }
2049         }
2050 }
2051 #[no_mangle]
2052 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
2053 /// but with all dynamically-allocated buffers duplicated in new buffers.
2054 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { orig.clone() }
2055 #[repr(C)]
2056 /// The contents of CResult_ExpiryTimeCreationErrorZ
2057 pub union CResult_ExpiryTimeCreationErrorZPtr {
2058         /// A pointer to the contents in the success state.
2059         /// Reading from this pointer when `result_ok` is not set is undefined.
2060         pub result: *mut crate::lightning_invoice::ExpiryTime,
2061         /// A pointer to the contents in the error state.
2062         /// Reading from this pointer when `result_ok` is set is undefined.
2063         pub err: *mut crate::lightning_invoice::CreationError,
2064 }
2065 #[repr(C)]
2066 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
2067 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
2068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2069 pub struct CResult_ExpiryTimeCreationErrorZ {
2070         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
2071         /// `err` or `result` depending on the state of `result_ok`.
2072         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
2073         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
2074         pub result_ok: bool,
2075 }
2076 #[no_mangle]
2077 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
2078 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
2079         CResult_ExpiryTimeCreationErrorZ {
2080                 contents: CResult_ExpiryTimeCreationErrorZPtr {
2081                         result: Box::into_raw(Box::new(o)),
2082                 },
2083                 result_ok: true,
2084         }
2085 }
2086 #[no_mangle]
2087 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
2088 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
2089         CResult_ExpiryTimeCreationErrorZ {
2090                 contents: CResult_ExpiryTimeCreationErrorZPtr {
2091                         err: Box::into_raw(Box::new(e)),
2092                 },
2093                 result_ok: false,
2094         }
2095 }
2096 #[no_mangle]
2097 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
2098 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
2099 impl Drop for CResult_ExpiryTimeCreationErrorZ {
2100         fn drop(&mut self) {
2101                 if self.result_ok {
2102                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2103                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2104                         }
2105                 } else {
2106                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2107                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2108                         }
2109                 }
2110         }
2111 }
2112 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
2113         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
2114                 let contents = if o.result_ok {
2115                         let result = unsafe { o.contents.result };
2116                         unsafe { o.contents.result = std::ptr::null_mut() };
2117                         CResult_ExpiryTimeCreationErrorZPtr { result }
2118                 } else {
2119                         let err = unsafe { o.contents.err };
2120                         unsafe { o.contents.err = std::ptr::null_mut(); }
2121                         CResult_ExpiryTimeCreationErrorZPtr { err }
2122                 };
2123                 Self {
2124                         contents,
2125                         result_ok: o.result_ok,
2126                 }
2127         }
2128 }
2129 impl Clone for CResult_ExpiryTimeCreationErrorZ {
2130         fn clone(&self) -> Self {
2131                 if self.result_ok {
2132                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
2133                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
2134                         } }
2135                 } else {
2136                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
2137                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2138                         } }
2139                 }
2140         }
2141 }
2142 #[no_mangle]
2143 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
2144 /// but with all dynamically-allocated buffers duplicated in new buffers.
2145 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
2146 #[repr(C)]
2147 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2148 /// This corresponds to std::vector in C++
2149 pub struct CVec_RouteHintHopZ {
2150         /// The elements in the array.
2151         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2152         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2153         /// The number of elements pointed to by `data`.
2154         pub datalen: usize
2155 }
2156 impl CVec_RouteHintHopZ {
2157         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2158                 if self.datalen == 0 { return Vec::new(); }
2159                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2160                 self.data = std::ptr::null_mut();
2161                 self.datalen = 0;
2162                 ret
2163         }
2164         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2165                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2166         }
2167 }
2168 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2169         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2170                 let datalen = v.len();
2171                 let data = Box::into_raw(v.into_boxed_slice());
2172                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2173         }
2174 }
2175 #[no_mangle]
2176 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2177 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2178 impl Drop for CVec_RouteHintHopZ {
2179         fn drop(&mut self) {
2180                 if self.datalen == 0 { return; }
2181                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2182         }
2183 }
2184 impl Clone for CVec_RouteHintHopZ {
2185         fn clone(&self) -> Self {
2186                 let mut res = Vec::new();
2187                 if self.datalen == 0 { return Self::from(res); }
2188                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2189                 Self::from(res)
2190         }
2191 }
2192 #[repr(C)]
2193 /// The contents of CResult_RouteHintCreationErrorZ
2194 pub union CResult_RouteHintCreationErrorZPtr {
2195         /// A pointer to the contents in the success state.
2196         /// Reading from this pointer when `result_ok` is not set is undefined.
2197         pub result: *mut crate::lightning_invoice::RouteHint,
2198         /// A pointer to the contents in the error state.
2199         /// Reading from this pointer when `result_ok` is set is undefined.
2200         pub err: *mut crate::lightning_invoice::CreationError,
2201 }
2202 #[repr(C)]
2203 /// A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
2204 /// containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
2205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2206 pub struct CResult_RouteHintCreationErrorZ {
2207         /// The contents of this CResult_RouteHintCreationErrorZ, accessible via either
2208         /// `err` or `result` depending on the state of `result_ok`.
2209         pub contents: CResult_RouteHintCreationErrorZPtr,
2210         /// Whether this CResult_RouteHintCreationErrorZ represents a success state.
2211         pub result_ok: bool,
2212 }
2213 #[no_mangle]
2214 /// Creates a new CResult_RouteHintCreationErrorZ in the success state.
2215 pub extern "C" fn CResult_RouteHintCreationErrorZ_ok(o: crate::lightning_invoice::RouteHint) -> CResult_RouteHintCreationErrorZ {
2216         CResult_RouteHintCreationErrorZ {
2217                 contents: CResult_RouteHintCreationErrorZPtr {
2218                         result: Box::into_raw(Box::new(o)),
2219                 },
2220                 result_ok: true,
2221         }
2222 }
2223 #[no_mangle]
2224 /// Creates a new CResult_RouteHintCreationErrorZ in the error state.
2225 pub extern "C" fn CResult_RouteHintCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_RouteHintCreationErrorZ {
2226         CResult_RouteHintCreationErrorZ {
2227                 contents: CResult_RouteHintCreationErrorZPtr {
2228                         err: Box::into_raw(Box::new(e)),
2229                 },
2230                 result_ok: false,
2231         }
2232 }
2233 #[no_mangle]
2234 /// Frees any resources used by the CResult_RouteHintCreationErrorZ.
2235 pub extern "C" fn CResult_RouteHintCreationErrorZ_free(_res: CResult_RouteHintCreationErrorZ) { }
2236 impl Drop for CResult_RouteHintCreationErrorZ {
2237         fn drop(&mut self) {
2238                 if self.result_ok {
2239                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2240                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2241                         }
2242                 } else {
2243                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2244                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2245                         }
2246                 }
2247         }
2248 }
2249 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>> for CResult_RouteHintCreationErrorZ {
2250         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>) -> Self {
2251                 let contents = if o.result_ok {
2252                         let result = unsafe { o.contents.result };
2253                         unsafe { o.contents.result = std::ptr::null_mut() };
2254                         CResult_RouteHintCreationErrorZPtr { result }
2255                 } else {
2256                         let err = unsafe { o.contents.err };
2257                         unsafe { o.contents.err = std::ptr::null_mut(); }
2258                         CResult_RouteHintCreationErrorZPtr { err }
2259                 };
2260                 Self {
2261                         contents,
2262                         result_ok: o.result_ok,
2263                 }
2264         }
2265 }
2266 impl Clone for CResult_RouteHintCreationErrorZ {
2267         fn clone(&self) -> Self {
2268                 if self.result_ok {
2269                         Self { result_ok: true, contents: CResult_RouteHintCreationErrorZPtr {
2270                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::RouteHint>::clone(unsafe { &*self.contents.result })))
2271                         } }
2272                 } else {
2273                         Self { result_ok: false, contents: CResult_RouteHintCreationErrorZPtr {
2274                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
2275                         } }
2276                 }
2277         }
2278 }
2279 #[no_mangle]
2280 /// Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
2281 /// but with all dynamically-allocated buffers duplicated in new buffers.
2282 pub extern "C" fn CResult_RouteHintCreationErrorZ_clone(orig: &CResult_RouteHintCreationErrorZ) -> CResult_RouteHintCreationErrorZ { orig.clone() }
2283 #[repr(C)]
2284 /// The contents of CResult_StringErrorZ
2285 pub union CResult_StringErrorZPtr {
2286         /// A pointer to the contents in the success state.
2287         /// Reading from this pointer when `result_ok` is not set is undefined.
2288         pub result: *mut crate::c_types::derived::CVec_u8Z,
2289         /// A pointer to the contents in the error state.
2290         /// Reading from this pointer when `result_ok` is set is undefined.
2291         pub err: *mut crate::c_types::Secp256k1Error,
2292 }
2293 #[repr(C)]
2294 /// A CResult_StringErrorZ represents the result of a fallible operation,
2295 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::Secp256k1Error on failure.
2296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2297 pub struct CResult_StringErrorZ {
2298         /// The contents of this CResult_StringErrorZ, accessible via either
2299         /// `err` or `result` depending on the state of `result_ok`.
2300         pub contents: CResult_StringErrorZPtr,
2301         /// Whether this CResult_StringErrorZ represents a success state.
2302         pub result_ok: bool,
2303 }
2304 #[no_mangle]
2305 /// Creates a new CResult_StringErrorZ in the success state.
2306 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_StringErrorZ {
2307         CResult_StringErrorZ {
2308                 contents: CResult_StringErrorZPtr {
2309                         result: Box::into_raw(Box::new(o)),
2310                 },
2311                 result_ok: true,
2312         }
2313 }
2314 #[no_mangle]
2315 /// Creates a new CResult_StringErrorZ in the error state.
2316 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
2317         CResult_StringErrorZ {
2318                 contents: CResult_StringErrorZPtr {
2319                         err: Box::into_raw(Box::new(e)),
2320                 },
2321                 result_ok: false,
2322         }
2323 }
2324 #[no_mangle]
2325 /// Frees any resources used by the CResult_StringErrorZ.
2326 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
2327 impl Drop for CResult_StringErrorZ {
2328         fn drop(&mut self) {
2329                 if self.result_ok {
2330                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2331                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2332                         }
2333                 } else {
2334                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2335                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2336                         }
2337                 }
2338         }
2339 }
2340 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
2341         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>) -> Self {
2342                 let contents = if o.result_ok {
2343                         let result = unsafe { o.contents.result };
2344                         unsafe { o.contents.result = std::ptr::null_mut() };
2345                         CResult_StringErrorZPtr { result }
2346                 } else {
2347                         let err = unsafe { o.contents.err };
2348                         unsafe { o.contents.err = std::ptr::null_mut(); }
2349                         CResult_StringErrorZPtr { err }
2350                 };
2351                 Self {
2352                         contents,
2353                         result_ok: o.result_ok,
2354                 }
2355         }
2356 }
2357 #[repr(C)]
2358 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
2359 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2360         /// A pointer to the contents in the success state.
2361         /// Reading from this pointer when `result_ok` is not set is undefined.
2362         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
2363         /// A pointer to the contents in the error state.
2364         /// Reading from this pointer when `result_ok` is set is undefined.
2365         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2366 }
2367 #[repr(C)]
2368 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
2369 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2370 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2371 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
2372         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
2373         /// `err` or `result` depending on the state of `result_ok`.
2374         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
2375         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
2376         pub result_ok: bool,
2377 }
2378 #[no_mangle]
2379 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
2380 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2381         CResult_ChannelMonitorUpdateDecodeErrorZ {
2382                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2383                         result: Box::into_raw(Box::new(o)),
2384                 },
2385                 result_ok: true,
2386         }
2387 }
2388 #[no_mangle]
2389 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
2390 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2391         CResult_ChannelMonitorUpdateDecodeErrorZ {
2392                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2393                         err: Box::into_raw(Box::new(e)),
2394                 },
2395                 result_ok: false,
2396         }
2397 }
2398 #[no_mangle]
2399 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
2400 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
2401 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
2402         fn drop(&mut self) {
2403                 if self.result_ok {
2404                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2405                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2406                         }
2407                 } else {
2408                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2409                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2410                         }
2411                 }
2412         }
2413 }
2414 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
2415         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
2416                 let contents = if o.result_ok {
2417                         let result = unsafe { o.contents.result };
2418                         unsafe { o.contents.result = std::ptr::null_mut() };
2419                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
2420                 } else {
2421                         let err = unsafe { o.contents.err };
2422                         unsafe { o.contents.err = std::ptr::null_mut(); }
2423                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
2424                 };
2425                 Self {
2426                         contents,
2427                         result_ok: o.result_ok,
2428                 }
2429         }
2430 }
2431 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
2432         fn clone(&self) -> Self {
2433                 if self.result_ok {
2434                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2435                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
2436                         } }
2437                 } else {
2438                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2439                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2440                         } }
2441                 }
2442         }
2443 }
2444 #[no_mangle]
2445 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
2446 /// but with all dynamically-allocated buffers duplicated in new buffers.
2447 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
2448 #[repr(C)]
2449 /// The contents of CResult_HTLCUpdateDecodeErrorZ
2450 pub union CResult_HTLCUpdateDecodeErrorZPtr {
2451         /// A pointer to the contents in the success state.
2452         /// Reading from this pointer when `result_ok` is not set is undefined.
2453         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
2454         /// A pointer to the contents in the error state.
2455         /// Reading from this pointer when `result_ok` is set is undefined.
2456         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2457 }
2458 #[repr(C)]
2459 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
2460 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
2461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2462 pub struct CResult_HTLCUpdateDecodeErrorZ {
2463         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
2464         /// `err` or `result` depending on the state of `result_ok`.
2465         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
2466         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
2467         pub result_ok: bool,
2468 }
2469 #[no_mangle]
2470 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
2471 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
2472         CResult_HTLCUpdateDecodeErrorZ {
2473                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2474                         result: Box::into_raw(Box::new(o)),
2475                 },
2476                 result_ok: true,
2477         }
2478 }
2479 #[no_mangle]
2480 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
2481 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
2482         CResult_HTLCUpdateDecodeErrorZ {
2483                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2484                         err: Box::into_raw(Box::new(e)),
2485                 },
2486                 result_ok: false,
2487         }
2488 }
2489 #[no_mangle]
2490 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
2491 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
2492 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
2493         fn drop(&mut self) {
2494                 if self.result_ok {
2495                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2496                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2497                         }
2498                 } else {
2499                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2500                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2501                         }
2502                 }
2503         }
2504 }
2505 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
2506         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
2507                 let contents = if o.result_ok {
2508                         let result = unsafe { o.contents.result };
2509                         unsafe { o.contents.result = std::ptr::null_mut() };
2510                         CResult_HTLCUpdateDecodeErrorZPtr { result }
2511                 } else {
2512                         let err = unsafe { o.contents.err };
2513                         unsafe { o.contents.err = std::ptr::null_mut(); }
2514                         CResult_HTLCUpdateDecodeErrorZPtr { err }
2515                 };
2516                 Self {
2517                         contents,
2518                         result_ok: o.result_ok,
2519                 }
2520         }
2521 }
2522 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
2523         fn clone(&self) -> Self {
2524                 if self.result_ok {
2525                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2526                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
2527                         } }
2528                 } else {
2529                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2530                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2531                         } }
2532                 }
2533         }
2534 }
2535 #[no_mangle]
2536 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
2537 /// but with all dynamically-allocated buffers duplicated in new buffers.
2538 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
2539 #[repr(C)]
2540 /// The contents of CResult_NoneMonitorUpdateErrorZ
2541 pub union CResult_NoneMonitorUpdateErrorZPtr {
2542         /// Note that this value is always NULL, as there are no contents in the OK variant
2543         pub result: *mut std::ffi::c_void,
2544         /// A pointer to the contents in the error state.
2545         /// Reading from this pointer when `result_ok` is set is undefined.
2546         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
2547 }
2548 #[repr(C)]
2549 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
2550 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
2551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2552 pub struct CResult_NoneMonitorUpdateErrorZ {
2553         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
2554         /// `err` or `result` depending on the state of `result_ok`.
2555         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
2556         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
2557         pub result_ok: bool,
2558 }
2559 #[no_mangle]
2560 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
2561 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
2562         CResult_NoneMonitorUpdateErrorZ {
2563                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2564                         result: std::ptr::null_mut(),
2565                 },
2566                 result_ok: true,
2567         }
2568 }
2569 #[no_mangle]
2570 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
2571 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
2572         CResult_NoneMonitorUpdateErrorZ {
2573                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2574                         err: Box::into_raw(Box::new(e)),
2575                 },
2576                 result_ok: false,
2577         }
2578 }
2579 #[no_mangle]
2580 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
2581 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
2582 impl Drop for CResult_NoneMonitorUpdateErrorZ {
2583         fn drop(&mut self) {
2584                 if self.result_ok {
2585                 } else {
2586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2588                         }
2589                 }
2590         }
2591 }
2592 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
2593         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
2594                 let contents = if o.result_ok {
2595                         let _ = unsafe { Box::from_raw(o.contents.result) };
2596                         o.contents.result = std::ptr::null_mut();
2597                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
2598                 } else {
2599                         let err = unsafe { o.contents.err };
2600                         unsafe { o.contents.err = std::ptr::null_mut(); }
2601                         CResult_NoneMonitorUpdateErrorZPtr { err }
2602                 };
2603                 Self {
2604                         contents,
2605                         result_ok: o.result_ok,
2606                 }
2607         }
2608 }
2609 impl Clone for CResult_NoneMonitorUpdateErrorZ {
2610         fn clone(&self) -> Self {
2611                 if self.result_ok {
2612                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
2613                                 result: std::ptr::null_mut()
2614                         } }
2615                 } else {
2616                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
2617                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
2618                         } }
2619                 }
2620         }
2621 }
2622 #[no_mangle]
2623 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
2624 /// but with all dynamically-allocated buffers duplicated in new buffers.
2625 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
2626 #[repr(C)]
2627 /// A tuple of 2 elements. See the individual fields for the types contained.
2628 pub struct C2Tuple_OutPointScriptZ {
2629         /// The element at position 0
2630         pub a: crate::lightning::chain::transaction::OutPoint,
2631         /// The element at position 1
2632         pub b: crate::c_types::derived::CVec_u8Z,
2633 }
2634 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
2635         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
2636                 Self {
2637                         a: tup.0,
2638                         b: tup.1,
2639                 }
2640         }
2641 }
2642 impl C2Tuple_OutPointScriptZ {
2643         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
2644                 (self.a, self.b)
2645         }
2646 }
2647 impl Clone for C2Tuple_OutPointScriptZ {
2648         fn clone(&self) -> Self {
2649                 Self {
2650                         a: self.a.clone(),
2651                         b: self.b.clone(),
2652                 }
2653         }
2654 }
2655 #[no_mangle]
2656 /// Creates a new tuple which has the same data as `orig`
2657 /// but with all dynamically-allocated buffers duplicated in new buffers.
2658 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
2659 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
2660 #[no_mangle]
2661 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
2662         C2Tuple_OutPointScriptZ { a, b, }
2663 }
2664
2665 #[no_mangle]
2666 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
2667 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
2668 #[repr(C)]
2669 /// A tuple of 2 elements. See the individual fields for the types contained.
2670 pub struct C2Tuple_u32ScriptZ {
2671         /// The element at position 0
2672         pub a: u32,
2673         /// The element at position 1
2674         pub b: crate::c_types::derived::CVec_u8Z,
2675 }
2676 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
2677         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
2678                 Self {
2679                         a: tup.0,
2680                         b: tup.1,
2681                 }
2682         }
2683 }
2684 impl C2Tuple_u32ScriptZ {
2685         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
2686                 (self.a, self.b)
2687         }
2688 }
2689 impl Clone for C2Tuple_u32ScriptZ {
2690         fn clone(&self) -> Self {
2691                 Self {
2692                         a: self.a.clone(),
2693                         b: self.b.clone(),
2694                 }
2695         }
2696 }
2697 #[no_mangle]
2698 /// Creates a new tuple which has the same data as `orig`
2699 /// but with all dynamically-allocated buffers duplicated in new buffers.
2700 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
2701 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
2702 #[no_mangle]
2703 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
2704         C2Tuple_u32ScriptZ { a, b, }
2705 }
2706
2707 #[no_mangle]
2708 /// Frees any resources used by the C2Tuple_u32ScriptZ.
2709 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
2710 #[repr(C)]
2711 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
2712 /// This corresponds to std::vector in C++
2713 pub struct CVec_C2Tuple_u32ScriptZZ {
2714         /// The elements in the array.
2715         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2716         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
2717         /// The number of elements pointed to by `data`.
2718         pub datalen: usize
2719 }
2720 impl CVec_C2Tuple_u32ScriptZZ {
2721         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
2722                 if self.datalen == 0 { return Vec::new(); }
2723                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2724                 self.data = std::ptr::null_mut();
2725                 self.datalen = 0;
2726                 ret
2727         }
2728         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
2729                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2730         }
2731 }
2732 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
2733         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
2734                 let datalen = v.len();
2735                 let data = Box::into_raw(v.into_boxed_slice());
2736                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2737         }
2738 }
2739 #[no_mangle]
2740 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2741 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
2742 impl Drop for CVec_C2Tuple_u32ScriptZZ {
2743         fn drop(&mut self) {
2744                 if self.datalen == 0 { return; }
2745                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2746         }
2747 }
2748 impl Clone for CVec_C2Tuple_u32ScriptZZ {
2749         fn clone(&self) -> Self {
2750                 let mut res = Vec::new();
2751                 if self.datalen == 0 { return Self::from(res); }
2752                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2753                 Self::from(res)
2754         }
2755 }
2756 #[repr(C)]
2757 /// A tuple of 2 elements. See the individual fields for the types contained.
2758 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2759         /// The element at position 0
2760         pub a: crate::c_types::ThirtyTwoBytes,
2761         /// The element at position 1
2762         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
2763 }
2764 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2765         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
2766                 Self {
2767                         a: tup.0,
2768                         b: tup.1,
2769                 }
2770         }
2771 }
2772 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2773         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
2774                 (self.a, self.b)
2775         }
2776 }
2777 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
2778 #[no_mangle]
2779 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 {
2780         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
2781 }
2782
2783 #[no_mangle]
2784 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
2785 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
2786 #[repr(C)]
2787 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
2788 /// This corresponds to std::vector in C++
2789 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2790         /// The elements in the array.
2791         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2792         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
2793         /// The number of elements pointed to by `data`.
2794         pub datalen: usize
2795 }
2796 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2797         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
2798                 if self.datalen == 0 { return Vec::new(); }
2799                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2800                 self.data = std::ptr::null_mut();
2801                 self.datalen = 0;
2802                 ret
2803         }
2804         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
2805                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2806         }
2807 }
2808 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2809         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
2810                 let datalen = v.len();
2811                 let data = Box::into_raw(v.into_boxed_slice());
2812                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2813         }
2814 }
2815 #[no_mangle]
2816 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2817 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
2818 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2819         fn drop(&mut self) {
2820                 if self.datalen == 0 { return; }
2821                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2822         }
2823 }
2824 #[repr(C)]
2825 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2826 /// This corresponds to std::vector in C++
2827 pub struct CVec_MonitorEventZ {
2828         /// The elements in the array.
2829         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2830         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2831         /// The number of elements pointed to by `data`.
2832         pub datalen: usize
2833 }
2834 impl CVec_MonitorEventZ {
2835         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2836                 if self.datalen == 0 { return Vec::new(); }
2837                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2838                 self.data = std::ptr::null_mut();
2839                 self.datalen = 0;
2840                 ret
2841         }
2842         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2843                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2844         }
2845 }
2846 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2847         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2848                 let datalen = v.len();
2849                 let data = Box::into_raw(v.into_boxed_slice());
2850                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2851         }
2852 }
2853 #[no_mangle]
2854 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2855 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2856 impl Drop for CVec_MonitorEventZ {
2857         fn drop(&mut self) {
2858                 if self.datalen == 0 { return; }
2859                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2860         }
2861 }
2862 impl Clone for CVec_MonitorEventZ {
2863         fn clone(&self) -> Self {
2864                 let mut res = Vec::new();
2865                 if self.datalen == 0 { return Self::from(res); }
2866                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2867                 Self::from(res)
2868         }
2869 }
2870 #[repr(C)]
2871 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
2872 /// This corresponds to std::vector in C++
2873 pub struct CVec_EventZ {
2874         /// The elements in the array.
2875         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2876         pub data: *mut crate::lightning::util::events::Event,
2877         /// The number of elements pointed to by `data`.
2878         pub datalen: usize
2879 }
2880 impl CVec_EventZ {
2881         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
2882                 if self.datalen == 0 { return Vec::new(); }
2883                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2884                 self.data = std::ptr::null_mut();
2885                 self.datalen = 0;
2886                 ret
2887         }
2888         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
2889                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2890         }
2891 }
2892 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
2893         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
2894                 let datalen = v.len();
2895                 let data = Box::into_raw(v.into_boxed_slice());
2896                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2897         }
2898 }
2899 #[no_mangle]
2900 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2901 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
2902 impl Drop for CVec_EventZ {
2903         fn drop(&mut self) {
2904                 if self.datalen == 0 { return; }
2905                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2906         }
2907 }
2908 impl Clone for CVec_EventZ {
2909         fn clone(&self) -> Self {
2910                 let mut res = Vec::new();
2911                 if self.datalen == 0 { return Self::from(res); }
2912                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2913                 Self::from(res)
2914         }
2915 }
2916 #[repr(C)]
2917 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
2918 /// This corresponds to std::vector in C++
2919 pub struct CVec_TransactionZ {
2920         /// The elements in the array.
2921         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2922         pub data: *mut crate::c_types::Transaction,
2923         /// The number of elements pointed to by `data`.
2924         pub datalen: usize
2925 }
2926 impl CVec_TransactionZ {
2927         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
2928                 if self.datalen == 0 { return Vec::new(); }
2929                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2930                 self.data = std::ptr::null_mut();
2931                 self.datalen = 0;
2932                 ret
2933         }
2934         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
2935                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2936         }
2937 }
2938 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
2939         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
2940                 let datalen = v.len();
2941                 let data = Box::into_raw(v.into_boxed_slice());
2942                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2943         }
2944 }
2945 #[no_mangle]
2946 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2947 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
2948 impl Drop for CVec_TransactionZ {
2949         fn drop(&mut self) {
2950                 if self.datalen == 0 { return; }
2951                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2952         }
2953 }
2954 #[repr(C)]
2955 /// A tuple of 2 elements. See the individual fields for the types contained.
2956 pub struct C2Tuple_usizeTransactionZ {
2957         /// The element at position 0
2958         pub a: usize,
2959         /// The element at position 1
2960         pub b: crate::c_types::Transaction,
2961 }
2962 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2963         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2964                 Self {
2965                         a: tup.0,
2966                         b: tup.1,
2967                 }
2968         }
2969 }
2970 impl C2Tuple_usizeTransactionZ {
2971         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2972                 (self.a, self.b)
2973         }
2974 }
2975 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2976 #[no_mangle]
2977 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2978         C2Tuple_usizeTransactionZ { a, b, }
2979 }
2980
2981 #[no_mangle]
2982 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2983 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2984 #[repr(C)]
2985 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2986 /// This corresponds to std::vector in C++
2987 pub struct CVec_C2Tuple_usizeTransactionZZ {
2988         /// The elements in the array.
2989         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2990         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2991         /// The number of elements pointed to by `data`.
2992         pub datalen: usize
2993 }
2994 impl CVec_C2Tuple_usizeTransactionZZ {
2995         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2996                 if self.datalen == 0 { return Vec::new(); }
2997                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2998                 self.data = std::ptr::null_mut();
2999                 self.datalen = 0;
3000                 ret
3001         }
3002         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3003                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3004         }
3005 }
3006 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3007         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3008                 let datalen = v.len();
3009                 let data = Box::into_raw(v.into_boxed_slice());
3010                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3011         }
3012 }
3013 #[no_mangle]
3014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3015 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3016 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3017         fn drop(&mut self) {
3018                 if self.datalen == 0 { return; }
3019                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3020         }
3021 }
3022 #[repr(C)]
3023 /// A tuple of 2 elements. See the individual fields for the types contained.
3024 pub struct C2Tuple_u32TxOutZ {
3025         /// The element at position 0
3026         pub a: u32,
3027         /// The element at position 1
3028         pub b: crate::c_types::TxOut,
3029 }
3030 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3031         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3032                 Self {
3033                         a: tup.0,
3034                         b: tup.1,
3035                 }
3036         }
3037 }
3038 impl C2Tuple_u32TxOutZ {
3039         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3040                 (self.a, self.b)
3041         }
3042 }
3043 impl Clone for C2Tuple_u32TxOutZ {
3044         fn clone(&self) -> Self {
3045                 Self {
3046                         a: self.a.clone(),
3047                         b: self.b.clone(),
3048                 }
3049         }
3050 }
3051 #[no_mangle]
3052 /// Creates a new tuple which has the same data as `orig`
3053 /// but with all dynamically-allocated buffers duplicated in new buffers.
3054 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3055 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
3056 #[no_mangle]
3057 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3058         C2Tuple_u32TxOutZ { a, b, }
3059 }
3060
3061 #[no_mangle]
3062 /// Frees any resources used by the C2Tuple_u32TxOutZ.
3063 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3064 #[repr(C)]
3065 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3066 /// This corresponds to std::vector in C++
3067 pub struct CVec_C2Tuple_u32TxOutZZ {
3068         /// The elements in the array.
3069         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3070         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3071         /// The number of elements pointed to by `data`.
3072         pub datalen: usize
3073 }
3074 impl CVec_C2Tuple_u32TxOutZZ {
3075         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3076                 if self.datalen == 0 { return Vec::new(); }
3077                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3078                 self.data = std::ptr::null_mut();
3079                 self.datalen = 0;
3080                 ret
3081         }
3082         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3083                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3084         }
3085 }
3086 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3087         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3088                 let datalen = v.len();
3089                 let data = Box::into_raw(v.into_boxed_slice());
3090                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3091         }
3092 }
3093 #[no_mangle]
3094 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3095 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3096 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3097         fn drop(&mut self) {
3098                 if self.datalen == 0 { return; }
3099                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3100         }
3101 }
3102 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3103         fn clone(&self) -> Self {
3104                 let mut res = Vec::new();
3105                 if self.datalen == 0 { return Self::from(res); }
3106                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3107                 Self::from(res)
3108         }
3109 }
3110 #[repr(C)]
3111 /// A tuple of 2 elements. See the individual fields for the types contained.
3112 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3113         /// The element at position 0
3114         pub a: crate::c_types::ThirtyTwoBytes,
3115         /// The element at position 1
3116         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3117 }
3118 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3119         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3120                 Self {
3121                         a: tup.0,
3122                         b: tup.1,
3123                 }
3124         }
3125 }
3126 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3127         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3128                 (self.a, self.b)
3129         }
3130 }
3131 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
3132 #[no_mangle]
3133 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 {
3134         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3135 }
3136
3137 #[no_mangle]
3138 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
3139 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3140 #[repr(C)]
3141 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3142 /// This corresponds to std::vector in C++
3143 pub struct CVec_TransactionOutputsZ {
3144         /// The elements in the array.
3145         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3146         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3147         /// The number of elements pointed to by `data`.
3148         pub datalen: usize
3149 }
3150 impl CVec_TransactionOutputsZ {
3151         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3152                 if self.datalen == 0 { return Vec::new(); }
3153                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3154                 self.data = std::ptr::null_mut();
3155                 self.datalen = 0;
3156                 ret
3157         }
3158         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3159                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3160         }
3161 }
3162 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
3163         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3164                 let datalen = v.len();
3165                 let data = Box::into_raw(v.into_boxed_slice());
3166                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3167         }
3168 }
3169 #[no_mangle]
3170 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3171 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
3172 impl Drop for CVec_TransactionOutputsZ {
3173         fn drop(&mut self) {
3174                 if self.datalen == 0 { return; }
3175                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3176         }
3177 }
3178 #[repr(C)]
3179 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3180 /// This corresponds to std::vector in C++
3181 pub struct CVec_TxidZ {
3182         /// The elements in the array.
3183         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3184         pub data: *mut crate::c_types::ThirtyTwoBytes,
3185         /// The number of elements pointed to by `data`.
3186         pub datalen: usize
3187 }
3188 impl CVec_TxidZ {
3189         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3190                 if self.datalen == 0 { return Vec::new(); }
3191                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3192                 self.data = std::ptr::null_mut();
3193                 self.datalen = 0;
3194                 ret
3195         }
3196         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3197                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3198         }
3199 }
3200 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3201         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3202                 let datalen = v.len();
3203                 let data = Box::into_raw(v.into_boxed_slice());
3204                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3205         }
3206 }
3207 #[no_mangle]
3208 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3209 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3210 impl Drop for CVec_TxidZ {
3211         fn drop(&mut self) {
3212                 if self.datalen == 0 { return; }
3213                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3214         }
3215 }
3216 #[repr(C)]
3217 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3218 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3219         /// Note that this value is always NULL, as there are no contents in the OK variant
3220         pub result: *mut std::ffi::c_void,
3221         /// A pointer to the contents in the error state.
3222         /// Reading from this pointer when `result_ok` is set is undefined.
3223         pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
3224 }
3225 #[repr(C)]
3226 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3227 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
3228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3229 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3230         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3231         /// `err` or `result` depending on the state of `result_ok`.
3232         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3233         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3234         pub result_ok: bool,
3235 }
3236 #[no_mangle]
3237 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3238 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3239         CResult_NoneChannelMonitorUpdateErrZ {
3240                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3241                         result: std::ptr::null_mut(),
3242                 },
3243                 result_ok: true,
3244         }
3245 }
3246 #[no_mangle]
3247 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3248 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3249         CResult_NoneChannelMonitorUpdateErrZ {
3250                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3251                         err: Box::into_raw(Box::new(e)),
3252                 },
3253                 result_ok: false,
3254         }
3255 }
3256 #[no_mangle]
3257 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3258 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3259 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3260         fn drop(&mut self) {
3261                 if self.result_ok {
3262                 } else {
3263                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3264                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3265                         }
3266                 }
3267         }
3268 }
3269 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3270         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
3271                 let contents = if o.result_ok {
3272                         let _ = unsafe { Box::from_raw(o.contents.result) };
3273                         o.contents.result = std::ptr::null_mut();
3274                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
3275                 } else {
3276                         let err = unsafe { o.contents.err };
3277                         unsafe { o.contents.err = std::ptr::null_mut(); }
3278                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3279                 };
3280                 Self {
3281                         contents,
3282                         result_ok: o.result_ok,
3283                 }
3284         }
3285 }
3286 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3287         fn clone(&self) -> Self {
3288                 if self.result_ok {
3289                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3290                                 result: std::ptr::null_mut()
3291                         } }
3292                 } else {
3293                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3294                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3295                         } }
3296                 }
3297         }
3298 }
3299 #[no_mangle]
3300 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3301 /// but with all dynamically-allocated buffers duplicated in new buffers.
3302 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
3303 #[repr(C)]
3304 /// A tuple of 2 elements. See the individual fields for the types contained.
3305 pub struct C2Tuple_BlockHashChannelMonitorZ {
3306         /// The element at position 0
3307         pub a: crate::c_types::ThirtyTwoBytes,
3308         /// The element at position 1
3309         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
3310 }
3311 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3312         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
3313                 Self {
3314                         a: tup.0,
3315                         b: tup.1,
3316                 }
3317         }
3318 }
3319 impl C2Tuple_BlockHashChannelMonitorZ {
3320         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
3321                 (self.a, self.b)
3322         }
3323 }
3324 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3325 #[no_mangle]
3326 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3327         C2Tuple_BlockHashChannelMonitorZ { a, b, }
3328 }
3329
3330 #[no_mangle]
3331 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3332 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3333 #[repr(C)]
3334 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3335 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3336         /// A pointer to the contents in the success state.
3337         /// Reading from this pointer when `result_ok` is not set is undefined.
3338         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3339         /// A pointer to the contents in the error state.
3340         /// Reading from this pointer when `result_ok` is set is undefined.
3341         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3342 }
3343 #[repr(C)]
3344 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
3345 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3347 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3348         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
3349         /// `err` or `result` depending on the state of `result_ok`.
3350         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
3351         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
3352         pub result_ok: bool,
3353 }
3354 #[no_mangle]
3355 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
3356 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3357         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3358                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3359                         result: Box::into_raw(Box::new(o)),
3360                 },
3361                 result_ok: true,
3362         }
3363 }
3364 #[no_mangle]
3365 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
3366 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3367         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3368                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3369                         err: Box::into_raw(Box::new(e)),
3370                 },
3371                 result_ok: false,
3372         }
3373 }
3374 #[no_mangle]
3375 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
3376 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
3377 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3378         fn drop(&mut self) {
3379                 if self.result_ok {
3380                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3381                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3382                         }
3383                 } else {
3384                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3385                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3386                         }
3387                 }
3388         }
3389 }
3390 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3391         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3392                 let contents = if o.result_ok {
3393                         let result = unsafe { o.contents.result };
3394                         unsafe { o.contents.result = std::ptr::null_mut() };
3395                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
3396                 } else {
3397                         let err = unsafe { o.contents.err };
3398                         unsafe { o.contents.err = std::ptr::null_mut(); }
3399                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
3400                 };
3401                 Self {
3402                         contents,
3403                         result_ok: o.result_ok,
3404                 }
3405         }
3406 }
3407 #[repr(C)]
3408 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3409 /// This corresponds to std::vector in C++
3410 pub struct CVec_RouteHopZ {
3411         /// The elements in the array.
3412         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3413         pub data: *mut crate::lightning::routing::router::RouteHop,
3414         /// The number of elements pointed to by `data`.
3415         pub datalen: usize
3416 }
3417 impl CVec_RouteHopZ {
3418         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3419                 if self.datalen == 0 { return Vec::new(); }
3420                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3421                 self.data = std::ptr::null_mut();
3422                 self.datalen = 0;
3423                 ret
3424         }
3425         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3426                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3427         }
3428 }
3429 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3430         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3431                 let datalen = v.len();
3432                 let data = Box::into_raw(v.into_boxed_slice());
3433                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3434         }
3435 }
3436 #[no_mangle]
3437 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3438 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3439 impl Drop for CVec_RouteHopZ {
3440         fn drop(&mut self) {
3441                 if self.datalen == 0 { return; }
3442                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3443         }
3444 }
3445 impl Clone for CVec_RouteHopZ {
3446         fn clone(&self) -> Self {
3447                 let mut res = Vec::new();
3448                 if self.datalen == 0 { return Self::from(res); }
3449                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3450                 Self::from(res)
3451         }
3452 }
3453 #[repr(C)]
3454 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
3455 /// This corresponds to std::vector in C++
3456 pub struct CVec_CVec_RouteHopZZ {
3457         /// The elements in the array.
3458         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3459         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3460         /// The number of elements pointed to by `data`.
3461         pub datalen: usize
3462 }
3463 impl CVec_CVec_RouteHopZZ {
3464         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3465                 if self.datalen == 0 { return Vec::new(); }
3466                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3467                 self.data = std::ptr::null_mut();
3468                 self.datalen = 0;
3469                 ret
3470         }
3471         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3472                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3473         }
3474 }
3475 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3476         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3477                 let datalen = v.len();
3478                 let data = Box::into_raw(v.into_boxed_slice());
3479                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3480         }
3481 }
3482 #[no_mangle]
3483 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3484 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3485 impl Drop for CVec_CVec_RouteHopZZ {
3486         fn drop(&mut self) {
3487                 if self.datalen == 0 { return; }
3488                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3489         }
3490 }
3491 impl Clone for CVec_CVec_RouteHopZZ {
3492         fn clone(&self) -> Self {
3493                 let mut res = Vec::new();
3494                 if self.datalen == 0 { return Self::from(res); }
3495                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3496                 Self::from(res)
3497         }
3498 }
3499 #[repr(C)]
3500 /// The contents of CResult_RouteDecodeErrorZ
3501 pub union CResult_RouteDecodeErrorZPtr {
3502         /// A pointer to the contents in the success state.
3503         /// Reading from this pointer when `result_ok` is not set is undefined.
3504         pub result: *mut crate::lightning::routing::router::Route,
3505         /// A pointer to the contents in the error state.
3506         /// Reading from this pointer when `result_ok` is set is undefined.
3507         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3508 }
3509 #[repr(C)]
3510 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3511 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3513 pub struct CResult_RouteDecodeErrorZ {
3514         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3515         /// `err` or `result` depending on the state of `result_ok`.
3516         pub contents: CResult_RouteDecodeErrorZPtr,
3517         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3518         pub result_ok: bool,
3519 }
3520 #[no_mangle]
3521 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3522 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3523         CResult_RouteDecodeErrorZ {
3524                 contents: CResult_RouteDecodeErrorZPtr {
3525                         result: Box::into_raw(Box::new(o)),
3526                 },
3527                 result_ok: true,
3528         }
3529 }
3530 #[no_mangle]
3531 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3532 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3533         CResult_RouteDecodeErrorZ {
3534                 contents: CResult_RouteDecodeErrorZPtr {
3535                         err: Box::into_raw(Box::new(e)),
3536                 },
3537                 result_ok: false,
3538         }
3539 }
3540 #[no_mangle]
3541 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3542 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3543 impl Drop for CResult_RouteDecodeErrorZ {
3544         fn drop(&mut self) {
3545                 if self.result_ok {
3546                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3547                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3548                         }
3549                 } else {
3550                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3551                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3552                         }
3553                 }
3554         }
3555 }
3556 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3557         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3558                 let contents = if o.result_ok {
3559                         let result = unsafe { o.contents.result };
3560                         unsafe { o.contents.result = std::ptr::null_mut() };
3561                         CResult_RouteDecodeErrorZPtr { result }
3562                 } else {
3563                         let err = unsafe { o.contents.err };
3564                         unsafe { o.contents.err = std::ptr::null_mut(); }
3565                         CResult_RouteDecodeErrorZPtr { err }
3566                 };
3567                 Self {
3568                         contents,
3569                         result_ok: o.result_ok,
3570                 }
3571         }
3572 }
3573 impl Clone for CResult_RouteDecodeErrorZ {
3574         fn clone(&self) -> Self {
3575                 if self.result_ok {
3576                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3577                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3578                         } }
3579                 } else {
3580                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3581                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3582                         } }
3583                 }
3584         }
3585 }
3586 #[no_mangle]
3587 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3588 /// but with all dynamically-allocated buffers duplicated in new buffers.
3589 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3590 #[repr(C)]
3591 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3592 /// This corresponds to std::vector in C++
3593 pub struct CVec_ChannelDetailsZ {
3594         /// The elements in the array.
3595         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3596         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3597         /// The number of elements pointed to by `data`.
3598         pub datalen: usize
3599 }
3600 impl CVec_ChannelDetailsZ {
3601         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3602                 if self.datalen == 0 { return Vec::new(); }
3603                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3604                 self.data = std::ptr::null_mut();
3605                 self.datalen = 0;
3606                 ret
3607         }
3608         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3609                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3610         }
3611 }
3612 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3613         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3614                 let datalen = v.len();
3615                 let data = Box::into_raw(v.into_boxed_slice());
3616                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3617         }
3618 }
3619 #[no_mangle]
3620 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3621 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3622 impl Drop for CVec_ChannelDetailsZ {
3623         fn drop(&mut self) {
3624                 if self.datalen == 0 { return; }
3625                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3626         }
3627 }
3628 impl Clone for CVec_ChannelDetailsZ {
3629         fn clone(&self) -> Self {
3630                 let mut res = Vec::new();
3631                 if self.datalen == 0 { return Self::from(res); }
3632                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3633                 Self::from(res)
3634         }
3635 }
3636 #[repr(C)]
3637 /// The contents of CResult_RouteLightningErrorZ
3638 pub union CResult_RouteLightningErrorZPtr {
3639         /// A pointer to the contents in the success state.
3640         /// Reading from this pointer when `result_ok` is not set is undefined.
3641         pub result: *mut crate::lightning::routing::router::Route,
3642         /// A pointer to the contents in the error state.
3643         /// Reading from this pointer when `result_ok` is set is undefined.
3644         pub err: *mut crate::lightning::ln::msgs::LightningError,
3645 }
3646 #[repr(C)]
3647 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3648 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3649 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3650 pub struct CResult_RouteLightningErrorZ {
3651         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3652         /// `err` or `result` depending on the state of `result_ok`.
3653         pub contents: CResult_RouteLightningErrorZPtr,
3654         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3655         pub result_ok: bool,
3656 }
3657 #[no_mangle]
3658 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3659 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3660         CResult_RouteLightningErrorZ {
3661                 contents: CResult_RouteLightningErrorZPtr {
3662                         result: Box::into_raw(Box::new(o)),
3663                 },
3664                 result_ok: true,
3665         }
3666 }
3667 #[no_mangle]
3668 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3669 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3670         CResult_RouteLightningErrorZ {
3671                 contents: CResult_RouteLightningErrorZPtr {
3672                         err: Box::into_raw(Box::new(e)),
3673                 },
3674                 result_ok: false,
3675         }
3676 }
3677 #[no_mangle]
3678 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3679 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3680 impl Drop for CResult_RouteLightningErrorZ {
3681         fn drop(&mut self) {
3682                 if self.result_ok {
3683                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3684                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3685                         }
3686                 } else {
3687                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3688                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3689                         }
3690                 }
3691         }
3692 }
3693 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3694         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3695                 let contents = if o.result_ok {
3696                         let result = unsafe { o.contents.result };
3697                         unsafe { o.contents.result = std::ptr::null_mut() };
3698                         CResult_RouteLightningErrorZPtr { result }
3699                 } else {
3700                         let err = unsafe { o.contents.err };
3701                         unsafe { o.contents.err = std::ptr::null_mut(); }
3702                         CResult_RouteLightningErrorZPtr { err }
3703                 };
3704                 Self {
3705                         contents,
3706                         result_ok: o.result_ok,
3707                 }
3708         }
3709 }
3710 impl Clone for CResult_RouteLightningErrorZ {
3711         fn clone(&self) -> Self {
3712                 if self.result_ok {
3713                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3714                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3715                         } }
3716                 } else {
3717                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3718                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3719                         } }
3720                 }
3721         }
3722 }
3723 #[no_mangle]
3724 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3725 /// but with all dynamically-allocated buffers duplicated in new buffers.
3726 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
3727 #[repr(C)]
3728 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3729 /// This corresponds to std::vector in C++
3730 pub struct CVec_MessageSendEventZ {
3731         /// The elements in the array.
3732         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3733         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3734         /// The number of elements pointed to by `data`.
3735         pub datalen: usize
3736 }
3737 impl CVec_MessageSendEventZ {
3738         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3739                 if self.datalen == 0 { return Vec::new(); }
3740                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3741                 self.data = std::ptr::null_mut();
3742                 self.datalen = 0;
3743                 ret
3744         }
3745         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3746                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3747         }
3748 }
3749 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3750         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3751                 let datalen = v.len();
3752                 let data = Box::into_raw(v.into_boxed_slice());
3753                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3754         }
3755 }
3756 #[no_mangle]
3757 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3758 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3759 impl Drop for CVec_MessageSendEventZ {
3760         fn drop(&mut self) {
3761                 if self.datalen == 0 { return; }
3762                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3763         }
3764 }
3765 impl Clone for CVec_MessageSendEventZ {
3766         fn clone(&self) -> Self {
3767                 let mut res = Vec::new();
3768                 if self.datalen == 0 { return Self::from(res); }
3769                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3770                 Self::from(res)
3771         }
3772 }
3773 #[repr(C)]
3774 /// The contents of CResult_boolLightningErrorZ
3775 pub union CResult_boolLightningErrorZPtr {
3776         /// A pointer to the contents in the success state.
3777         /// Reading from this pointer when `result_ok` is not set is undefined.
3778         pub result: *mut bool,
3779         /// A pointer to the contents in the error state.
3780         /// Reading from this pointer when `result_ok` is set is undefined.
3781         pub err: *mut crate::lightning::ln::msgs::LightningError,
3782 }
3783 #[repr(C)]
3784 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
3785 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
3786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3787 pub struct CResult_boolLightningErrorZ {
3788         /// The contents of this CResult_boolLightningErrorZ, accessible via either
3789         /// `err` or `result` depending on the state of `result_ok`.
3790         pub contents: CResult_boolLightningErrorZPtr,
3791         /// Whether this CResult_boolLightningErrorZ represents a success state.
3792         pub result_ok: bool,
3793 }
3794 #[no_mangle]
3795 /// Creates a new CResult_boolLightningErrorZ in the success state.
3796 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
3797         CResult_boolLightningErrorZ {
3798                 contents: CResult_boolLightningErrorZPtr {
3799                         result: Box::into_raw(Box::new(o)),
3800                 },
3801                 result_ok: true,
3802         }
3803 }
3804 #[no_mangle]
3805 /// Creates a new CResult_boolLightningErrorZ in the error state.
3806 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
3807         CResult_boolLightningErrorZ {
3808                 contents: CResult_boolLightningErrorZPtr {
3809                         err: Box::into_raw(Box::new(e)),
3810                 },
3811                 result_ok: false,
3812         }
3813 }
3814 #[no_mangle]
3815 /// Frees any resources used by the CResult_boolLightningErrorZ.
3816 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
3817 impl Drop for CResult_boolLightningErrorZ {
3818         fn drop(&mut self) {
3819                 if self.result_ok {
3820                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3821                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3822                         }
3823                 } else {
3824                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3825                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3826                         }
3827                 }
3828         }
3829 }
3830 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
3831         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
3832                 let contents = if o.result_ok {
3833                         let result = unsafe { o.contents.result };
3834                         unsafe { o.contents.result = std::ptr::null_mut() };
3835                         CResult_boolLightningErrorZPtr { result }
3836                 } else {
3837                         let err = unsafe { o.contents.err };
3838                         unsafe { o.contents.err = std::ptr::null_mut(); }
3839                         CResult_boolLightningErrorZPtr { err }
3840                 };
3841                 Self {
3842                         contents,
3843                         result_ok: o.result_ok,
3844                 }
3845         }
3846 }
3847 impl Clone for CResult_boolLightningErrorZ {
3848         fn clone(&self) -> Self {
3849                 if self.result_ok {
3850                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
3851                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
3852                         } }
3853                 } else {
3854                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
3855                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3856                         } }
3857                 }
3858         }
3859 }
3860 #[no_mangle]
3861 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
3862 /// but with all dynamically-allocated buffers duplicated in new buffers.
3863 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
3864 #[repr(C)]
3865 /// A tuple of 3 elements. See the individual fields for the types contained.
3866 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3867         /// The element at position 0
3868         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
3869         /// The element at position 1
3870         pub b: crate::lightning::ln::msgs::ChannelUpdate,
3871         /// The element at position 2
3872         pub c: crate::lightning::ln::msgs::ChannelUpdate,
3873 }
3874 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3875         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
3876                 Self {
3877                         a: tup.0,
3878                         b: tup.1,
3879                         c: tup.2,
3880                 }
3881         }
3882 }
3883 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3884         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
3885                 (self.a, self.b, self.c)
3886         }
3887 }
3888 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3889         fn clone(&self) -> Self {
3890                 Self {
3891                         a: self.a.clone(),
3892                         b: self.b.clone(),
3893                         c: self.c.clone(),
3894                 }
3895         }
3896 }
3897 #[no_mangle]
3898 /// Creates a new tuple which has the same data as `orig`
3899 /// but with all dynamically-allocated buffers duplicated in new buffers.
3900 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
3901 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
3902 #[no_mangle]
3903 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 {
3904         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
3905 }
3906
3907 #[no_mangle]
3908 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
3909 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
3910 #[repr(C)]
3911 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
3912 /// This corresponds to std::vector in C++
3913 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3914         /// The elements in the array.
3915         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3916         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
3917         /// The number of elements pointed to by `data`.
3918         pub datalen: usize
3919 }
3920 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3921         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
3922                 if self.datalen == 0 { return Vec::new(); }
3923                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3924                 self.data = std::ptr::null_mut();
3925                 self.datalen = 0;
3926                 ret
3927         }
3928         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
3929                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3930         }
3931 }
3932 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3933         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
3934                 let datalen = v.len();
3935                 let data = Box::into_raw(v.into_boxed_slice());
3936                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3937         }
3938 }
3939 #[no_mangle]
3940 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3941 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
3942 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3943         fn drop(&mut self) {
3944                 if self.datalen == 0 { return; }
3945                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3946         }
3947 }
3948 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3949         fn clone(&self) -> Self {
3950                 let mut res = Vec::new();
3951                 if self.datalen == 0 { return Self::from(res); }
3952                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3953                 Self::from(res)
3954         }
3955 }
3956 #[repr(C)]
3957 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3958 /// This corresponds to std::vector in C++
3959 pub struct CVec_NodeAnnouncementZ {
3960         /// The elements in the array.
3961         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3962         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
3963         /// The number of elements pointed to by `data`.
3964         pub datalen: usize
3965 }
3966 impl CVec_NodeAnnouncementZ {
3967         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
3968                 if self.datalen == 0 { return Vec::new(); }
3969                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3970                 self.data = std::ptr::null_mut();
3971                 self.datalen = 0;
3972                 ret
3973         }
3974         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
3975                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3976         }
3977 }
3978 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
3979         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
3980                 let datalen = v.len();
3981                 let data = Box::into_raw(v.into_boxed_slice());
3982                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3983         }
3984 }
3985 #[no_mangle]
3986 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3987 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
3988 impl Drop for CVec_NodeAnnouncementZ {
3989         fn drop(&mut self) {
3990                 if self.datalen == 0 { return; }
3991                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3992         }
3993 }
3994 impl Clone for CVec_NodeAnnouncementZ {
3995         fn clone(&self) -> Self {
3996                 let mut res = Vec::new();
3997                 if self.datalen == 0 { return Self::from(res); }
3998                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3999                 Self::from(res)
4000         }
4001 }
4002 #[repr(C)]
4003 /// The contents of CResult_NoneLightningErrorZ
4004 pub union CResult_NoneLightningErrorZPtr {
4005         /// Note that this value is always NULL, as there are no contents in the OK variant
4006         pub result: *mut std::ffi::c_void,
4007         /// A pointer to the contents in the error state.
4008         /// Reading from this pointer when `result_ok` is set is undefined.
4009         pub err: *mut crate::lightning::ln::msgs::LightningError,
4010 }
4011 #[repr(C)]
4012 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4013 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4015 pub struct CResult_NoneLightningErrorZ {
4016         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
4017         /// `err` or `result` depending on the state of `result_ok`.
4018         pub contents: CResult_NoneLightningErrorZPtr,
4019         /// Whether this CResult_NoneLightningErrorZ represents a success state.
4020         pub result_ok: bool,
4021 }
4022 #[no_mangle]
4023 /// Creates a new CResult_NoneLightningErrorZ in the success state.
4024 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
4025         CResult_NoneLightningErrorZ {
4026                 contents: CResult_NoneLightningErrorZPtr {
4027                         result: std::ptr::null_mut(),
4028                 },
4029                 result_ok: true,
4030         }
4031 }
4032 #[no_mangle]
4033 /// Creates a new CResult_NoneLightningErrorZ in the error state.
4034 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
4035         CResult_NoneLightningErrorZ {
4036                 contents: CResult_NoneLightningErrorZPtr {
4037                         err: Box::into_raw(Box::new(e)),
4038                 },
4039                 result_ok: false,
4040         }
4041 }
4042 #[no_mangle]
4043 /// Frees any resources used by the CResult_NoneLightningErrorZ.
4044 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
4045 impl Drop for CResult_NoneLightningErrorZ {
4046         fn drop(&mut self) {
4047                 if self.result_ok {
4048                 } else {
4049                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4050                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4051                         }
4052                 }
4053         }
4054 }
4055 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
4056         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>) -> Self {
4057                 let contents = if o.result_ok {
4058                         let _ = unsafe { Box::from_raw(o.contents.result) };
4059                         o.contents.result = std::ptr::null_mut();
4060                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
4061                 } else {
4062                         let err = unsafe { o.contents.err };
4063                         unsafe { o.contents.err = std::ptr::null_mut(); }
4064                         CResult_NoneLightningErrorZPtr { err }
4065                 };
4066                 Self {
4067                         contents,
4068                         result_ok: o.result_ok,
4069                 }
4070         }
4071 }
4072 impl Clone for CResult_NoneLightningErrorZ {
4073         fn clone(&self) -> Self {
4074                 if self.result_ok {
4075                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
4076                                 result: std::ptr::null_mut()
4077                         } }
4078                 } else {
4079                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
4080                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4081                         } }
4082                 }
4083         }
4084 }
4085 #[no_mangle]
4086 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
4087 /// but with all dynamically-allocated buffers duplicated in new buffers.
4088 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
4089 #[repr(C)]
4090 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4091 /// This corresponds to std::vector in C++
4092 pub struct CVec_PublicKeyZ {
4093         /// The elements in the array.
4094         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4095         pub data: *mut crate::c_types::PublicKey,
4096         /// The number of elements pointed to by `data`.
4097         pub datalen: usize
4098 }
4099 impl CVec_PublicKeyZ {
4100         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4101                 if self.datalen == 0 { return Vec::new(); }
4102                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4103                 self.data = std::ptr::null_mut();
4104                 self.datalen = 0;
4105                 ret
4106         }
4107         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4108                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4109         }
4110 }
4111 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4112         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4113                 let datalen = v.len();
4114                 let data = Box::into_raw(v.into_boxed_slice());
4115                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4116         }
4117 }
4118 #[no_mangle]
4119 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4120 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4121 impl Drop for CVec_PublicKeyZ {
4122         fn drop(&mut self) {
4123                 if self.datalen == 0 { return; }
4124                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4125         }
4126 }
4127 #[repr(C)]
4128 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
4129 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
4130         /// A pointer to the contents in the success state.
4131         /// Reading from this pointer when `result_ok` is not set is undefined.
4132         pub result: *mut crate::c_types::derived::CVec_u8Z,
4133         /// A pointer to the contents in the error state.
4134         /// Reading from this pointer when `result_ok` is set is undefined.
4135         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4136 }
4137 #[repr(C)]
4138 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
4139 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4141 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
4142         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
4143         /// `err` or `result` depending on the state of `result_ok`.
4144         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
4145         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
4146         pub result_ok: bool,
4147 }
4148 #[no_mangle]
4149 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
4150 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
4151         CResult_CVec_u8ZPeerHandleErrorZ {
4152                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4153                         result: Box::into_raw(Box::new(o)),
4154                 },
4155                 result_ok: true,
4156         }
4157 }
4158 #[no_mangle]
4159 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
4160 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
4161         CResult_CVec_u8ZPeerHandleErrorZ {
4162                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4163                         err: Box::into_raw(Box::new(e)),
4164                 },
4165                 result_ok: false,
4166         }
4167 }
4168 #[no_mangle]
4169 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
4170 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
4171 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
4172         fn drop(&mut self) {
4173                 if self.result_ok {
4174                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4175                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4176                         }
4177                 } else {
4178                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4179                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4180                         }
4181                 }
4182         }
4183 }
4184 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
4185         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4186                 let contents = if o.result_ok {
4187                         let result = unsafe { o.contents.result };
4188                         unsafe { o.contents.result = std::ptr::null_mut() };
4189                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
4190                 } else {
4191                         let err = unsafe { o.contents.err };
4192                         unsafe { o.contents.err = std::ptr::null_mut(); }
4193                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
4194                 };
4195                 Self {
4196                         contents,
4197                         result_ok: o.result_ok,
4198                 }
4199         }
4200 }
4201 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
4202         fn clone(&self) -> Self {
4203                 if self.result_ok {
4204                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4205                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
4206                         } }
4207                 } else {
4208                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
4209                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4210                         } }
4211                 }
4212         }
4213 }
4214 #[no_mangle]
4215 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
4216 /// but with all dynamically-allocated buffers duplicated in new buffers.
4217 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
4218 #[repr(C)]
4219 /// The contents of CResult_NonePeerHandleErrorZ
4220 pub union CResult_NonePeerHandleErrorZPtr {
4221         /// Note that this value is always NULL, as there are no contents in the OK variant
4222         pub result: *mut std::ffi::c_void,
4223         /// A pointer to the contents in the error state.
4224         /// Reading from this pointer when `result_ok` is set is undefined.
4225         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4226 }
4227 #[repr(C)]
4228 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
4229 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4231 pub struct CResult_NonePeerHandleErrorZ {
4232         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
4233         /// `err` or `result` depending on the state of `result_ok`.
4234         pub contents: CResult_NonePeerHandleErrorZPtr,
4235         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
4236         pub result_ok: bool,
4237 }
4238 #[no_mangle]
4239 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
4240 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
4241         CResult_NonePeerHandleErrorZ {
4242                 contents: CResult_NonePeerHandleErrorZPtr {
4243                         result: std::ptr::null_mut(),
4244                 },
4245                 result_ok: true,
4246         }
4247 }
4248 #[no_mangle]
4249 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
4250 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
4251         CResult_NonePeerHandleErrorZ {
4252                 contents: CResult_NonePeerHandleErrorZPtr {
4253                         err: Box::into_raw(Box::new(e)),
4254                 },
4255                 result_ok: false,
4256         }
4257 }
4258 #[no_mangle]
4259 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
4260 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
4261 impl Drop for CResult_NonePeerHandleErrorZ {
4262         fn drop(&mut self) {
4263                 if self.result_ok {
4264                 } else {
4265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4267                         }
4268                 }
4269         }
4270 }
4271 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
4272         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4273                 let contents = if o.result_ok {
4274                         let _ = unsafe { Box::from_raw(o.contents.result) };
4275                         o.contents.result = std::ptr::null_mut();
4276                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
4277                 } else {
4278                         let err = unsafe { o.contents.err };
4279                         unsafe { o.contents.err = std::ptr::null_mut(); }
4280                         CResult_NonePeerHandleErrorZPtr { err }
4281                 };
4282                 Self {
4283                         contents,
4284                         result_ok: o.result_ok,
4285                 }
4286         }
4287 }
4288 impl Clone for CResult_NonePeerHandleErrorZ {
4289         fn clone(&self) -> Self {
4290                 if self.result_ok {
4291                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
4292                                 result: std::ptr::null_mut()
4293                         } }
4294                 } else {
4295                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
4296                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4297                         } }
4298                 }
4299         }
4300 }
4301 #[no_mangle]
4302 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
4303 /// but with all dynamically-allocated buffers duplicated in new buffers.
4304 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
4305 #[repr(C)]
4306 /// The contents of CResult_boolPeerHandleErrorZ
4307 pub union CResult_boolPeerHandleErrorZPtr {
4308         /// A pointer to the contents in the success state.
4309         /// Reading from this pointer when `result_ok` is not set is undefined.
4310         pub result: *mut bool,
4311         /// A pointer to the contents in the error state.
4312         /// Reading from this pointer when `result_ok` is set is undefined.
4313         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
4314 }
4315 #[repr(C)]
4316 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
4317 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
4318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4319 pub struct CResult_boolPeerHandleErrorZ {
4320         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
4321         /// `err` or `result` depending on the state of `result_ok`.
4322         pub contents: CResult_boolPeerHandleErrorZPtr,
4323         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
4324         pub result_ok: bool,
4325 }
4326 #[no_mangle]
4327 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
4328 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
4329         CResult_boolPeerHandleErrorZ {
4330                 contents: CResult_boolPeerHandleErrorZPtr {
4331                         result: Box::into_raw(Box::new(o)),
4332                 },
4333                 result_ok: true,
4334         }
4335 }
4336 #[no_mangle]
4337 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
4338 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
4339         CResult_boolPeerHandleErrorZ {
4340                 contents: CResult_boolPeerHandleErrorZPtr {
4341                         err: Box::into_raw(Box::new(e)),
4342                 },
4343                 result_ok: false,
4344         }
4345 }
4346 #[no_mangle]
4347 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
4348 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
4349 impl Drop for CResult_boolPeerHandleErrorZ {
4350         fn drop(&mut self) {
4351                 if self.result_ok {
4352                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4353                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4354                         }
4355                 } else {
4356                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4357                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4358                         }
4359                 }
4360         }
4361 }
4362 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
4363         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
4364                 let contents = if o.result_ok {
4365                         let result = unsafe { o.contents.result };
4366                         unsafe { o.contents.result = std::ptr::null_mut() };
4367                         CResult_boolPeerHandleErrorZPtr { result }
4368                 } else {
4369                         let err = unsafe { o.contents.err };
4370                         unsafe { o.contents.err = std::ptr::null_mut(); }
4371                         CResult_boolPeerHandleErrorZPtr { err }
4372                 };
4373                 Self {
4374                         contents,
4375                         result_ok: o.result_ok,
4376                 }
4377         }
4378 }
4379 impl Clone for CResult_boolPeerHandleErrorZ {
4380         fn clone(&self) -> Self {
4381                 if self.result_ok {
4382                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
4383                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4384                         } }
4385                 } else {
4386                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
4387                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
4388                         } }
4389                 }
4390         }
4391 }
4392 #[no_mangle]
4393 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
4394 /// but with all dynamically-allocated buffers duplicated in new buffers.
4395 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
4396 #[repr(C)]
4397 /// The contents of CResult_TxOutAccessErrorZ
4398 pub union CResult_TxOutAccessErrorZPtr {
4399         /// A pointer to the contents in the success state.
4400         /// Reading from this pointer when `result_ok` is not set is undefined.
4401         pub result: *mut crate::c_types::TxOut,
4402         /// A pointer to the contents in the error state.
4403         /// Reading from this pointer when `result_ok` is set is undefined.
4404         pub err: *mut crate::lightning::chain::AccessError,
4405 }
4406 #[repr(C)]
4407 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4408 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410 pub struct CResult_TxOutAccessErrorZ {
4411         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4412         /// `err` or `result` depending on the state of `result_ok`.
4413         pub contents: CResult_TxOutAccessErrorZPtr,
4414         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4415         pub result_ok: bool,
4416 }
4417 #[no_mangle]
4418 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4419 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4420         CResult_TxOutAccessErrorZ {
4421                 contents: CResult_TxOutAccessErrorZPtr {
4422                         result: Box::into_raw(Box::new(o)),
4423                 },
4424                 result_ok: true,
4425         }
4426 }
4427 #[no_mangle]
4428 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4429 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4430         CResult_TxOutAccessErrorZ {
4431                 contents: CResult_TxOutAccessErrorZPtr {
4432                         err: Box::into_raw(Box::new(e)),
4433                 },
4434                 result_ok: false,
4435         }
4436 }
4437 #[no_mangle]
4438 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
4439 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4440 impl Drop for CResult_TxOutAccessErrorZ {
4441         fn drop(&mut self) {
4442                 if self.result_ok {
4443                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4444                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4445                         }
4446                 } else {
4447                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4448                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4449                         }
4450                 }
4451         }
4452 }
4453 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4454         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
4455                 let contents = if o.result_ok {
4456                         let result = unsafe { o.contents.result };
4457                         unsafe { o.contents.result = std::ptr::null_mut() };
4458                         CResult_TxOutAccessErrorZPtr { result }
4459                 } else {
4460                         let err = unsafe { o.contents.err };
4461                         unsafe { o.contents.err = std::ptr::null_mut(); }
4462                         CResult_TxOutAccessErrorZPtr { err }
4463                 };
4464                 Self {
4465                         contents,
4466                         result_ok: o.result_ok,
4467                 }
4468         }
4469 }
4470 impl Clone for CResult_TxOutAccessErrorZ {
4471         fn clone(&self) -> Self {
4472                 if self.result_ok {
4473                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4474                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4475                         } }
4476                 } else {
4477                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4478                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4479                         } }
4480                 }
4481         }
4482 }
4483 #[no_mangle]
4484 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4485 /// but with all dynamically-allocated buffers duplicated in new buffers.
4486 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4487 #[repr(C)]
4488 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4489 pub enum COption_C2Tuple_usizeTransactionZZ {
4490         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4491         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4492         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4493         None
4494 }
4495 impl COption_C2Tuple_usizeTransactionZZ {
4496         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4497                 if let Self::Some(_) = self { true } else { false }
4498         }
4499         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4500                 if let Self::Some(v) = self { v } else { unreachable!() }
4501         }
4502 }
4503 #[no_mangle]
4504 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4505 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4506         COption_C2Tuple_usizeTransactionZZ::Some(o)
4507 }
4508 #[no_mangle]
4509 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4510 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4511         COption_C2Tuple_usizeTransactionZZ::None
4512 }
4513 #[no_mangle]
4514 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4515 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4516 #[repr(C)]
4517 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4518 /// This corresponds to std::vector in C++
4519 pub struct CVec_SpendableOutputDescriptorZ {
4520         /// The elements in the array.
4521         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4522         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4523         /// The number of elements pointed to by `data`.
4524         pub datalen: usize
4525 }
4526 impl CVec_SpendableOutputDescriptorZ {
4527         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
4528                 if self.datalen == 0 { return Vec::new(); }
4529                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4530                 self.data = std::ptr::null_mut();
4531                 self.datalen = 0;
4532                 ret
4533         }
4534         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
4535                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4536         }
4537 }
4538 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4539         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4540                 let datalen = v.len();
4541                 let data = Box::into_raw(v.into_boxed_slice());
4542                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4543         }
4544 }
4545 #[no_mangle]
4546 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4547 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4548 impl Drop for CVec_SpendableOutputDescriptorZ {
4549         fn drop(&mut self) {
4550                 if self.datalen == 0 { return; }
4551                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4552         }
4553 }
4554 impl Clone for CVec_SpendableOutputDescriptorZ {
4555         fn clone(&self) -> Self {
4556                 let mut res = Vec::new();
4557                 if self.datalen == 0 { return Self::from(res); }
4558                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4559                 Self::from(res)
4560         }
4561 }
4562 #[repr(C)]
4563 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
4564 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
4565         /// A pointer to the contents in the success state.
4566         /// Reading from this pointer when `result_ok` is not set is undefined.
4567         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
4568         /// A pointer to the contents in the error state.
4569         /// Reading from this pointer when `result_ok` is set is undefined.
4570         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4571 }
4572 #[repr(C)]
4573 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
4574 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4576 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
4577         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
4578         /// `err` or `result` depending on the state of `result_ok`.
4579         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
4580         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
4581         pub result_ok: bool,
4582 }
4583 #[no_mangle]
4584 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
4585 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4586         CResult_DirectionalChannelInfoDecodeErrorZ {
4587                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4588                         result: Box::into_raw(Box::new(o)),
4589                 },
4590                 result_ok: true,
4591         }
4592 }
4593 #[no_mangle]
4594 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
4595 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
4596         CResult_DirectionalChannelInfoDecodeErrorZ {
4597                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4598                         err: Box::into_raw(Box::new(e)),
4599                 },
4600                 result_ok: false,
4601         }
4602 }
4603 #[no_mangle]
4604 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
4605 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
4606 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
4607         fn drop(&mut self) {
4608                 if self.result_ok {
4609                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4610                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4611                         }
4612                 } else {
4613                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4614                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4615                         }
4616                 }
4617         }
4618 }
4619 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
4620         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4621                 let contents = if o.result_ok {
4622                         let result = unsafe { o.contents.result };
4623                         unsafe { o.contents.result = std::ptr::null_mut() };
4624                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
4625                 } else {
4626                         let err = unsafe { o.contents.err };
4627                         unsafe { o.contents.err = std::ptr::null_mut(); }
4628                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
4629                 };
4630                 Self {
4631                         contents,
4632                         result_ok: o.result_ok,
4633                 }
4634         }
4635 }
4636 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
4637         fn clone(&self) -> Self {
4638                 if self.result_ok {
4639                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4640                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
4641                         } }
4642                 } else {
4643                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
4644                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4645                         } }
4646                 }
4647         }
4648 }
4649 #[no_mangle]
4650 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
4651 /// but with all dynamically-allocated buffers duplicated in new buffers.
4652 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
4653 #[repr(C)]
4654 /// The contents of CResult_ChannelInfoDecodeErrorZ
4655 pub union CResult_ChannelInfoDecodeErrorZPtr {
4656         /// A pointer to the contents in the success state.
4657         /// Reading from this pointer when `result_ok` is not set is undefined.
4658         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
4659         /// A pointer to the contents in the error state.
4660         /// Reading from this pointer when `result_ok` is set is undefined.
4661         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4662 }
4663 #[repr(C)]
4664 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
4665 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4667 pub struct CResult_ChannelInfoDecodeErrorZ {
4668         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
4669         /// `err` or `result` depending on the state of `result_ok`.
4670         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
4671         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
4672         pub result_ok: bool,
4673 }
4674 #[no_mangle]
4675 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
4676 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
4677         CResult_ChannelInfoDecodeErrorZ {
4678                 contents: CResult_ChannelInfoDecodeErrorZPtr {
4679                         result: Box::into_raw(Box::new(o)),
4680                 },
4681                 result_ok: true,
4682         }
4683 }
4684 #[no_mangle]
4685 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
4686 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
4687         CResult_ChannelInfoDecodeErrorZ {
4688                 contents: CResult_ChannelInfoDecodeErrorZPtr {
4689                         err: Box::into_raw(Box::new(e)),
4690                 },
4691                 result_ok: false,
4692         }
4693 }
4694 #[no_mangle]
4695 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
4696 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
4697 impl Drop for CResult_ChannelInfoDecodeErrorZ {
4698         fn drop(&mut self) {
4699                 if self.result_ok {
4700                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4701                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4702                         }
4703                 } else {
4704                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4705                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4706                         }
4707                 }
4708         }
4709 }
4710 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
4711         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4712                 let contents = if o.result_ok {
4713                         let result = unsafe { o.contents.result };
4714                         unsafe { o.contents.result = std::ptr::null_mut() };
4715                         CResult_ChannelInfoDecodeErrorZPtr { result }
4716                 } else {
4717                         let err = unsafe { o.contents.err };
4718                         unsafe { o.contents.err = std::ptr::null_mut(); }
4719                         CResult_ChannelInfoDecodeErrorZPtr { err }
4720                 };
4721                 Self {
4722                         contents,
4723                         result_ok: o.result_ok,
4724                 }
4725         }
4726 }
4727 impl Clone for CResult_ChannelInfoDecodeErrorZ {
4728         fn clone(&self) -> Self {
4729                 if self.result_ok {
4730                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
4731                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
4732                         } }
4733                 } else {
4734                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
4735                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4736                         } }
4737                 }
4738         }
4739 }
4740 #[no_mangle]
4741 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
4742 /// but with all dynamically-allocated buffers duplicated in new buffers.
4743 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
4744 #[repr(C)]
4745 /// The contents of CResult_RoutingFeesDecodeErrorZ
4746 pub union CResult_RoutingFeesDecodeErrorZPtr {
4747         /// A pointer to the contents in the success state.
4748         /// Reading from this pointer when `result_ok` is not set is undefined.
4749         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
4750         /// A pointer to the contents in the error state.
4751         /// Reading from this pointer when `result_ok` is set is undefined.
4752         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4753 }
4754 #[repr(C)]
4755 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
4756 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
4757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4758 pub struct CResult_RoutingFeesDecodeErrorZ {
4759         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
4760         /// `err` or `result` depending on the state of `result_ok`.
4761         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
4762         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
4763         pub result_ok: bool,
4764 }
4765 #[no_mangle]
4766 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
4767 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
4768         CResult_RoutingFeesDecodeErrorZ {
4769                 contents: CResult_RoutingFeesDecodeErrorZPtr {
4770                         result: Box::into_raw(Box::new(o)),
4771                 },
4772                 result_ok: true,
4773         }
4774 }
4775 #[no_mangle]
4776 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
4777 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
4778         CResult_RoutingFeesDecodeErrorZ {
4779                 contents: CResult_RoutingFeesDecodeErrorZPtr {
4780                         err: Box::into_raw(Box::new(e)),
4781                 },
4782                 result_ok: false,
4783         }
4784 }
4785 #[no_mangle]
4786 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
4787 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
4788 impl Drop for CResult_RoutingFeesDecodeErrorZ {
4789         fn drop(&mut self) {
4790                 if self.result_ok {
4791                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4792                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4793                         }
4794                 } else {
4795                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4796                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4797                         }
4798                 }
4799         }
4800 }
4801 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
4802         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
4803                 let contents = if o.result_ok {
4804                         let result = unsafe { o.contents.result };
4805                         unsafe { o.contents.result = std::ptr::null_mut() };
4806                         CResult_RoutingFeesDecodeErrorZPtr { result }
4807                 } else {
4808                         let err = unsafe { o.contents.err };
4809                         unsafe { o.contents.err = std::ptr::null_mut(); }
4810                         CResult_RoutingFeesDecodeErrorZPtr { err }
4811                 };
4812                 Self {
4813                         contents,
4814                         result_ok: o.result_ok,
4815                 }
4816         }
4817 }
4818 impl Clone for CResult_RoutingFeesDecodeErrorZ {
4819         fn clone(&self) -> Self {
4820                 if self.result_ok {
4821                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
4822                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
4823                         } }
4824                 } else {
4825                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
4826                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4827                         } }
4828                 }
4829         }
4830 }
4831 #[no_mangle]
4832 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
4833 /// but with all dynamically-allocated buffers duplicated in new buffers.
4834 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
4835 #[repr(C)]
4836 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4837 /// This corresponds to std::vector in C++
4838 pub struct CVec_NetAddressZ {
4839         /// The elements in the array.
4840         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4841         pub data: *mut crate::lightning::ln::msgs::NetAddress,
4842         /// The number of elements pointed to by `data`.
4843         pub datalen: usize
4844 }
4845 impl CVec_NetAddressZ {
4846         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4847                 if self.datalen == 0 { return Vec::new(); }
4848                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4849                 self.data = std::ptr::null_mut();
4850                 self.datalen = 0;
4851                 ret
4852         }
4853         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4854                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4855         }
4856 }
4857 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4858         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4859                 let datalen = v.len();
4860                 let data = Box::into_raw(v.into_boxed_slice());
4861                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4862         }
4863 }
4864 #[no_mangle]
4865 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4866 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4867 impl Drop for CVec_NetAddressZ {
4868         fn drop(&mut self) {
4869                 if self.datalen == 0 { return; }
4870                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4871         }
4872 }
4873 impl Clone for CVec_NetAddressZ {
4874         fn clone(&self) -> Self {
4875                 let mut res = Vec::new();
4876                 if self.datalen == 0 { return Self::from(res); }
4877                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4878                 Self::from(res)
4879         }
4880 }
4881 #[repr(C)]
4882 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4883 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4884         /// A pointer to the contents in the success state.
4885         /// Reading from this pointer when `result_ok` is not set is undefined.
4886         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
4887         /// A pointer to the contents in the error state.
4888         /// Reading from this pointer when `result_ok` is set is undefined.
4889         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4890 }
4891 #[repr(C)]
4892 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4893 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4895 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
4896         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4897         /// `err` or `result` depending on the state of `result_ok`.
4898         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
4899         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4900         pub result_ok: bool,
4901 }
4902 #[no_mangle]
4903 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
4904 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4905         CResult_NodeAnnouncementInfoDecodeErrorZ {
4906                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4907                         result: Box::into_raw(Box::new(o)),
4908                 },
4909                 result_ok: true,
4910         }
4911 }
4912 #[no_mangle]
4913 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
4914 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4915         CResult_NodeAnnouncementInfoDecodeErrorZ {
4916                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4917                         err: Box::into_raw(Box::new(e)),
4918                 },
4919                 result_ok: false,
4920         }
4921 }
4922 #[no_mangle]
4923 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
4924 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
4925 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
4926         fn drop(&mut self) {
4927                 if self.result_ok {
4928                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4929                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4930                         }
4931                 } else {
4932                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4933                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4934                         }
4935                 }
4936         }
4937 }
4938 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
4939         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4940                 let contents = if o.result_ok {
4941                         let result = unsafe { o.contents.result };
4942                         unsafe { o.contents.result = std::ptr::null_mut() };
4943                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
4944                 } else {
4945                         let err = unsafe { o.contents.err };
4946                         unsafe { o.contents.err = std::ptr::null_mut(); }
4947                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
4948                 };
4949                 Self {
4950                         contents,
4951                         result_ok: o.result_ok,
4952                 }
4953         }
4954 }
4955 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
4956         fn clone(&self) -> Self {
4957                 if self.result_ok {
4958                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4959                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
4960                         } }
4961                 } else {
4962                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4963                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4964                         } }
4965                 }
4966         }
4967 }
4968 #[no_mangle]
4969 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
4970 /// but with all dynamically-allocated buffers duplicated in new buffers.
4971 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
4972 #[repr(C)]
4973 /// A dynamically-allocated array of u64s of arbitrary size.
4974 /// This corresponds to std::vector in C++
4975 pub struct CVec_u64Z {
4976         /// The elements in the array.
4977         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4978         pub data: *mut u64,
4979         /// The number of elements pointed to by `data`.
4980         pub datalen: usize
4981 }
4982 impl CVec_u64Z {
4983         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4984                 if self.datalen == 0 { return Vec::new(); }
4985                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4986                 self.data = std::ptr::null_mut();
4987                 self.datalen = 0;
4988                 ret
4989         }
4990         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4991                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4992         }
4993 }
4994 impl From<Vec<u64>> for CVec_u64Z {
4995         fn from(v: Vec<u64>) -> Self {
4996                 let datalen = v.len();
4997                 let data = Box::into_raw(v.into_boxed_slice());
4998                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4999         }
5000 }
5001 #[no_mangle]
5002 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5003 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5004 impl Drop for CVec_u64Z {
5005         fn drop(&mut self) {
5006                 if self.datalen == 0 { return; }
5007                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5008         }
5009 }
5010 impl Clone for CVec_u64Z {
5011         fn clone(&self) -> Self {
5012                 let mut res = Vec::new();
5013                 if self.datalen == 0 { return Self::from(res); }
5014                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5015                 Self::from(res)
5016         }
5017 }
5018 #[repr(C)]
5019 /// The contents of CResult_NodeInfoDecodeErrorZ
5020 pub union CResult_NodeInfoDecodeErrorZPtr {
5021         /// A pointer to the contents in the success state.
5022         /// Reading from this pointer when `result_ok` is not set is undefined.
5023         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
5024         /// A pointer to the contents in the error state.
5025         /// Reading from this pointer when `result_ok` is set is undefined.
5026         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5027 }
5028 #[repr(C)]
5029 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5030 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5032 pub struct CResult_NodeInfoDecodeErrorZ {
5033         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5034         /// `err` or `result` depending on the state of `result_ok`.
5035         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5036         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5037         pub result_ok: bool,
5038 }
5039 #[no_mangle]
5040 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5041 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5042         CResult_NodeInfoDecodeErrorZ {
5043                 contents: CResult_NodeInfoDecodeErrorZPtr {
5044                         result: Box::into_raw(Box::new(o)),
5045                 },
5046                 result_ok: true,
5047         }
5048 }
5049 #[no_mangle]
5050 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5051 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5052         CResult_NodeInfoDecodeErrorZ {
5053                 contents: CResult_NodeInfoDecodeErrorZPtr {
5054                         err: Box::into_raw(Box::new(e)),
5055                 },
5056                 result_ok: false,
5057         }
5058 }
5059 #[no_mangle]
5060 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5061 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5062 impl Drop for CResult_NodeInfoDecodeErrorZ {
5063         fn drop(&mut self) {
5064                 if self.result_ok {
5065                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5066                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5067                         }
5068                 } else {
5069                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5070                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5071                         }
5072                 }
5073         }
5074 }
5075 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5076         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5077                 let contents = if o.result_ok {
5078                         let result = unsafe { o.contents.result };
5079                         unsafe { o.contents.result = std::ptr::null_mut() };
5080                         CResult_NodeInfoDecodeErrorZPtr { result }
5081                 } else {
5082                         let err = unsafe { o.contents.err };
5083                         unsafe { o.contents.err = std::ptr::null_mut(); }
5084                         CResult_NodeInfoDecodeErrorZPtr { err }
5085                 };
5086                 Self {
5087                         contents,
5088                         result_ok: o.result_ok,
5089                 }
5090         }
5091 }
5092 impl Clone for CResult_NodeInfoDecodeErrorZ {
5093         fn clone(&self) -> Self {
5094                 if self.result_ok {
5095                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5096                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
5097                         } }
5098                 } else {
5099                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5100                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5101                         } }
5102                 }
5103         }
5104 }
5105 #[no_mangle]
5106 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5107 /// but with all dynamically-allocated buffers duplicated in new buffers.
5108 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
5109 #[repr(C)]
5110 /// The contents of CResult_NetworkGraphDecodeErrorZ
5111 pub union CResult_NetworkGraphDecodeErrorZPtr {
5112         /// A pointer to the contents in the success state.
5113         /// Reading from this pointer when `result_ok` is not set is undefined.
5114         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
5115         /// A pointer to the contents in the error state.
5116         /// Reading from this pointer when `result_ok` is set is undefined.
5117         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5118 }
5119 #[repr(C)]
5120 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5121 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5123 pub struct CResult_NetworkGraphDecodeErrorZ {
5124         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5125         /// `err` or `result` depending on the state of `result_ok`.
5126         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5127         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5128         pub result_ok: bool,
5129 }
5130 #[no_mangle]
5131 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5132 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5133         CResult_NetworkGraphDecodeErrorZ {
5134                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5135                         result: Box::into_raw(Box::new(o)),
5136                 },
5137                 result_ok: true,
5138         }
5139 }
5140 #[no_mangle]
5141 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5142 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5143         CResult_NetworkGraphDecodeErrorZ {
5144                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5145                         err: Box::into_raw(Box::new(e)),
5146                 },
5147                 result_ok: false,
5148         }
5149 }
5150 #[no_mangle]
5151 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5152 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5153 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5154         fn drop(&mut self) {
5155                 if self.result_ok {
5156                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5157                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5158                         }
5159                 } else {
5160                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5161                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5162                         }
5163                 }
5164         }
5165 }
5166 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5167         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5168                 let contents = if o.result_ok {
5169                         let result = unsafe { o.contents.result };
5170                         unsafe { o.contents.result = std::ptr::null_mut() };
5171                         CResult_NetworkGraphDecodeErrorZPtr { result }
5172                 } else {
5173                         let err = unsafe { o.contents.err };
5174                         unsafe { o.contents.err = std::ptr::null_mut(); }
5175                         CResult_NetworkGraphDecodeErrorZPtr { err }
5176                 };
5177                 Self {
5178                         contents,
5179                         result_ok: o.result_ok,
5180                 }
5181         }
5182 }
5183 impl Clone for CResult_NetworkGraphDecodeErrorZ {
5184         fn clone(&self) -> Self {
5185                 if self.result_ok {
5186                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
5187                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
5188                         } }
5189                 } else {
5190                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
5191                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5192                         } }
5193                 }
5194         }
5195 }
5196 #[no_mangle]
5197 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
5198 /// but with all dynamically-allocated buffers duplicated in new buffers.
5199 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
5200 #[repr(C)]
5201 /// The contents of CResult_InitFeaturesDecodeErrorZ
5202 pub union CResult_InitFeaturesDecodeErrorZPtr {
5203         /// A pointer to the contents in the success state.
5204         /// Reading from this pointer when `result_ok` is not set is undefined.
5205         pub result: *mut crate::lightning::ln::features::InitFeatures,
5206         /// A pointer to the contents in the error state.
5207         /// Reading from this pointer when `result_ok` is set is undefined.
5208         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5209 }
5210 #[repr(C)]
5211 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5212 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5214 pub struct CResult_InitFeaturesDecodeErrorZ {
5215         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5216         /// `err` or `result` depending on the state of `result_ok`.
5217         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5218         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5219         pub result_ok: bool,
5220 }
5221 #[no_mangle]
5222 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5223 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5224         CResult_InitFeaturesDecodeErrorZ {
5225                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5226                         result: Box::into_raw(Box::new(o)),
5227                 },
5228                 result_ok: true,
5229         }
5230 }
5231 #[no_mangle]
5232 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5233 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5234         CResult_InitFeaturesDecodeErrorZ {
5235                 contents: CResult_InitFeaturesDecodeErrorZPtr {
5236                         err: Box::into_raw(Box::new(e)),
5237                 },
5238                 result_ok: false,
5239         }
5240 }
5241 #[no_mangle]
5242 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5243 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5244 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5245         fn drop(&mut self) {
5246                 if self.result_ok {
5247                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5248                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5249                         }
5250                 } else {
5251                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5252                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5253                         }
5254                 }
5255         }
5256 }
5257 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5258         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5259                 let contents = if o.result_ok {
5260                         let result = unsafe { o.contents.result };
5261                         unsafe { o.contents.result = std::ptr::null_mut() };
5262                         CResult_InitFeaturesDecodeErrorZPtr { result }
5263                 } else {
5264                         let err = unsafe { o.contents.err };
5265                         unsafe { o.contents.err = std::ptr::null_mut(); }
5266                         CResult_InitFeaturesDecodeErrorZPtr { err }
5267                 };
5268                 Self {
5269                         contents,
5270                         result_ok: o.result_ok,
5271                 }
5272         }
5273 }
5274 #[repr(C)]
5275 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5276 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5277         /// A pointer to the contents in the success state.
5278         /// Reading from this pointer when `result_ok` is not set is undefined.
5279         pub result: *mut crate::lightning::ln::features::NodeFeatures,
5280         /// A pointer to the contents in the error state.
5281         /// Reading from this pointer when `result_ok` is set is undefined.
5282         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5283 }
5284 #[repr(C)]
5285 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5286 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5288 pub struct CResult_NodeFeaturesDecodeErrorZ {
5289         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5290         /// `err` or `result` depending on the state of `result_ok`.
5291         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5292         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5293         pub result_ok: bool,
5294 }
5295 #[no_mangle]
5296 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5297 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5298         CResult_NodeFeaturesDecodeErrorZ {
5299                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5300                         result: Box::into_raw(Box::new(o)),
5301                 },
5302                 result_ok: true,
5303         }
5304 }
5305 #[no_mangle]
5306 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5307 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5308         CResult_NodeFeaturesDecodeErrorZ {
5309                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5310                         err: Box::into_raw(Box::new(e)),
5311                 },
5312                 result_ok: false,
5313         }
5314 }
5315 #[no_mangle]
5316 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5317 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5318 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5319         fn drop(&mut self) {
5320                 if self.result_ok {
5321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5323                         }
5324                 } else {
5325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5327                         }
5328                 }
5329         }
5330 }
5331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5332         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5333                 let contents = if o.result_ok {
5334                         let result = unsafe { o.contents.result };
5335                         unsafe { o.contents.result = std::ptr::null_mut() };
5336                         CResult_NodeFeaturesDecodeErrorZPtr { result }
5337                 } else {
5338                         let err = unsafe { o.contents.err };
5339                         unsafe { o.contents.err = std::ptr::null_mut(); }
5340                         CResult_NodeFeaturesDecodeErrorZPtr { err }
5341                 };
5342                 Self {
5343                         contents,
5344                         result_ok: o.result_ok,
5345                 }
5346         }
5347 }
5348 #[repr(C)]
5349 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5350 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5351         /// A pointer to the contents in the success state.
5352         /// Reading from this pointer when `result_ok` is not set is undefined.
5353         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5354         /// A pointer to the contents in the error state.
5355         /// Reading from this pointer when `result_ok` is set is undefined.
5356         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5357 }
5358 #[repr(C)]
5359 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5360 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5362 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5363         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5364         /// `err` or `result` depending on the state of `result_ok`.
5365         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5366         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5367         pub result_ok: bool,
5368 }
5369 #[no_mangle]
5370 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5371 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5372         CResult_ChannelFeaturesDecodeErrorZ {
5373                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5374                         result: Box::into_raw(Box::new(o)),
5375                 },
5376                 result_ok: true,
5377         }
5378 }
5379 #[no_mangle]
5380 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5381 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5382         CResult_ChannelFeaturesDecodeErrorZ {
5383                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5384                         err: Box::into_raw(Box::new(e)),
5385                 },
5386                 result_ok: false,
5387         }
5388 }
5389 #[no_mangle]
5390 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5391 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5392 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5393         fn drop(&mut self) {
5394                 if self.result_ok {
5395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5397                         }
5398                 } else {
5399                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5400                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5401                         }
5402                 }
5403         }
5404 }
5405 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5406         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5407                 let contents = if o.result_ok {
5408                         let result = unsafe { o.contents.result };
5409                         unsafe { o.contents.result = std::ptr::null_mut() };
5410                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
5411                 } else {
5412                         let err = unsafe { o.contents.err };
5413                         unsafe { o.contents.err = std::ptr::null_mut(); }
5414                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
5415                 };
5416                 Self {
5417                         contents,
5418                         result_ok: o.result_ok,
5419                 }
5420         }
5421 }
5422 #[repr(C)]
5423 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
5424 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
5425         /// A pointer to the contents in the success state.
5426         /// Reading from this pointer when `result_ok` is not set is undefined.
5427         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
5428         /// A pointer to the contents in the error state.
5429         /// Reading from this pointer when `result_ok` is set is undefined.
5430         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5431 }
5432 #[repr(C)]
5433 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5434 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5436 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
5437         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5438         /// `err` or `result` depending on the state of `result_ok`.
5439         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
5440         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5441         pub result_ok: bool,
5442 }
5443 #[no_mangle]
5444 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
5445 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
5446         CResult_InvoiceFeaturesDecodeErrorZ {
5447                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5448                         result: Box::into_raw(Box::new(o)),
5449                 },
5450                 result_ok: true,
5451         }
5452 }
5453 #[no_mangle]
5454 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
5455 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
5456         CResult_InvoiceFeaturesDecodeErrorZ {
5457                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5458                         err: Box::into_raw(Box::new(e)),
5459                 },
5460                 result_ok: false,
5461         }
5462 }
5463 #[no_mangle]
5464 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
5465 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
5466 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
5467         fn drop(&mut self) {
5468                 if self.result_ok {
5469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5471                         }
5472                 } else {
5473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5475                         }
5476                 }
5477         }
5478 }
5479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
5480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5481                 let contents = if o.result_ok {
5482                         let result = unsafe { o.contents.result };
5483                         unsafe { o.contents.result = std::ptr::null_mut() };
5484                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
5485                 } else {
5486                         let err = unsafe { o.contents.err };
5487                         unsafe { o.contents.err = std::ptr::null_mut(); }
5488                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
5489                 };
5490                 Self {
5491                         contents,
5492                         result_ok: o.result_ok,
5493                 }
5494         }
5495 }
5496 #[repr(C)]
5497 /// The contents of CResult_NetAddressu8Z
5498 pub union CResult_NetAddressu8ZPtr {
5499         /// A pointer to the contents in the success state.
5500         /// Reading from this pointer when `result_ok` is not set is undefined.
5501         pub result: *mut crate::lightning::ln::msgs::NetAddress,
5502         /// A pointer to the contents in the error state.
5503         /// Reading from this pointer when `result_ok` is set is undefined.
5504         pub err: *mut u8,
5505 }
5506 #[repr(C)]
5507 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5508 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
5509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5510 pub struct CResult_NetAddressu8Z {
5511         /// The contents of this CResult_NetAddressu8Z, accessible via either
5512         /// `err` or `result` depending on the state of `result_ok`.
5513         pub contents: CResult_NetAddressu8ZPtr,
5514         /// Whether this CResult_NetAddressu8Z represents a success state.
5515         pub result_ok: bool,
5516 }
5517 #[no_mangle]
5518 /// Creates a new CResult_NetAddressu8Z in the success state.
5519 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5520         CResult_NetAddressu8Z {
5521                 contents: CResult_NetAddressu8ZPtr {
5522                         result: Box::into_raw(Box::new(o)),
5523                 },
5524                 result_ok: true,
5525         }
5526 }
5527 #[no_mangle]
5528 /// Creates a new CResult_NetAddressu8Z in the error state.
5529 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5530         CResult_NetAddressu8Z {
5531                 contents: CResult_NetAddressu8ZPtr {
5532                         err: Box::into_raw(Box::new(e)),
5533                 },
5534                 result_ok: false,
5535         }
5536 }
5537 #[no_mangle]
5538 /// Frees any resources used by the CResult_NetAddressu8Z.
5539 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5540 impl Drop for CResult_NetAddressu8Z {
5541         fn drop(&mut self) {
5542                 if self.result_ok {
5543                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5544                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5545                         }
5546                 } else {
5547                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5548                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5549                         }
5550                 }
5551         }
5552 }
5553 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5554         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
5555                 let contents = if o.result_ok {
5556                         let result = unsafe { o.contents.result };
5557                         unsafe { o.contents.result = std::ptr::null_mut() };
5558                         CResult_NetAddressu8ZPtr { result }
5559                 } else {
5560                         let err = unsafe { o.contents.err };
5561                         unsafe { o.contents.err = std::ptr::null_mut(); }
5562                         CResult_NetAddressu8ZPtr { err }
5563                 };
5564                 Self {
5565                         contents,
5566                         result_ok: o.result_ok,
5567                 }
5568         }
5569 }
5570 impl Clone for CResult_NetAddressu8Z {
5571         fn clone(&self) -> Self {
5572                 if self.result_ok {
5573                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5574                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5575                         } }
5576                 } else {
5577                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5578                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5579                         } }
5580                 }
5581         }
5582 }
5583 #[no_mangle]
5584 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5585 /// but with all dynamically-allocated buffers duplicated in new buffers.
5586 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5587 #[repr(C)]
5588 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5589 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5590         /// A pointer to the contents in the success state.
5591         /// Reading from this pointer when `result_ok` is not set is undefined.
5592         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
5593         /// A pointer to the contents in the error state.
5594         /// Reading from this pointer when `result_ok` is set is undefined.
5595         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5596 }
5597 #[repr(C)]
5598 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5599 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
5600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5601 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5602         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5603         /// `err` or `result` depending on the state of `result_ok`.
5604         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5605         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5606         pub result_ok: bool,
5607 }
5608 #[no_mangle]
5609 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5610 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5611         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5612                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5613                         result: Box::into_raw(Box::new(o)),
5614                 },
5615                 result_ok: true,
5616         }
5617 }
5618 #[no_mangle]
5619 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5620 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5621         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5622                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5623                         err: Box::into_raw(Box::new(e)),
5624                 },
5625                 result_ok: false,
5626         }
5627 }
5628 #[no_mangle]
5629 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
5630 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5631 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5632         fn drop(&mut self) {
5633                 if self.result_ok {
5634                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5635                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5636                         }
5637                 } else {
5638                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5639                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5640                         }
5641                 }
5642         }
5643 }
5644 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5645         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
5646                 let contents = if o.result_ok {
5647                         let result = unsafe { o.contents.result };
5648                         unsafe { o.contents.result = std::ptr::null_mut() };
5649                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5650                 } else {
5651                         let err = unsafe { o.contents.err };
5652                         unsafe { o.contents.err = std::ptr::null_mut(); }
5653                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5654                 };
5655                 Self {
5656                         contents,
5657                         result_ok: o.result_ok,
5658                 }
5659         }
5660 }
5661 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5662         fn clone(&self) -> Self {
5663                 if self.result_ok {
5664                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5665                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5666                         } }
5667                 } else {
5668                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5669                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5670                         } }
5671                 }
5672         }
5673 }
5674 #[no_mangle]
5675 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5676 /// but with all dynamically-allocated buffers duplicated in new buffers.
5677 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5678 #[repr(C)]
5679 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
5680 /// This corresponds to std::vector in C++
5681 pub struct CVec_UpdateAddHTLCZ {
5682         /// The elements in the array.
5683         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5684         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
5685         /// The number of elements pointed to by `data`.
5686         pub datalen: usize
5687 }
5688 impl CVec_UpdateAddHTLCZ {
5689         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
5690                 if self.datalen == 0 { return Vec::new(); }
5691                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5692                 self.data = std::ptr::null_mut();
5693                 self.datalen = 0;
5694                 ret
5695         }
5696         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
5697                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5698         }
5699 }
5700 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
5701         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
5702                 let datalen = v.len();
5703                 let data = Box::into_raw(v.into_boxed_slice());
5704                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5705         }
5706 }
5707 #[no_mangle]
5708 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5709 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
5710 impl Drop for CVec_UpdateAddHTLCZ {
5711         fn drop(&mut self) {
5712                 if self.datalen == 0 { return; }
5713                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5714         }
5715 }
5716 impl Clone for CVec_UpdateAddHTLCZ {
5717         fn clone(&self) -> Self {
5718                 let mut res = Vec::new();
5719                 if self.datalen == 0 { return Self::from(res); }
5720                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5721                 Self::from(res)
5722         }
5723 }
5724 #[repr(C)]
5725 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5726 /// This corresponds to std::vector in C++
5727 pub struct CVec_UpdateFulfillHTLCZ {
5728         /// The elements in the array.
5729         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5730         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
5731         /// The number of elements pointed to by `data`.
5732         pub datalen: usize
5733 }
5734 impl CVec_UpdateFulfillHTLCZ {
5735         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
5736                 if self.datalen == 0 { return Vec::new(); }
5737                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5738                 self.data = std::ptr::null_mut();
5739                 self.datalen = 0;
5740                 ret
5741         }
5742         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
5743                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5744         }
5745 }
5746 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
5747         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
5748                 let datalen = v.len();
5749                 let data = Box::into_raw(v.into_boxed_slice());
5750                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5751         }
5752 }
5753 #[no_mangle]
5754 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5755 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
5756 impl Drop for CVec_UpdateFulfillHTLCZ {
5757         fn drop(&mut self) {
5758                 if self.datalen == 0 { return; }
5759                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5760         }
5761 }
5762 impl Clone for CVec_UpdateFulfillHTLCZ {
5763         fn clone(&self) -> Self {
5764                 let mut res = Vec::new();
5765                 if self.datalen == 0 { return Self::from(res); }
5766                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5767                 Self::from(res)
5768         }
5769 }
5770 #[repr(C)]
5771 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
5772 /// This corresponds to std::vector in C++
5773 pub struct CVec_UpdateFailHTLCZ {
5774         /// The elements in the array.
5775         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5776         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
5777         /// The number of elements pointed to by `data`.
5778         pub datalen: usize
5779 }
5780 impl CVec_UpdateFailHTLCZ {
5781         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
5782                 if self.datalen == 0 { return Vec::new(); }
5783                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5784                 self.data = std::ptr::null_mut();
5785                 self.datalen = 0;
5786                 ret
5787         }
5788         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
5789                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5790         }
5791 }
5792 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
5793         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
5794                 let datalen = v.len();
5795                 let data = Box::into_raw(v.into_boxed_slice());
5796                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5797         }
5798 }
5799 #[no_mangle]
5800 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5801 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
5802 impl Drop for CVec_UpdateFailHTLCZ {
5803         fn drop(&mut self) {
5804                 if self.datalen == 0 { return; }
5805                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5806         }
5807 }
5808 impl Clone for CVec_UpdateFailHTLCZ {
5809         fn clone(&self) -> Self {
5810                 let mut res = Vec::new();
5811                 if self.datalen == 0 { return Self::from(res); }
5812                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5813                 Self::from(res)
5814         }
5815 }
5816 #[repr(C)]
5817 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5818 /// This corresponds to std::vector in C++
5819 pub struct CVec_UpdateFailMalformedHTLCZ {
5820         /// The elements in the array.
5821         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5822         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
5823         /// The number of elements pointed to by `data`.
5824         pub datalen: usize
5825 }
5826 impl CVec_UpdateFailMalformedHTLCZ {
5827         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
5828                 if self.datalen == 0 { return Vec::new(); }
5829                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5830                 self.data = std::ptr::null_mut();
5831                 self.datalen = 0;
5832                 ret
5833         }
5834         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
5835                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5836         }
5837 }
5838 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
5839         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
5840                 let datalen = v.len();
5841                 let data = Box::into_raw(v.into_boxed_slice());
5842                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5843         }
5844 }
5845 #[no_mangle]
5846 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5847 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
5848 impl Drop for CVec_UpdateFailMalformedHTLCZ {
5849         fn drop(&mut self) {
5850                 if self.datalen == 0 { return; }
5851                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5852         }
5853 }
5854 impl Clone for CVec_UpdateFailMalformedHTLCZ {
5855         fn clone(&self) -> Self {
5856                 let mut res = Vec::new();
5857                 if self.datalen == 0 { return Self::from(res); }
5858                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5859                 Self::from(res)
5860         }
5861 }
5862 #[repr(C)]
5863 /// The contents of CResult_AcceptChannelDecodeErrorZ
5864 pub union CResult_AcceptChannelDecodeErrorZPtr {
5865         /// A pointer to the contents in the success state.
5866         /// Reading from this pointer when `result_ok` is not set is undefined.
5867         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
5868         /// A pointer to the contents in the error state.
5869         /// Reading from this pointer when `result_ok` is set is undefined.
5870         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5871 }
5872 #[repr(C)]
5873 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5874 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5876 pub struct CResult_AcceptChannelDecodeErrorZ {
5877         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5878         /// `err` or `result` depending on the state of `result_ok`.
5879         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
5880         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5881         pub result_ok: bool,
5882 }
5883 #[no_mangle]
5884 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
5885 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
5886         CResult_AcceptChannelDecodeErrorZ {
5887                 contents: CResult_AcceptChannelDecodeErrorZPtr {
5888                         result: Box::into_raw(Box::new(o)),
5889                 },
5890                 result_ok: true,
5891         }
5892 }
5893 #[no_mangle]
5894 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
5895 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
5896         CResult_AcceptChannelDecodeErrorZ {
5897                 contents: CResult_AcceptChannelDecodeErrorZPtr {
5898                         err: Box::into_raw(Box::new(e)),
5899                 },
5900                 result_ok: false,
5901         }
5902 }
5903 #[no_mangle]
5904 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
5905 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
5906 impl Drop for CResult_AcceptChannelDecodeErrorZ {
5907         fn drop(&mut self) {
5908                 if self.result_ok {
5909                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5910                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5911                         }
5912                 } else {
5913                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5914                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5915                         }
5916                 }
5917         }
5918 }
5919 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
5920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
5921                 let contents = if o.result_ok {
5922                         let result = unsafe { o.contents.result };
5923                         unsafe { o.contents.result = std::ptr::null_mut() };
5924                         CResult_AcceptChannelDecodeErrorZPtr { result }
5925                 } else {
5926                         let err = unsafe { o.contents.err };
5927                         unsafe { o.contents.err = std::ptr::null_mut(); }
5928                         CResult_AcceptChannelDecodeErrorZPtr { err }
5929                 };
5930                 Self {
5931                         contents,
5932                         result_ok: o.result_ok,
5933                 }
5934         }
5935 }
5936 impl Clone for CResult_AcceptChannelDecodeErrorZ {
5937         fn clone(&self) -> Self {
5938                 if self.result_ok {
5939                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
5940                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
5941                         } }
5942                 } else {
5943                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
5944                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5945                         } }
5946                 }
5947         }
5948 }
5949 #[no_mangle]
5950 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
5951 /// but with all dynamically-allocated buffers duplicated in new buffers.
5952 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
5953 #[repr(C)]
5954 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5955 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
5956         /// A pointer to the contents in the success state.
5957         /// Reading from this pointer when `result_ok` is not set is undefined.
5958         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
5959         /// A pointer to the contents in the error state.
5960         /// Reading from this pointer when `result_ok` is set is undefined.
5961         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5962 }
5963 #[repr(C)]
5964 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5965 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5967 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
5968         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5969         /// `err` or `result` depending on the state of `result_ok`.
5970         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
5971         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5972         pub result_ok: bool,
5973 }
5974 #[no_mangle]
5975 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
5976 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5977         CResult_AnnouncementSignaturesDecodeErrorZ {
5978                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5979                         result: Box::into_raw(Box::new(o)),
5980                 },
5981                 result_ok: true,
5982         }
5983 }
5984 #[no_mangle]
5985 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
5986 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5987         CResult_AnnouncementSignaturesDecodeErrorZ {
5988                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5989                         err: Box::into_raw(Box::new(e)),
5990                 },
5991                 result_ok: false,
5992         }
5993 }
5994 #[no_mangle]
5995 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
5996 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
5997 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
5998         fn drop(&mut self) {
5999                 if self.result_ok {
6000                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6001                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6002                         }
6003                 } else {
6004                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6005                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6006                         }
6007                 }
6008         }
6009 }
6010 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6011         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6012                 let contents = if o.result_ok {
6013                         let result = unsafe { o.contents.result };
6014                         unsafe { o.contents.result = std::ptr::null_mut() };
6015                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6016                 } else {
6017                         let err = unsafe { o.contents.err };
6018                         unsafe { o.contents.err = std::ptr::null_mut(); }
6019                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6020                 };
6021                 Self {
6022                         contents,
6023                         result_ok: o.result_ok,
6024                 }
6025         }
6026 }
6027 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6028         fn clone(&self) -> Self {
6029                 if self.result_ok {
6030                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6031                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6032                         } }
6033                 } else {
6034                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6035                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6036                         } }
6037                 }
6038         }
6039 }
6040 #[no_mangle]
6041 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6042 /// but with all dynamically-allocated buffers duplicated in new buffers.
6043 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6044 #[repr(C)]
6045 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6046 pub union CResult_ChannelReestablishDecodeErrorZPtr {
6047         /// A pointer to the contents in the success state.
6048         /// Reading from this pointer when `result_ok` is not set is undefined.
6049         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
6050         /// A pointer to the contents in the error state.
6051         /// Reading from this pointer when `result_ok` is set is undefined.
6052         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6053 }
6054 #[repr(C)]
6055 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6056 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6058 pub struct CResult_ChannelReestablishDecodeErrorZ {
6059         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6060         /// `err` or `result` depending on the state of `result_ok`.
6061         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6062         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6063         pub result_ok: bool,
6064 }
6065 #[no_mangle]
6066 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6067 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6068         CResult_ChannelReestablishDecodeErrorZ {
6069                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6070                         result: Box::into_raw(Box::new(o)),
6071                 },
6072                 result_ok: true,
6073         }
6074 }
6075 #[no_mangle]
6076 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6077 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6078         CResult_ChannelReestablishDecodeErrorZ {
6079                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6080                         err: Box::into_raw(Box::new(e)),
6081                 },
6082                 result_ok: false,
6083         }
6084 }
6085 #[no_mangle]
6086 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
6087 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6088 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
6089         fn drop(&mut self) {
6090                 if self.result_ok {
6091                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6092                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6093                         }
6094                 } else {
6095                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6096                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6097                         }
6098                 }
6099         }
6100 }
6101 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6102         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
6103                 let contents = if o.result_ok {
6104                         let result = unsafe { o.contents.result };
6105                         unsafe { o.contents.result = std::ptr::null_mut() };
6106                         CResult_ChannelReestablishDecodeErrorZPtr { result }
6107                 } else {
6108                         let err = unsafe { o.contents.err };
6109                         unsafe { o.contents.err = std::ptr::null_mut(); }
6110                         CResult_ChannelReestablishDecodeErrorZPtr { err }
6111                 };
6112                 Self {
6113                         contents,
6114                         result_ok: o.result_ok,
6115                 }
6116         }
6117 }
6118 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6119         fn clone(&self) -> Self {
6120                 if self.result_ok {
6121                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6122                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6123                         } }
6124                 } else {
6125                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6126                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6127                         } }
6128                 }
6129         }
6130 }
6131 #[no_mangle]
6132 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6133 /// but with all dynamically-allocated buffers duplicated in new buffers.
6134 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6135 #[repr(C)]
6136 /// The contents of CResult_ClosingSignedDecodeErrorZ
6137 pub union CResult_ClosingSignedDecodeErrorZPtr {
6138         /// A pointer to the contents in the success state.
6139         /// Reading from this pointer when `result_ok` is not set is undefined.
6140         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
6141         /// A pointer to the contents in the error state.
6142         /// Reading from this pointer when `result_ok` is set is undefined.
6143         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6144 }
6145 #[repr(C)]
6146 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6147 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6149 pub struct CResult_ClosingSignedDecodeErrorZ {
6150         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6151         /// `err` or `result` depending on the state of `result_ok`.
6152         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6153         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6154         pub result_ok: bool,
6155 }
6156 #[no_mangle]
6157 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6158 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6159         CResult_ClosingSignedDecodeErrorZ {
6160                 contents: CResult_ClosingSignedDecodeErrorZPtr {
6161                         result: Box::into_raw(Box::new(o)),
6162                 },
6163                 result_ok: true,
6164         }
6165 }
6166 #[no_mangle]
6167 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6168 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6169         CResult_ClosingSignedDecodeErrorZ {
6170                 contents: CResult_ClosingSignedDecodeErrorZPtr {
6171                         err: Box::into_raw(Box::new(e)),
6172                 },
6173                 result_ok: false,
6174         }
6175 }
6176 #[no_mangle]
6177 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
6178 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6179 impl Drop for CResult_ClosingSignedDecodeErrorZ {
6180         fn drop(&mut self) {
6181                 if self.result_ok {
6182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6184                         }
6185                 } else {
6186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6188                         }
6189                 }
6190         }
6191 }
6192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6194                 let contents = if o.result_ok {
6195                         let result = unsafe { o.contents.result };
6196                         unsafe { o.contents.result = std::ptr::null_mut() };
6197                         CResult_ClosingSignedDecodeErrorZPtr { result }
6198                 } else {
6199                         let err = unsafe { o.contents.err };
6200                         unsafe { o.contents.err = std::ptr::null_mut(); }
6201                         CResult_ClosingSignedDecodeErrorZPtr { err }
6202                 };
6203                 Self {
6204                         contents,
6205                         result_ok: o.result_ok,
6206                 }
6207         }
6208 }
6209 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6210         fn clone(&self) -> Self {
6211                 if self.result_ok {
6212                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6213                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6214                         } }
6215                 } else {
6216                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
6217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6218                         } }
6219                 }
6220         }
6221 }
6222 #[no_mangle]
6223 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
6224 /// but with all dynamically-allocated buffers duplicated in new buffers.
6225 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6226 #[repr(C)]
6227 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6228 pub union CResult_CommitmentSignedDecodeErrorZPtr {
6229         /// A pointer to the contents in the success state.
6230         /// Reading from this pointer when `result_ok` is not set is undefined.
6231         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
6232         /// A pointer to the contents in the error state.
6233         /// Reading from this pointer when `result_ok` is set is undefined.
6234         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6235 }
6236 #[repr(C)]
6237 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6238 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6240 pub struct CResult_CommitmentSignedDecodeErrorZ {
6241         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6242         /// `err` or `result` depending on the state of `result_ok`.
6243         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6244         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6245         pub result_ok: bool,
6246 }
6247 #[no_mangle]
6248 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6249 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6250         CResult_CommitmentSignedDecodeErrorZ {
6251                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6252                         result: Box::into_raw(Box::new(o)),
6253                 },
6254                 result_ok: true,
6255         }
6256 }
6257 #[no_mangle]
6258 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6259 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6260         CResult_CommitmentSignedDecodeErrorZ {
6261                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6262                         err: Box::into_raw(Box::new(e)),
6263                 },
6264                 result_ok: false,
6265         }
6266 }
6267 #[no_mangle]
6268 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
6269 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6270 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
6271         fn drop(&mut self) {
6272                 if self.result_ok {
6273                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6274                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6275                         }
6276                 } else {
6277                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6278                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6279                         }
6280                 }
6281         }
6282 }
6283 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6284         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6285                 let contents = if o.result_ok {
6286                         let result = unsafe { o.contents.result };
6287                         unsafe { o.contents.result = std::ptr::null_mut() };
6288                         CResult_CommitmentSignedDecodeErrorZPtr { result }
6289                 } else {
6290                         let err = unsafe { o.contents.err };
6291                         unsafe { o.contents.err = std::ptr::null_mut(); }
6292                         CResult_CommitmentSignedDecodeErrorZPtr { err }
6293                 };
6294                 Self {
6295                         contents,
6296                         result_ok: o.result_ok,
6297                 }
6298         }
6299 }
6300 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6301         fn clone(&self) -> Self {
6302                 if self.result_ok {
6303                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6304                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6305                         } }
6306                 } else {
6307                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6308                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6309                         } }
6310                 }
6311         }
6312 }
6313 #[no_mangle]
6314 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6315 /// but with all dynamically-allocated buffers duplicated in new buffers.
6316 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6317 #[repr(C)]
6318 /// The contents of CResult_FundingCreatedDecodeErrorZ
6319 pub union CResult_FundingCreatedDecodeErrorZPtr {
6320         /// A pointer to the contents in the success state.
6321         /// Reading from this pointer when `result_ok` is not set is undefined.
6322         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
6323         /// A pointer to the contents in the error state.
6324         /// Reading from this pointer when `result_ok` is set is undefined.
6325         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6326 }
6327 #[repr(C)]
6328 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6329 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
6330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6331 pub struct CResult_FundingCreatedDecodeErrorZ {
6332         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6333         /// `err` or `result` depending on the state of `result_ok`.
6334         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6335         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6336         pub result_ok: bool,
6337 }
6338 #[no_mangle]
6339 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6340 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6341         CResult_FundingCreatedDecodeErrorZ {
6342                 contents: CResult_FundingCreatedDecodeErrorZPtr {
6343                         result: Box::into_raw(Box::new(o)),
6344                 },
6345                 result_ok: true,
6346         }
6347 }
6348 #[no_mangle]
6349 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6350 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6351         CResult_FundingCreatedDecodeErrorZ {
6352                 contents: CResult_FundingCreatedDecodeErrorZPtr {
6353                         err: Box::into_raw(Box::new(e)),
6354                 },
6355                 result_ok: false,
6356         }
6357 }
6358 #[no_mangle]
6359 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
6360 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6361 impl Drop for CResult_FundingCreatedDecodeErrorZ {
6362         fn drop(&mut self) {
6363                 if self.result_ok {
6364                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6365                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6366                         }
6367                 } else {
6368                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6369                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6370                         }
6371                 }
6372         }
6373 }
6374 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6375         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
6376                 let contents = if o.result_ok {
6377                         let result = unsafe { o.contents.result };
6378                         unsafe { o.contents.result = std::ptr::null_mut() };
6379                         CResult_FundingCreatedDecodeErrorZPtr { result }
6380                 } else {
6381                         let err = unsafe { o.contents.err };
6382                         unsafe { o.contents.err = std::ptr::null_mut(); }
6383                         CResult_FundingCreatedDecodeErrorZPtr { err }
6384                 };
6385                 Self {
6386                         contents,
6387                         result_ok: o.result_ok,
6388                 }
6389         }
6390 }
6391 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6392         fn clone(&self) -> Self {
6393                 if self.result_ok {
6394                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6395                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6396                         } }
6397                 } else {
6398                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
6399                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6400                         } }
6401                 }
6402         }
6403 }
6404 #[no_mangle]
6405 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
6406 /// but with all dynamically-allocated buffers duplicated in new buffers.
6407 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6408 #[repr(C)]
6409 /// The contents of CResult_FundingSignedDecodeErrorZ
6410 pub union CResult_FundingSignedDecodeErrorZPtr {
6411         /// A pointer to the contents in the success state.
6412         /// Reading from this pointer when `result_ok` is not set is undefined.
6413         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
6414         /// A pointer to the contents in the error state.
6415         /// Reading from this pointer when `result_ok` is set is undefined.
6416         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6417 }
6418 #[repr(C)]
6419 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6420 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6422 pub struct CResult_FundingSignedDecodeErrorZ {
6423         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6424         /// `err` or `result` depending on the state of `result_ok`.
6425         pub contents: CResult_FundingSignedDecodeErrorZPtr,
6426         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6427         pub result_ok: bool,
6428 }
6429 #[no_mangle]
6430 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6431 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6432         CResult_FundingSignedDecodeErrorZ {
6433                 contents: CResult_FundingSignedDecodeErrorZPtr {
6434                         result: Box::into_raw(Box::new(o)),
6435                 },
6436                 result_ok: true,
6437         }
6438 }
6439 #[no_mangle]
6440 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6441 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6442         CResult_FundingSignedDecodeErrorZ {
6443                 contents: CResult_FundingSignedDecodeErrorZPtr {
6444                         err: Box::into_raw(Box::new(e)),
6445                 },
6446                 result_ok: false,
6447         }
6448 }
6449 #[no_mangle]
6450 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
6451 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6452 impl Drop for CResult_FundingSignedDecodeErrorZ {
6453         fn drop(&mut self) {
6454                 if self.result_ok {
6455                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6456                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6457                         }
6458                 } else {
6459                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6460                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6461                         }
6462                 }
6463         }
6464 }
6465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6466         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
6467                 let contents = if o.result_ok {
6468                         let result = unsafe { o.contents.result };
6469                         unsafe { o.contents.result = std::ptr::null_mut() };
6470                         CResult_FundingSignedDecodeErrorZPtr { result }
6471                 } else {
6472                         let err = unsafe { o.contents.err };
6473                         unsafe { o.contents.err = std::ptr::null_mut(); }
6474                         CResult_FundingSignedDecodeErrorZPtr { err }
6475                 };
6476                 Self {
6477                         contents,
6478                         result_ok: o.result_ok,
6479                 }
6480         }
6481 }
6482 impl Clone for CResult_FundingSignedDecodeErrorZ {
6483         fn clone(&self) -> Self {
6484                 if self.result_ok {
6485                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6486                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6487                         } }
6488                 } else {
6489                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
6490                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6491                         } }
6492                 }
6493         }
6494 }
6495 #[no_mangle]
6496 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
6497 /// but with all dynamically-allocated buffers duplicated in new buffers.
6498 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6499 #[repr(C)]
6500 /// The contents of CResult_FundingLockedDecodeErrorZ
6501 pub union CResult_FundingLockedDecodeErrorZPtr {
6502         /// A pointer to the contents in the success state.
6503         /// Reading from this pointer when `result_ok` is not set is undefined.
6504         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
6505         /// A pointer to the contents in the error state.
6506         /// Reading from this pointer when `result_ok` is set is undefined.
6507         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6508 }
6509 #[repr(C)]
6510 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6511 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
6512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6513 pub struct CResult_FundingLockedDecodeErrorZ {
6514         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6515         /// `err` or `result` depending on the state of `result_ok`.
6516         pub contents: CResult_FundingLockedDecodeErrorZPtr,
6517         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6518         pub result_ok: bool,
6519 }
6520 #[no_mangle]
6521 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6522 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6523         CResult_FundingLockedDecodeErrorZ {
6524                 contents: CResult_FundingLockedDecodeErrorZPtr {
6525                         result: Box::into_raw(Box::new(o)),
6526                 },
6527                 result_ok: true,
6528         }
6529 }
6530 #[no_mangle]
6531 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6532 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6533         CResult_FundingLockedDecodeErrorZ {
6534                 contents: CResult_FundingLockedDecodeErrorZPtr {
6535                         err: Box::into_raw(Box::new(e)),
6536                 },
6537                 result_ok: false,
6538         }
6539 }
6540 #[no_mangle]
6541 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
6542 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6543 impl Drop for CResult_FundingLockedDecodeErrorZ {
6544         fn drop(&mut self) {
6545                 if self.result_ok {
6546                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6547                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6548                         }
6549                 } else {
6550                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6551                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6552                         }
6553                 }
6554         }
6555 }
6556 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6557         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
6558                 let contents = if o.result_ok {
6559                         let result = unsafe { o.contents.result };
6560                         unsafe { o.contents.result = std::ptr::null_mut() };
6561                         CResult_FundingLockedDecodeErrorZPtr { result }
6562                 } else {
6563                         let err = unsafe { o.contents.err };
6564                         unsafe { o.contents.err = std::ptr::null_mut(); }
6565                         CResult_FundingLockedDecodeErrorZPtr { err }
6566                 };
6567                 Self {
6568                         contents,
6569                         result_ok: o.result_ok,
6570                 }
6571         }
6572 }
6573 impl Clone for CResult_FundingLockedDecodeErrorZ {
6574         fn clone(&self) -> Self {
6575                 if self.result_ok {
6576                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6577                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6578                         } }
6579                 } else {
6580                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
6581                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6582                         } }
6583                 }
6584         }
6585 }
6586 #[no_mangle]
6587 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
6588 /// but with all dynamically-allocated buffers duplicated in new buffers.
6589 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6590 #[repr(C)]
6591 /// The contents of CResult_InitDecodeErrorZ
6592 pub union CResult_InitDecodeErrorZPtr {
6593         /// A pointer to the contents in the success state.
6594         /// Reading from this pointer when `result_ok` is not set is undefined.
6595         pub result: *mut crate::lightning::ln::msgs::Init,
6596         /// A pointer to the contents in the error state.
6597         /// Reading from this pointer when `result_ok` is set is undefined.
6598         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6599 }
6600 #[repr(C)]
6601 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6602 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
6603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6604 pub struct CResult_InitDecodeErrorZ {
6605         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6606         /// `err` or `result` depending on the state of `result_ok`.
6607         pub contents: CResult_InitDecodeErrorZPtr,
6608         /// Whether this CResult_InitDecodeErrorZ represents a success state.
6609         pub result_ok: bool,
6610 }
6611 #[no_mangle]
6612 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6613 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6614         CResult_InitDecodeErrorZ {
6615                 contents: CResult_InitDecodeErrorZPtr {
6616                         result: Box::into_raw(Box::new(o)),
6617                 },
6618                 result_ok: true,
6619         }
6620 }
6621 #[no_mangle]
6622 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6623 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6624         CResult_InitDecodeErrorZ {
6625                 contents: CResult_InitDecodeErrorZPtr {
6626                         err: Box::into_raw(Box::new(e)),
6627                 },
6628                 result_ok: false,
6629         }
6630 }
6631 #[no_mangle]
6632 /// Frees any resources used by the CResult_InitDecodeErrorZ.
6633 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6634 impl Drop for CResult_InitDecodeErrorZ {
6635         fn drop(&mut self) {
6636                 if self.result_ok {
6637                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6638                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6639                         }
6640                 } else {
6641                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6642                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6643                         }
6644                 }
6645         }
6646 }
6647 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6648         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
6649                 let contents = if o.result_ok {
6650                         let result = unsafe { o.contents.result };
6651                         unsafe { o.contents.result = std::ptr::null_mut() };
6652                         CResult_InitDecodeErrorZPtr { result }
6653                 } else {
6654                         let err = unsafe { o.contents.err };
6655                         unsafe { o.contents.err = std::ptr::null_mut(); }
6656                         CResult_InitDecodeErrorZPtr { err }
6657                 };
6658                 Self {
6659                         contents,
6660                         result_ok: o.result_ok,
6661                 }
6662         }
6663 }
6664 impl Clone for CResult_InitDecodeErrorZ {
6665         fn clone(&self) -> Self {
6666                 if self.result_ok {
6667                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
6668                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
6669                         } }
6670                 } else {
6671                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
6672                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6673                         } }
6674                 }
6675         }
6676 }
6677 #[no_mangle]
6678 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
6679 /// but with all dynamically-allocated buffers duplicated in new buffers.
6680 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
6681 #[repr(C)]
6682 /// The contents of CResult_OpenChannelDecodeErrorZ
6683 pub union CResult_OpenChannelDecodeErrorZPtr {
6684         /// A pointer to the contents in the success state.
6685         /// Reading from this pointer when `result_ok` is not set is undefined.
6686         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
6687         /// A pointer to the contents in the error state.
6688         /// Reading from this pointer when `result_ok` is set is undefined.
6689         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6690 }
6691 #[repr(C)]
6692 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6693 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6695 pub struct CResult_OpenChannelDecodeErrorZ {
6696         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6697         /// `err` or `result` depending on the state of `result_ok`.
6698         pub contents: CResult_OpenChannelDecodeErrorZPtr,
6699         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6700         pub result_ok: bool,
6701 }
6702 #[no_mangle]
6703 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
6704 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
6705         CResult_OpenChannelDecodeErrorZ {
6706                 contents: CResult_OpenChannelDecodeErrorZPtr {
6707                         result: Box::into_raw(Box::new(o)),
6708                 },
6709                 result_ok: true,
6710         }
6711 }
6712 #[no_mangle]
6713 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
6714 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
6715         CResult_OpenChannelDecodeErrorZ {
6716                 contents: CResult_OpenChannelDecodeErrorZPtr {
6717                         err: Box::into_raw(Box::new(e)),
6718                 },
6719                 result_ok: false,
6720         }
6721 }
6722 #[no_mangle]
6723 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
6724 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
6725 impl Drop for CResult_OpenChannelDecodeErrorZ {
6726         fn drop(&mut self) {
6727                 if self.result_ok {
6728                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6729                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6730                         }
6731                 } else {
6732                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6733                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6734                         }
6735                 }
6736         }
6737 }
6738 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
6739         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
6740                 let contents = if o.result_ok {
6741                         let result = unsafe { o.contents.result };
6742                         unsafe { o.contents.result = std::ptr::null_mut() };
6743                         CResult_OpenChannelDecodeErrorZPtr { result }
6744                 } else {
6745                         let err = unsafe { o.contents.err };
6746                         unsafe { o.contents.err = std::ptr::null_mut(); }
6747                         CResult_OpenChannelDecodeErrorZPtr { err }
6748                 };
6749                 Self {
6750                         contents,
6751                         result_ok: o.result_ok,
6752                 }
6753         }
6754 }
6755 impl Clone for CResult_OpenChannelDecodeErrorZ {
6756         fn clone(&self) -> Self {
6757                 if self.result_ok {
6758                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
6759                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
6760                         } }
6761                 } else {
6762                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
6763                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6764                         } }
6765                 }
6766         }
6767 }
6768 #[no_mangle]
6769 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
6770 /// but with all dynamically-allocated buffers duplicated in new buffers.
6771 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
6772 #[repr(C)]
6773 /// The contents of CResult_RevokeAndACKDecodeErrorZ
6774 pub union CResult_RevokeAndACKDecodeErrorZPtr {
6775         /// A pointer to the contents in the success state.
6776         /// Reading from this pointer when `result_ok` is not set is undefined.
6777         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
6778         /// A pointer to the contents in the error state.
6779         /// Reading from this pointer when `result_ok` is set is undefined.
6780         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6781 }
6782 #[repr(C)]
6783 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
6784 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
6785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6786 pub struct CResult_RevokeAndACKDecodeErrorZ {
6787         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
6788         /// `err` or `result` depending on the state of `result_ok`.
6789         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
6790         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
6791         pub result_ok: bool,
6792 }
6793 #[no_mangle]
6794 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
6795 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
6796         CResult_RevokeAndACKDecodeErrorZ {
6797                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
6798                         result: Box::into_raw(Box::new(o)),
6799                 },
6800                 result_ok: true,
6801         }
6802 }
6803 #[no_mangle]
6804 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
6805 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
6806         CResult_RevokeAndACKDecodeErrorZ {
6807                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
6808                         err: Box::into_raw(Box::new(e)),
6809                 },
6810                 result_ok: false,
6811         }
6812 }
6813 #[no_mangle]
6814 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
6815 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
6816 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
6817         fn drop(&mut self) {
6818                 if self.result_ok {
6819                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6820                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6821                         }
6822                 } else {
6823                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6824                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6825                         }
6826                 }
6827         }
6828 }
6829 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
6830         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
6831                 let contents = if o.result_ok {
6832                         let result = unsafe { o.contents.result };
6833                         unsafe { o.contents.result = std::ptr::null_mut() };
6834                         CResult_RevokeAndACKDecodeErrorZPtr { result }
6835                 } else {
6836                         let err = unsafe { o.contents.err };
6837                         unsafe { o.contents.err = std::ptr::null_mut(); }
6838                         CResult_RevokeAndACKDecodeErrorZPtr { err }
6839                 };
6840                 Self {
6841                         contents,
6842                         result_ok: o.result_ok,
6843                 }
6844         }
6845 }
6846 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
6847         fn clone(&self) -> Self {
6848                 if self.result_ok {
6849                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
6850                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
6851                         } }
6852                 } else {
6853                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
6854                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6855                         } }
6856                 }
6857         }
6858 }
6859 #[no_mangle]
6860 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
6861 /// but with all dynamically-allocated buffers duplicated in new buffers.
6862 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
6863 #[repr(C)]
6864 /// The contents of CResult_ShutdownDecodeErrorZ
6865 pub union CResult_ShutdownDecodeErrorZPtr {
6866         /// A pointer to the contents in the success state.
6867         /// Reading from this pointer when `result_ok` is not set is undefined.
6868         pub result: *mut crate::lightning::ln::msgs::Shutdown,
6869         /// A pointer to the contents in the error state.
6870         /// Reading from this pointer when `result_ok` is set is undefined.
6871         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6872 }
6873 #[repr(C)]
6874 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
6875 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
6876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6877 pub struct CResult_ShutdownDecodeErrorZ {
6878         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
6879         /// `err` or `result` depending on the state of `result_ok`.
6880         pub contents: CResult_ShutdownDecodeErrorZPtr,
6881         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
6882         pub result_ok: bool,
6883 }
6884 #[no_mangle]
6885 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
6886 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
6887         CResult_ShutdownDecodeErrorZ {
6888                 contents: CResult_ShutdownDecodeErrorZPtr {
6889                         result: Box::into_raw(Box::new(o)),
6890                 },
6891                 result_ok: true,
6892         }
6893 }
6894 #[no_mangle]
6895 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
6896 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
6897         CResult_ShutdownDecodeErrorZ {
6898                 contents: CResult_ShutdownDecodeErrorZPtr {
6899                         err: Box::into_raw(Box::new(e)),
6900                 },
6901                 result_ok: false,
6902         }
6903 }
6904 #[no_mangle]
6905 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
6906 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
6907 impl Drop for CResult_ShutdownDecodeErrorZ {
6908         fn drop(&mut self) {
6909                 if self.result_ok {
6910                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6911                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6912                         }
6913                 } else {
6914                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6915                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6916                         }
6917                 }
6918         }
6919 }
6920 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
6921         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
6922                 let contents = if o.result_ok {
6923                         let result = unsafe { o.contents.result };
6924                         unsafe { o.contents.result = std::ptr::null_mut() };
6925                         CResult_ShutdownDecodeErrorZPtr { result }
6926                 } else {
6927                         let err = unsafe { o.contents.err };
6928                         unsafe { o.contents.err = std::ptr::null_mut(); }
6929                         CResult_ShutdownDecodeErrorZPtr { err }
6930                 };
6931                 Self {
6932                         contents,
6933                         result_ok: o.result_ok,
6934                 }
6935         }
6936 }
6937 impl Clone for CResult_ShutdownDecodeErrorZ {
6938         fn clone(&self) -> Self {
6939                 if self.result_ok {
6940                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
6941                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
6942                         } }
6943                 } else {
6944                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
6945                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6946                         } }
6947                 }
6948         }
6949 }
6950 #[no_mangle]
6951 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
6954 #[repr(C)]
6955 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
6956 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
6957         /// A pointer to the contents in the success state.
6958         /// Reading from this pointer when `result_ok` is not set is undefined.
6959         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
6960         /// A pointer to the contents in the error state.
6961         /// Reading from this pointer when `result_ok` is set is undefined.
6962         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6963 }
6964 #[repr(C)]
6965 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
6966 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6968 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
6969         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
6970         /// `err` or `result` depending on the state of `result_ok`.
6971         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
6972         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
6973         pub result_ok: bool,
6974 }
6975 #[no_mangle]
6976 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
6977 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
6978         CResult_UpdateFailHTLCDecodeErrorZ {
6979                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6980                         result: Box::into_raw(Box::new(o)),
6981                 },
6982                 result_ok: true,
6983         }
6984 }
6985 #[no_mangle]
6986 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
6987 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
6988         CResult_UpdateFailHTLCDecodeErrorZ {
6989                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6990                         err: Box::into_raw(Box::new(e)),
6991                 },
6992                 result_ok: false,
6993         }
6994 }
6995 #[no_mangle]
6996 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
6997 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
6998 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
6999         fn drop(&mut self) {
7000                 if self.result_ok {
7001                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7002                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7003                         }
7004                 } else {
7005                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7006                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7007                         }
7008                 }
7009         }
7010 }
7011 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7012         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7013                 let contents = if o.result_ok {
7014                         let result = unsafe { o.contents.result };
7015                         unsafe { o.contents.result = std::ptr::null_mut() };
7016                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
7017                 } else {
7018                         let err = unsafe { o.contents.err };
7019                         unsafe { o.contents.err = std::ptr::null_mut(); }
7020                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7021                 };
7022                 Self {
7023                         contents,
7024                         result_ok: o.result_ok,
7025                 }
7026         }
7027 }
7028 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7029         fn clone(&self) -> Self {
7030                 if self.result_ok {
7031                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7032                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7033                         } }
7034                 } else {
7035                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7036                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7037                         } }
7038                 }
7039         }
7040 }
7041 #[no_mangle]
7042 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7043 /// but with all dynamically-allocated buffers duplicated in new buffers.
7044 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7045 #[repr(C)]
7046 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7047 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7048         /// A pointer to the contents in the success state.
7049         /// Reading from this pointer when `result_ok` is not set is undefined.
7050         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
7051         /// A pointer to the contents in the error state.
7052         /// Reading from this pointer when `result_ok` is set is undefined.
7053         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7054 }
7055 #[repr(C)]
7056 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7057 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7058 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7059 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7060         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7061         /// `err` or `result` depending on the state of `result_ok`.
7062         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7063         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7064         pub result_ok: bool,
7065 }
7066 #[no_mangle]
7067 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7068 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7069         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7070                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7071                         result: Box::into_raw(Box::new(o)),
7072                 },
7073                 result_ok: true,
7074         }
7075 }
7076 #[no_mangle]
7077 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7078 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7079         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7080                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7081                         err: Box::into_raw(Box::new(e)),
7082                 },
7083                 result_ok: false,
7084         }
7085 }
7086 #[no_mangle]
7087 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
7088 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7089 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7090         fn drop(&mut self) {
7091                 if self.result_ok {
7092                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7093                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7094                         }
7095                 } else {
7096                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7097                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7098                         }
7099                 }
7100         }
7101 }
7102 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7103         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7104                 let contents = if o.result_ok {
7105                         let result = unsafe { o.contents.result };
7106                         unsafe { o.contents.result = std::ptr::null_mut() };
7107                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7108                 } else {
7109                         let err = unsafe { o.contents.err };
7110                         unsafe { o.contents.err = std::ptr::null_mut(); }
7111                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7112                 };
7113                 Self {
7114                         contents,
7115                         result_ok: o.result_ok,
7116                 }
7117         }
7118 }
7119 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7120         fn clone(&self) -> Self {
7121                 if self.result_ok {
7122                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7123                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7124                         } }
7125                 } else {
7126                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7127                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7128                         } }
7129                 }
7130         }
7131 }
7132 #[no_mangle]
7133 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7134 /// but with all dynamically-allocated buffers duplicated in new buffers.
7135 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7136 #[repr(C)]
7137 /// The contents of CResult_UpdateFeeDecodeErrorZ
7138 pub union CResult_UpdateFeeDecodeErrorZPtr {
7139         /// A pointer to the contents in the success state.
7140         /// Reading from this pointer when `result_ok` is not set is undefined.
7141         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
7142         /// A pointer to the contents in the error state.
7143         /// Reading from this pointer when `result_ok` is set is undefined.
7144         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7145 }
7146 #[repr(C)]
7147 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7148 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7150 pub struct CResult_UpdateFeeDecodeErrorZ {
7151         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7152         /// `err` or `result` depending on the state of `result_ok`.
7153         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7154         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7155         pub result_ok: bool,
7156 }
7157 #[no_mangle]
7158 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7159 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7160         CResult_UpdateFeeDecodeErrorZ {
7161                 contents: CResult_UpdateFeeDecodeErrorZPtr {
7162                         result: Box::into_raw(Box::new(o)),
7163                 },
7164                 result_ok: true,
7165         }
7166 }
7167 #[no_mangle]
7168 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7169 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7170         CResult_UpdateFeeDecodeErrorZ {
7171                 contents: CResult_UpdateFeeDecodeErrorZPtr {
7172                         err: Box::into_raw(Box::new(e)),
7173                 },
7174                 result_ok: false,
7175         }
7176 }
7177 #[no_mangle]
7178 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
7179 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7180 impl Drop for CResult_UpdateFeeDecodeErrorZ {
7181         fn drop(&mut self) {
7182                 if self.result_ok {
7183                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7184                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7185                         }
7186                 } else {
7187                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7188                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7189                         }
7190                 }
7191         }
7192 }
7193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7194         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
7195                 let contents = if o.result_ok {
7196                         let result = unsafe { o.contents.result };
7197                         unsafe { o.contents.result = std::ptr::null_mut() };
7198                         CResult_UpdateFeeDecodeErrorZPtr { result }
7199                 } else {
7200                         let err = unsafe { o.contents.err };
7201                         unsafe { o.contents.err = std::ptr::null_mut(); }
7202                         CResult_UpdateFeeDecodeErrorZPtr { err }
7203                 };
7204                 Self {
7205                         contents,
7206                         result_ok: o.result_ok,
7207                 }
7208         }
7209 }
7210 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7211         fn clone(&self) -> Self {
7212                 if self.result_ok {
7213                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7214                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7215                         } }
7216                 } else {
7217                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
7218                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7219                         } }
7220                 }
7221         }
7222 }
7223 #[no_mangle]
7224 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
7225 /// but with all dynamically-allocated buffers duplicated in new buffers.
7226 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7227 #[repr(C)]
7228 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7229 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7230         /// A pointer to the contents in the success state.
7231         /// Reading from this pointer when `result_ok` is not set is undefined.
7232         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
7233         /// A pointer to the contents in the error state.
7234         /// Reading from this pointer when `result_ok` is set is undefined.
7235         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7236 }
7237 #[repr(C)]
7238 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7239 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7241 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
7242         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7243         /// `err` or `result` depending on the state of `result_ok`.
7244         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7245         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7246         pub result_ok: bool,
7247 }
7248 #[no_mangle]
7249 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7250 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7251         CResult_UpdateFulfillHTLCDecodeErrorZ {
7252                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7253                         result: Box::into_raw(Box::new(o)),
7254                 },
7255                 result_ok: true,
7256         }
7257 }
7258 #[no_mangle]
7259 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7260 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7261         CResult_UpdateFulfillHTLCDecodeErrorZ {
7262                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7263                         err: Box::into_raw(Box::new(e)),
7264                 },
7265                 result_ok: false,
7266         }
7267 }
7268 #[no_mangle]
7269 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
7270 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7271 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
7272         fn drop(&mut self) {
7273                 if self.result_ok {
7274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7276                         }
7277                 } else {
7278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7280                         }
7281                 }
7282         }
7283 }
7284 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7285         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7286                 let contents = if o.result_ok {
7287                         let result = unsafe { o.contents.result };
7288                         unsafe { o.contents.result = std::ptr::null_mut() };
7289                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
7290                 } else {
7291                         let err = unsafe { o.contents.err };
7292                         unsafe { o.contents.err = std::ptr::null_mut(); }
7293                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7294                 };
7295                 Self {
7296                         contents,
7297                         result_ok: o.result_ok,
7298                 }
7299         }
7300 }
7301 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7302         fn clone(&self) -> Self {
7303                 if self.result_ok {
7304                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7305                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7306                         } }
7307                 } else {
7308                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7309                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7310                         } }
7311                 }
7312         }
7313 }
7314 #[no_mangle]
7315 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7316 /// but with all dynamically-allocated buffers duplicated in new buffers.
7317 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7318 #[repr(C)]
7319 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7320 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
7321         /// A pointer to the contents in the success state.
7322         /// Reading from this pointer when `result_ok` is not set is undefined.
7323         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
7324         /// A pointer to the contents in the error state.
7325         /// Reading from this pointer when `result_ok` is set is undefined.
7326         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7327 }
7328 #[repr(C)]
7329 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7330 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7332 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
7333         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7334         /// `err` or `result` depending on the state of `result_ok`.
7335         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7336         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7337         pub result_ok: bool,
7338 }
7339 #[no_mangle]
7340 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7341 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7342         CResult_UpdateAddHTLCDecodeErrorZ {
7343                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7344                         result: Box::into_raw(Box::new(o)),
7345                 },
7346                 result_ok: true,
7347         }
7348 }
7349 #[no_mangle]
7350 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7351 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7352         CResult_UpdateAddHTLCDecodeErrorZ {
7353                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7354                         err: Box::into_raw(Box::new(e)),
7355                 },
7356                 result_ok: false,
7357         }
7358 }
7359 #[no_mangle]
7360 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
7361 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7362 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
7363         fn drop(&mut self) {
7364                 if self.result_ok {
7365                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7366                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7367                         }
7368                 } else {
7369                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7370                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7371                         }
7372                 }
7373         }
7374 }
7375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7376         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
7377                 let contents = if o.result_ok {
7378                         let result = unsafe { o.contents.result };
7379                         unsafe { o.contents.result = std::ptr::null_mut() };
7380                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
7381                 } else {
7382                         let err = unsafe { o.contents.err };
7383                         unsafe { o.contents.err = std::ptr::null_mut(); }
7384                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7385                 };
7386                 Self {
7387                         contents,
7388                         result_ok: o.result_ok,
7389                 }
7390         }
7391 }
7392 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7393         fn clone(&self) -> Self {
7394                 if self.result_ok {
7395                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7396                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7397                         } }
7398                 } else {
7399                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7400                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7401                         } }
7402                 }
7403         }
7404 }
7405 #[no_mangle]
7406 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7407 /// but with all dynamically-allocated buffers duplicated in new buffers.
7408 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7409 #[repr(C)]
7410 /// The contents of CResult_PingDecodeErrorZ
7411 pub union CResult_PingDecodeErrorZPtr {
7412         /// A pointer to the contents in the success state.
7413         /// Reading from this pointer when `result_ok` is not set is undefined.
7414         pub result: *mut crate::lightning::ln::msgs::Ping,
7415         /// A pointer to the contents in the error state.
7416         /// Reading from this pointer when `result_ok` is set is undefined.
7417         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7418 }
7419 #[repr(C)]
7420 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7421 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7423 pub struct CResult_PingDecodeErrorZ {
7424         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7425         /// `err` or `result` depending on the state of `result_ok`.
7426         pub contents: CResult_PingDecodeErrorZPtr,
7427         /// Whether this CResult_PingDecodeErrorZ represents a success state.
7428         pub result_ok: bool,
7429 }
7430 #[no_mangle]
7431 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7432 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7433         CResult_PingDecodeErrorZ {
7434                 contents: CResult_PingDecodeErrorZPtr {
7435                         result: Box::into_raw(Box::new(o)),
7436                 },
7437                 result_ok: true,
7438         }
7439 }
7440 #[no_mangle]
7441 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7442 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7443         CResult_PingDecodeErrorZ {
7444                 contents: CResult_PingDecodeErrorZPtr {
7445                         err: Box::into_raw(Box::new(e)),
7446                 },
7447                 result_ok: false,
7448         }
7449 }
7450 #[no_mangle]
7451 /// Frees any resources used by the CResult_PingDecodeErrorZ.
7452 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7453 impl Drop for CResult_PingDecodeErrorZ {
7454         fn drop(&mut self) {
7455                 if self.result_ok {
7456                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7457                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7458                         }
7459                 } else {
7460                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7461                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7462                         }
7463                 }
7464         }
7465 }
7466 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7467         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
7468                 let contents = if o.result_ok {
7469                         let result = unsafe { o.contents.result };
7470                         unsafe { o.contents.result = std::ptr::null_mut() };
7471                         CResult_PingDecodeErrorZPtr { result }
7472                 } else {
7473                         let err = unsafe { o.contents.err };
7474                         unsafe { o.contents.err = std::ptr::null_mut(); }
7475                         CResult_PingDecodeErrorZPtr { err }
7476                 };
7477                 Self {
7478                         contents,
7479                         result_ok: o.result_ok,
7480                 }
7481         }
7482 }
7483 impl Clone for CResult_PingDecodeErrorZ {
7484         fn clone(&self) -> Self {
7485                 if self.result_ok {
7486                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7487                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7488                         } }
7489                 } else {
7490                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
7491                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7492                         } }
7493                 }
7494         }
7495 }
7496 #[no_mangle]
7497 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
7498 /// but with all dynamically-allocated buffers duplicated in new buffers.
7499 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7500 #[repr(C)]
7501 /// The contents of CResult_PongDecodeErrorZ
7502 pub union CResult_PongDecodeErrorZPtr {
7503         /// A pointer to the contents in the success state.
7504         /// Reading from this pointer when `result_ok` is not set is undefined.
7505         pub result: *mut crate::lightning::ln::msgs::Pong,
7506         /// A pointer to the contents in the error state.
7507         /// Reading from this pointer when `result_ok` is set is undefined.
7508         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7509 }
7510 #[repr(C)]
7511 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7512 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7513 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7514 pub struct CResult_PongDecodeErrorZ {
7515         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7516         /// `err` or `result` depending on the state of `result_ok`.
7517         pub contents: CResult_PongDecodeErrorZPtr,
7518         /// Whether this CResult_PongDecodeErrorZ represents a success state.
7519         pub result_ok: bool,
7520 }
7521 #[no_mangle]
7522 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7523 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7524         CResult_PongDecodeErrorZ {
7525                 contents: CResult_PongDecodeErrorZPtr {
7526                         result: Box::into_raw(Box::new(o)),
7527                 },
7528                 result_ok: true,
7529         }
7530 }
7531 #[no_mangle]
7532 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7533 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7534         CResult_PongDecodeErrorZ {
7535                 contents: CResult_PongDecodeErrorZPtr {
7536                         err: Box::into_raw(Box::new(e)),
7537                 },
7538                 result_ok: false,
7539         }
7540 }
7541 #[no_mangle]
7542 /// Frees any resources used by the CResult_PongDecodeErrorZ.
7543 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7544 impl Drop for CResult_PongDecodeErrorZ {
7545         fn drop(&mut self) {
7546                 if self.result_ok {
7547                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7548                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7549                         }
7550                 } else {
7551                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7552                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7553                         }
7554                 }
7555         }
7556 }
7557 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7558         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
7559                 let contents = if o.result_ok {
7560                         let result = unsafe { o.contents.result };
7561                         unsafe { o.contents.result = std::ptr::null_mut() };
7562                         CResult_PongDecodeErrorZPtr { result }
7563                 } else {
7564                         let err = unsafe { o.contents.err };
7565                         unsafe { o.contents.err = std::ptr::null_mut(); }
7566                         CResult_PongDecodeErrorZPtr { err }
7567                 };
7568                 Self {
7569                         contents,
7570                         result_ok: o.result_ok,
7571                 }
7572         }
7573 }
7574 impl Clone for CResult_PongDecodeErrorZ {
7575         fn clone(&self) -> Self {
7576                 if self.result_ok {
7577                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7578                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7579                         } }
7580                 } else {
7581                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
7582                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7583                         } }
7584                 }
7585         }
7586 }
7587 #[no_mangle]
7588 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
7589 /// but with all dynamically-allocated buffers duplicated in new buffers.
7590 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7591 #[repr(C)]
7592 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7593 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7594         /// A pointer to the contents in the success state.
7595         /// Reading from this pointer when `result_ok` is not set is undefined.
7596         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
7597         /// A pointer to the contents in the error state.
7598         /// Reading from this pointer when `result_ok` is set is undefined.
7599         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7600 }
7601 #[repr(C)]
7602 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7603 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7605 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7606         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7607         /// `err` or `result` depending on the state of `result_ok`.
7608         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7609         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7610         pub result_ok: bool,
7611 }
7612 #[no_mangle]
7613 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7614 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7615         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7616                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7617                         result: Box::into_raw(Box::new(o)),
7618                 },
7619                 result_ok: true,
7620         }
7621 }
7622 #[no_mangle]
7623 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7624 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7625         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7626                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7627                         err: Box::into_raw(Box::new(e)),
7628                 },
7629                 result_ok: false,
7630         }
7631 }
7632 #[no_mangle]
7633 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
7634 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7635 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7636         fn drop(&mut self) {
7637                 if self.result_ok {
7638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7640                         }
7641                 } else {
7642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7644                         }
7645                 }
7646         }
7647 }
7648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7650                 let contents = if o.result_ok {
7651                         let result = unsafe { o.contents.result };
7652                         unsafe { o.contents.result = std::ptr::null_mut() };
7653                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
7654                 } else {
7655                         let err = unsafe { o.contents.err };
7656                         unsafe { o.contents.err = std::ptr::null_mut(); }
7657                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
7658                 };
7659                 Self {
7660                         contents,
7661                         result_ok: o.result_ok,
7662                 }
7663         }
7664 }
7665 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7666         fn clone(&self) -> Self {
7667                 if self.result_ok {
7668                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7669                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7670                         } }
7671                 } else {
7672                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7673                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7674                         } }
7675                 }
7676         }
7677 }
7678 #[no_mangle]
7679 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7680 /// but with all dynamically-allocated buffers duplicated in new buffers.
7681 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
7682 #[repr(C)]
7683 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
7684 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
7685         /// A pointer to the contents in the success state.
7686         /// Reading from this pointer when `result_ok` is not set is undefined.
7687         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
7688         /// A pointer to the contents in the error state.
7689         /// Reading from this pointer when `result_ok` is set is undefined.
7690         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7691 }
7692 #[repr(C)]
7693 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7694 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7696 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
7697         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7698         /// `err` or `result` depending on the state of `result_ok`.
7699         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
7700         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7701         pub result_ok: bool,
7702 }
7703 #[no_mangle]
7704 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
7705 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
7706         CResult_ChannelAnnouncementDecodeErrorZ {
7707                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7708                         result: Box::into_raw(Box::new(o)),
7709                 },
7710                 result_ok: true,
7711         }
7712 }
7713 #[no_mangle]
7714 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
7715 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
7716         CResult_ChannelAnnouncementDecodeErrorZ {
7717                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7718                         err: Box::into_raw(Box::new(e)),
7719                 },
7720                 result_ok: false,
7721         }
7722 }
7723 #[no_mangle]
7724 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
7725 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
7726 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
7727         fn drop(&mut self) {
7728                 if self.result_ok {
7729                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7730                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7731                         }
7732                 } else {
7733                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7734                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7735                         }
7736                 }
7737         }
7738 }
7739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
7740         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7741                 let contents = if o.result_ok {
7742                         let result = unsafe { o.contents.result };
7743                         unsafe { o.contents.result = std::ptr::null_mut() };
7744                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
7745                 } else {
7746                         let err = unsafe { o.contents.err };
7747                         unsafe { o.contents.err = std::ptr::null_mut(); }
7748                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
7749                 };
7750                 Self {
7751                         contents,
7752                         result_ok: o.result_ok,
7753                 }
7754         }
7755 }
7756 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
7757         fn clone(&self) -> Self {
7758                 if self.result_ok {
7759                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7760                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7761                         } }
7762                 } else {
7763                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7764                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7765                         } }
7766                 }
7767         }
7768 }
7769 #[no_mangle]
7770 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7771 /// but with all dynamically-allocated buffers duplicated in new buffers.
7772 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
7773 #[repr(C)]
7774 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
7775 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7776         /// A pointer to the contents in the success state.
7777         /// Reading from this pointer when `result_ok` is not set is undefined.
7778         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
7779         /// A pointer to the contents in the error state.
7780         /// Reading from this pointer when `result_ok` is set is undefined.
7781         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7782 }
7783 #[repr(C)]
7784 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7785 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7787 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
7788         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
7789         /// `err` or `result` depending on the state of `result_ok`.
7790         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
7791         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
7792         pub result_ok: bool,
7793 }
7794 #[no_mangle]
7795 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
7796 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
7797         CResult_UnsignedChannelUpdateDecodeErrorZ {
7798                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7799                         result: Box::into_raw(Box::new(o)),
7800                 },
7801                 result_ok: true,
7802         }
7803 }
7804 #[no_mangle]
7805 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
7806 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
7807         CResult_UnsignedChannelUpdateDecodeErrorZ {
7808                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7809                         err: Box::into_raw(Box::new(e)),
7810                 },
7811                 result_ok: false,
7812         }
7813 }
7814 #[no_mangle]
7815 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
7816 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
7817 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
7818         fn drop(&mut self) {
7819                 if self.result_ok {
7820                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7821                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7822                         }
7823                 } else {
7824                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7825                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7826                         }
7827                 }
7828         }
7829 }
7830 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
7831         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7832                 let contents = if o.result_ok {
7833                         let result = unsafe { o.contents.result };
7834                         unsafe { o.contents.result = std::ptr::null_mut() };
7835                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
7836                 } else {
7837                         let err = unsafe { o.contents.err };
7838                         unsafe { o.contents.err = std::ptr::null_mut(); }
7839                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
7840                 };
7841                 Self {
7842                         contents,
7843                         result_ok: o.result_ok,
7844                 }
7845         }
7846 }
7847 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
7848         fn clone(&self) -> Self {
7849                 if self.result_ok {
7850                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7851                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
7852                         } }
7853                 } else {
7854                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7855                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7856                         } }
7857                 }
7858         }
7859 }
7860 #[no_mangle]
7861 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
7862 /// but with all dynamically-allocated buffers duplicated in new buffers.
7863 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
7864 #[repr(C)]
7865 /// The contents of CResult_ChannelUpdateDecodeErrorZ
7866 pub union CResult_ChannelUpdateDecodeErrorZPtr {
7867         /// A pointer to the contents in the success state.
7868         /// Reading from this pointer when `result_ok` is not set is undefined.
7869         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
7870         /// A pointer to the contents in the error state.
7871         /// Reading from this pointer when `result_ok` is set is undefined.
7872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7873 }
7874 #[repr(C)]
7875 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7876 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7878 pub struct CResult_ChannelUpdateDecodeErrorZ {
7879         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7880         /// `err` or `result` depending on the state of `result_ok`.
7881         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
7882         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7883         pub result_ok: bool,
7884 }
7885 #[no_mangle]
7886 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
7887 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
7888         CResult_ChannelUpdateDecodeErrorZ {
7889                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7890                         result: Box::into_raw(Box::new(o)),
7891                 },
7892                 result_ok: true,
7893         }
7894 }
7895 #[no_mangle]
7896 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
7897 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
7898         CResult_ChannelUpdateDecodeErrorZ {
7899                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7900                         err: Box::into_raw(Box::new(e)),
7901                 },
7902                 result_ok: false,
7903         }
7904 }
7905 #[no_mangle]
7906 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
7907 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
7908 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
7909         fn drop(&mut self) {
7910                 if self.result_ok {
7911                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7912                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7913                         }
7914                 } else {
7915                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7916                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7917                         }
7918                 }
7919         }
7920 }
7921 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
7922         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7923                 let contents = if o.result_ok {
7924                         let result = unsafe { o.contents.result };
7925                         unsafe { o.contents.result = std::ptr::null_mut() };
7926                         CResult_ChannelUpdateDecodeErrorZPtr { result }
7927                 } else {
7928                         let err = unsafe { o.contents.err };
7929                         unsafe { o.contents.err = std::ptr::null_mut(); }
7930                         CResult_ChannelUpdateDecodeErrorZPtr { err }
7931                 };
7932                 Self {
7933                         contents,
7934                         result_ok: o.result_ok,
7935                 }
7936         }
7937 }
7938 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
7939         fn clone(&self) -> Self {
7940                 if self.result_ok {
7941                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7942                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
7943                         } }
7944                 } else {
7945                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7946                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7947                         } }
7948                 }
7949         }
7950 }
7951 #[no_mangle]
7952 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
7953 /// but with all dynamically-allocated buffers duplicated in new buffers.
7954 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
7955 #[repr(C)]
7956 /// The contents of CResult_ErrorMessageDecodeErrorZ
7957 pub union CResult_ErrorMessageDecodeErrorZPtr {
7958         /// A pointer to the contents in the success state.
7959         /// Reading from this pointer when `result_ok` is not set is undefined.
7960         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
7961         /// A pointer to the contents in the error state.
7962         /// Reading from this pointer when `result_ok` is set is undefined.
7963         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7964 }
7965 #[repr(C)]
7966 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7967 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7969 pub struct CResult_ErrorMessageDecodeErrorZ {
7970         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7971         /// `err` or `result` depending on the state of `result_ok`.
7972         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
7973         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7974         pub result_ok: bool,
7975 }
7976 #[no_mangle]
7977 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
7978 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
7979         CResult_ErrorMessageDecodeErrorZ {
7980                 contents: CResult_ErrorMessageDecodeErrorZPtr {
7981                         result: Box::into_raw(Box::new(o)),
7982                 },
7983                 result_ok: true,
7984         }
7985 }
7986 #[no_mangle]
7987 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
7988 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
7989         CResult_ErrorMessageDecodeErrorZ {
7990                 contents: CResult_ErrorMessageDecodeErrorZPtr {
7991                         err: Box::into_raw(Box::new(e)),
7992                 },
7993                 result_ok: false,
7994         }
7995 }
7996 #[no_mangle]
7997 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
7998 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
7999 impl Drop for CResult_ErrorMessageDecodeErrorZ {
8000         fn drop(&mut self) {
8001                 if self.result_ok {
8002                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8003                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8004                         }
8005                 } else {
8006                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8007                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8008                         }
8009                 }
8010         }
8011 }
8012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8013         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
8014                 let contents = if o.result_ok {
8015                         let result = unsafe { o.contents.result };
8016                         unsafe { o.contents.result = std::ptr::null_mut() };
8017                         CResult_ErrorMessageDecodeErrorZPtr { result }
8018                 } else {
8019                         let err = unsafe { o.contents.err };
8020                         unsafe { o.contents.err = std::ptr::null_mut(); }
8021                         CResult_ErrorMessageDecodeErrorZPtr { err }
8022                 };
8023                 Self {
8024                         contents,
8025                         result_ok: o.result_ok,
8026                 }
8027         }
8028 }
8029 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8030         fn clone(&self) -> Self {
8031                 if self.result_ok {
8032                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8033                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8034                         } }
8035                 } else {
8036                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
8037                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8038                         } }
8039                 }
8040         }
8041 }
8042 #[no_mangle]
8043 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
8044 /// but with all dynamically-allocated buffers duplicated in new buffers.
8045 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8046 #[repr(C)]
8047 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8048 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8049         /// A pointer to the contents in the success state.
8050         /// Reading from this pointer when `result_ok` is not set is undefined.
8051         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
8052         /// A pointer to the contents in the error state.
8053         /// Reading from this pointer when `result_ok` is set is undefined.
8054         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8055 }
8056 #[repr(C)]
8057 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8058 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8060 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8061         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8062         /// `err` or `result` depending on the state of `result_ok`.
8063         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8064         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8065         pub result_ok: bool,
8066 }
8067 #[no_mangle]
8068 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8069 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8070         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8071                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8072                         result: Box::into_raw(Box::new(o)),
8073                 },
8074                 result_ok: true,
8075         }
8076 }
8077 #[no_mangle]
8078 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8079 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8080         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8081                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8082                         err: Box::into_raw(Box::new(e)),
8083                 },
8084                 result_ok: false,
8085         }
8086 }
8087 #[no_mangle]
8088 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
8089 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8090 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8091         fn drop(&mut self) {
8092                 if self.result_ok {
8093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8095                         }
8096                 } else {
8097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8099                         }
8100                 }
8101         }
8102 }
8103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8105                 let contents = if o.result_ok {
8106                         let result = unsafe { o.contents.result };
8107                         unsafe { o.contents.result = std::ptr::null_mut() };
8108                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8109                 } else {
8110                         let err = unsafe { o.contents.err };
8111                         unsafe { o.contents.err = std::ptr::null_mut(); }
8112                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8113                 };
8114                 Self {
8115                         contents,
8116                         result_ok: o.result_ok,
8117                 }
8118         }
8119 }
8120 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8121         fn clone(&self) -> Self {
8122                 if self.result_ok {
8123                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8124                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8125                         } }
8126                 } else {
8127                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8129                         } }
8130                 }
8131         }
8132 }
8133 #[no_mangle]
8134 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8135 /// but with all dynamically-allocated buffers duplicated in new buffers.
8136 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8137 #[repr(C)]
8138 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8139 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
8140         /// A pointer to the contents in the success state.
8141         /// Reading from this pointer when `result_ok` is not set is undefined.
8142         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
8143         /// A pointer to the contents in the error state.
8144         /// Reading from this pointer when `result_ok` is set is undefined.
8145         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8146 }
8147 #[repr(C)]
8148 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8149 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8151 pub struct CResult_NodeAnnouncementDecodeErrorZ {
8152         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8153         /// `err` or `result` depending on the state of `result_ok`.
8154         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8155         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8156         pub result_ok: bool,
8157 }
8158 #[no_mangle]
8159 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8160 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8161         CResult_NodeAnnouncementDecodeErrorZ {
8162                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8163                         result: Box::into_raw(Box::new(o)),
8164                 },
8165                 result_ok: true,
8166         }
8167 }
8168 #[no_mangle]
8169 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8170 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8171         CResult_NodeAnnouncementDecodeErrorZ {
8172                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8173                         err: Box::into_raw(Box::new(e)),
8174                 },
8175                 result_ok: false,
8176         }
8177 }
8178 #[no_mangle]
8179 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
8180 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8181 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
8182         fn drop(&mut self) {
8183                 if self.result_ok {
8184                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8185                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8186                         }
8187                 } else {
8188                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8189                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8190                         }
8191                 }
8192         }
8193 }
8194 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8195         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
8196                 let contents = if o.result_ok {
8197                         let result = unsafe { o.contents.result };
8198                         unsafe { o.contents.result = std::ptr::null_mut() };
8199                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
8200                 } else {
8201                         let err = unsafe { o.contents.err };
8202                         unsafe { o.contents.err = std::ptr::null_mut(); }
8203                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
8204                 };
8205                 Self {
8206                         contents,
8207                         result_ok: o.result_ok,
8208                 }
8209         }
8210 }
8211 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8212         fn clone(&self) -> Self {
8213                 if self.result_ok {
8214                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8215                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8216                         } }
8217                 } else {
8218                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8219                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8220                         } }
8221                 }
8222         }
8223 }
8224 #[no_mangle]
8225 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8226 /// but with all dynamically-allocated buffers duplicated in new buffers.
8227 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8228 #[repr(C)]
8229 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8230 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
8231         /// A pointer to the contents in the success state.
8232         /// Reading from this pointer when `result_ok` is not set is undefined.
8233         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
8234         /// A pointer to the contents in the error state.
8235         /// Reading from this pointer when `result_ok` is set is undefined.
8236         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8237 }
8238 #[repr(C)]
8239 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8240 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
8241 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8242 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
8243         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8244         /// `err` or `result` depending on the state of `result_ok`.
8245         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8246         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8247         pub result_ok: bool,
8248 }
8249 #[no_mangle]
8250 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8251 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8252         CResult_QueryShortChannelIdsDecodeErrorZ {
8253                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8254                         result: Box::into_raw(Box::new(o)),
8255                 },
8256                 result_ok: true,
8257         }
8258 }
8259 #[no_mangle]
8260 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8261 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8262         CResult_QueryShortChannelIdsDecodeErrorZ {
8263                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8264                         err: Box::into_raw(Box::new(e)),
8265                 },
8266                 result_ok: false,
8267         }
8268 }
8269 #[no_mangle]
8270 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
8271 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8272 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
8273         fn drop(&mut self) {
8274                 if self.result_ok {
8275                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8276                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8277                         }
8278                 } else {
8279                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8280                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8281                         }
8282                 }
8283         }
8284 }
8285 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8286         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
8287                 let contents = if o.result_ok {
8288                         let result = unsafe { o.contents.result };
8289                         unsafe { o.contents.result = std::ptr::null_mut() };
8290                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
8291                 } else {
8292                         let err = unsafe { o.contents.err };
8293                         unsafe { o.contents.err = std::ptr::null_mut(); }
8294                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8295                 };
8296                 Self {
8297                         contents,
8298                         result_ok: o.result_ok,
8299                 }
8300         }
8301 }
8302 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8303         fn clone(&self) -> Self {
8304                 if self.result_ok {
8305                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8306                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8307                         } }
8308                 } else {
8309                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8310                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8311                         } }
8312                 }
8313         }
8314 }
8315 #[no_mangle]
8316 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8317 /// but with all dynamically-allocated buffers duplicated in new buffers.
8318 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8319 #[repr(C)]
8320 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8321 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8322         /// A pointer to the contents in the success state.
8323         /// Reading from this pointer when `result_ok` is not set is undefined.
8324         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
8325         /// A pointer to the contents in the error state.
8326         /// Reading from this pointer when `result_ok` is set is undefined.
8327         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8328 }
8329 #[repr(C)]
8330 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8331 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
8332 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8333 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8334         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8335         /// `err` or `result` depending on the state of `result_ok`.
8336         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8337         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8338         pub result_ok: bool,
8339 }
8340 #[no_mangle]
8341 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8342 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8343         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8344                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8345                         result: Box::into_raw(Box::new(o)),
8346                 },
8347                 result_ok: true,
8348         }
8349 }
8350 #[no_mangle]
8351 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8352 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8353         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8354                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8355                         err: Box::into_raw(Box::new(e)),
8356                 },
8357                 result_ok: false,
8358         }
8359 }
8360 #[no_mangle]
8361 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
8362 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8363 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8364         fn drop(&mut self) {
8365                 if self.result_ok {
8366                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8367                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8368                         }
8369                 } else {
8370                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8371                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8372                         }
8373                 }
8374         }
8375 }
8376 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8377         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
8378                 let contents = if o.result_ok {
8379                         let result = unsafe { o.contents.result };
8380                         unsafe { o.contents.result = std::ptr::null_mut() };
8381                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8382                 } else {
8383                         let err = unsafe { o.contents.err };
8384                         unsafe { o.contents.err = std::ptr::null_mut(); }
8385                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8386                 };
8387                 Self {
8388                         contents,
8389                         result_ok: o.result_ok,
8390                 }
8391         }
8392 }
8393 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8394         fn clone(&self) -> Self {
8395                 if self.result_ok {
8396                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8397                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8398                         } }
8399                 } else {
8400                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8401                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8402                         } }
8403                 }
8404         }
8405 }
8406 #[no_mangle]
8407 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8408 /// but with all dynamically-allocated buffers duplicated in new buffers.
8409 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8410 #[repr(C)]
8411 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8412 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
8413         /// A pointer to the contents in the success state.
8414         /// Reading from this pointer when `result_ok` is not set is undefined.
8415         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
8416         /// A pointer to the contents in the error state.
8417         /// Reading from this pointer when `result_ok` is set is undefined.
8418         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8419 }
8420 #[repr(C)]
8421 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8422 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8424 pub struct CResult_QueryChannelRangeDecodeErrorZ {
8425         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8426         /// `err` or `result` depending on the state of `result_ok`.
8427         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8428         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8429         pub result_ok: bool,
8430 }
8431 #[no_mangle]
8432 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8433 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8434         CResult_QueryChannelRangeDecodeErrorZ {
8435                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8436                         result: Box::into_raw(Box::new(o)),
8437                 },
8438                 result_ok: true,
8439         }
8440 }
8441 #[no_mangle]
8442 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8443 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8444         CResult_QueryChannelRangeDecodeErrorZ {
8445                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8446                         err: Box::into_raw(Box::new(e)),
8447                 },
8448                 result_ok: false,
8449         }
8450 }
8451 #[no_mangle]
8452 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
8453 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8454 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
8455         fn drop(&mut self) {
8456                 if self.result_ok {
8457                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8458                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8459                         }
8460                 } else {
8461                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8462                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8463                         }
8464                 }
8465         }
8466 }
8467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8468         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8469                 let contents = if o.result_ok {
8470                         let result = unsafe { o.contents.result };
8471                         unsafe { o.contents.result = std::ptr::null_mut() };
8472                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
8473                 } else {
8474                         let err = unsafe { o.contents.err };
8475                         unsafe { o.contents.err = std::ptr::null_mut(); }
8476                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
8477                 };
8478                 Self {
8479                         contents,
8480                         result_ok: o.result_ok,
8481                 }
8482         }
8483 }
8484 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8485         fn clone(&self) -> Self {
8486                 if self.result_ok {
8487                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8488                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8489                         } }
8490                 } else {
8491                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8492                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8493                         } }
8494                 }
8495         }
8496 }
8497 #[no_mangle]
8498 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8499 /// but with all dynamically-allocated buffers duplicated in new buffers.
8500 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8501 #[repr(C)]
8502 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8503 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
8504         /// A pointer to the contents in the success state.
8505         /// Reading from this pointer when `result_ok` is not set is undefined.
8506         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
8507         /// A pointer to the contents in the error state.
8508         /// Reading from this pointer when `result_ok` is set is undefined.
8509         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8510 }
8511 #[repr(C)]
8512 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8513 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8515 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
8516         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8517         /// `err` or `result` depending on the state of `result_ok`.
8518         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8519         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8520         pub result_ok: bool,
8521 }
8522 #[no_mangle]
8523 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8524 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8525         CResult_ReplyChannelRangeDecodeErrorZ {
8526                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8527                         result: Box::into_raw(Box::new(o)),
8528                 },
8529                 result_ok: true,
8530         }
8531 }
8532 #[no_mangle]
8533 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8534 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8535         CResult_ReplyChannelRangeDecodeErrorZ {
8536                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8537                         err: Box::into_raw(Box::new(e)),
8538                 },
8539                 result_ok: false,
8540         }
8541 }
8542 #[no_mangle]
8543 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
8544 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8545 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
8546         fn drop(&mut self) {
8547                 if self.result_ok {
8548                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8549                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8550                         }
8551                 } else {
8552                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8553                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8554                         }
8555                 }
8556         }
8557 }
8558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8559         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
8560                 let contents = if o.result_ok {
8561                         let result = unsafe { o.contents.result };
8562                         unsafe { o.contents.result = std::ptr::null_mut() };
8563                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
8564                 } else {
8565                         let err = unsafe { o.contents.err };
8566                         unsafe { o.contents.err = std::ptr::null_mut(); }
8567                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8568                 };
8569                 Self {
8570                         contents,
8571                         result_ok: o.result_ok,
8572                 }
8573         }
8574 }
8575 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8576         fn clone(&self) -> Self {
8577                 if self.result_ok {
8578                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8579                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8580                         } }
8581                 } else {
8582                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8583                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8584                         } }
8585                 }
8586         }
8587 }
8588 #[no_mangle]
8589 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8590 /// but with all dynamically-allocated buffers duplicated in new buffers.
8591 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8592 #[repr(C)]
8593 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8594 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
8595         /// A pointer to the contents in the success state.
8596         /// Reading from this pointer when `result_ok` is not set is undefined.
8597         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
8598         /// A pointer to the contents in the error state.
8599         /// Reading from this pointer when `result_ok` is set is undefined.
8600         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8601 }
8602 #[repr(C)]
8603 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8604 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
8605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8606 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
8607         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8608         /// `err` or `result` depending on the state of `result_ok`.
8609         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8610         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8611         pub result_ok: bool,
8612 }
8613 #[no_mangle]
8614 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8615 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8616         CResult_GossipTimestampFilterDecodeErrorZ {
8617                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8618                         result: Box::into_raw(Box::new(o)),
8619                 },
8620                 result_ok: true,
8621         }
8622 }
8623 #[no_mangle]
8624 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8625 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8626         CResult_GossipTimestampFilterDecodeErrorZ {
8627                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8628                         err: Box::into_raw(Box::new(e)),
8629                 },
8630                 result_ok: false,
8631         }
8632 }
8633 #[no_mangle]
8634 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
8635 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8636 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
8637         fn drop(&mut self) {
8638                 if self.result_ok {
8639                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8640                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8641                         }
8642                 } else {
8643                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8644                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8645                         }
8646                 }
8647         }
8648 }
8649 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
8650         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
8651                 let contents = if o.result_ok {
8652                         let result = unsafe { o.contents.result };
8653                         unsafe { o.contents.result = std::ptr::null_mut() };
8654                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
8655                 } else {
8656                         let err = unsafe { o.contents.err };
8657                         unsafe { o.contents.err = std::ptr::null_mut(); }
8658                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
8659                 };
8660                 Self {
8661                         contents,
8662                         result_ok: o.result_ok,
8663                 }
8664         }
8665 }
8666 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
8667         fn clone(&self) -> Self {
8668                 if self.result_ok {
8669                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8670                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
8671                         } }
8672                 } else {
8673                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8674                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8675                         } }
8676                 }
8677         }
8678 }
8679 #[no_mangle]
8680 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
8681 /// but with all dynamically-allocated buffers duplicated in new buffers.
8682 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
8683 #[repr(C)]
8684 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
8685 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8686         /// A pointer to the contents in the success state.
8687         /// Reading from this pointer when `result_ok` is not set is undefined.
8688         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
8689         /// A pointer to the contents in the error state.
8690         /// Reading from this pointer when `result_ok` is set is undefined.
8691         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8692 }
8693 #[repr(C)]
8694 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
8695 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
8696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8697 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
8698         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
8699         /// `err` or `result` depending on the state of `result_ok`.
8700         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
8701         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
8702         pub result_ok: bool,
8703 }
8704 #[no_mangle]
8705 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
8706 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
8707         CResult_SpendableOutputDescriptorDecodeErrorZ {
8708                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8709                         result: Box::into_raw(Box::new(o)),
8710                 },
8711                 result_ok: true,
8712         }
8713 }
8714 #[no_mangle]
8715 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
8716 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
8717         CResult_SpendableOutputDescriptorDecodeErrorZ {
8718                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8719                         err: Box::into_raw(Box::new(e)),
8720                 },
8721                 result_ok: false,
8722         }
8723 }
8724 #[no_mangle]
8725 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
8726 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
8727 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
8728         fn drop(&mut self) {
8729                 if self.result_ok {
8730                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8731                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8732                         }
8733                 } else {
8734                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8735                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8736                         }
8737                 }
8738         }
8739 }
8740 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
8741         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
8742                 let contents = if o.result_ok {
8743                         let result = unsafe { o.contents.result };
8744                         unsafe { o.contents.result = std::ptr::null_mut() };
8745                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
8746                 } else {
8747                         let err = unsafe { o.contents.err };
8748                         unsafe { o.contents.err = std::ptr::null_mut(); }
8749                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
8750                 };
8751                 Self {
8752                         contents,
8753                         result_ok: o.result_ok,
8754                 }
8755         }
8756 }
8757 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
8758         fn clone(&self) -> Self {
8759                 if self.result_ok {
8760                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8761                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
8762                         } }
8763                 } else {
8764                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
8765                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8766                         } }
8767                 }
8768         }
8769 }
8770 #[no_mangle]
8771 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
8772 /// but with all dynamically-allocated buffers duplicated in new buffers.
8773 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
8774 #[repr(C)]
8775 /// A tuple of 2 elements. See the individual fields for the types contained.
8776 pub struct C2Tuple_SignatureCVec_SignatureZZ {
8777         /// The element at position 0
8778         pub a: crate::c_types::Signature,
8779         /// The element at position 1
8780         pub b: crate::c_types::derived::CVec_SignatureZ,
8781 }
8782 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
8783         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
8784                 Self {
8785                         a: tup.0,
8786                         b: tup.1,
8787                 }
8788         }
8789 }
8790 impl C2Tuple_SignatureCVec_SignatureZZ {
8791         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
8792                 (self.a, self.b)
8793         }
8794 }
8795 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
8796         fn clone(&self) -> Self {
8797                 Self {
8798                         a: self.a.clone(),
8799                         b: self.b.clone(),
8800                 }
8801         }
8802 }
8803 #[no_mangle]
8804 /// Creates a new tuple which has the same data as `orig`
8805 /// but with all dynamically-allocated buffers duplicated in new buffers.
8806 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
8807 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
8808 #[no_mangle]
8809 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
8810         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
8811 }
8812
8813 #[no_mangle]
8814 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
8815 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
8816 #[repr(C)]
8817 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
8818 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8819         /// A pointer to the contents in the success state.
8820         /// Reading from this pointer when `result_ok` is not set is undefined.
8821         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
8822         /// Note that this value is always NULL, as there are no contents in the Err variant
8823         pub err: *mut std::ffi::c_void,
8824 }
8825 #[repr(C)]
8826 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
8827 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
8828 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8829 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8830         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
8831         /// `err` or `result` depending on the state of `result_ok`.
8832         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
8833         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
8834         pub result_ok: bool,
8835 }
8836 #[no_mangle]
8837 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
8838 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8839         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8840                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8841                         result: Box::into_raw(Box::new(o)),
8842                 },
8843                 result_ok: true,
8844         }
8845 }
8846 #[no_mangle]
8847 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
8848 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8849         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8850                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8851                         err: std::ptr::null_mut(),
8852                 },
8853                 result_ok: false,
8854         }
8855 }
8856 #[no_mangle]
8857 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
8858 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
8859 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8860         fn drop(&mut self) {
8861                 if self.result_ok {
8862                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8863                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8864                         }
8865                 } else {
8866                 }
8867         }
8868 }
8869 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8870         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
8871                 let contents = if o.result_ok {
8872                         let result = unsafe { o.contents.result };
8873                         unsafe { o.contents.result = std::ptr::null_mut() };
8874                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
8875                 } else {
8876                         let _ = unsafe { Box::from_raw(o.contents.err) };
8877                         o.contents.err = std::ptr::null_mut();
8878                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
8879                 };
8880                 Self {
8881                         contents,
8882                         result_ok: o.result_ok,
8883                 }
8884         }
8885 }
8886 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8887         fn clone(&self) -> Self {
8888                 if self.result_ok {
8889                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8890                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
8891                         } }
8892                 } else {
8893                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8894                                 err: std::ptr::null_mut()
8895                         } }
8896                 }
8897         }
8898 }
8899 #[no_mangle]
8900 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
8901 /// but with all dynamically-allocated buffers duplicated in new buffers.
8902 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
8903 #[repr(C)]
8904 /// The contents of CResult_SignatureNoneZ
8905 pub union CResult_SignatureNoneZPtr {
8906         /// A pointer to the contents in the success state.
8907         /// Reading from this pointer when `result_ok` is not set is undefined.
8908         pub result: *mut crate::c_types::Signature,
8909         /// Note that this value is always NULL, as there are no contents in the Err variant
8910         pub err: *mut std::ffi::c_void,
8911 }
8912 #[repr(C)]
8913 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
8914 /// containing a crate::c_types::Signature on success and a () on failure.
8915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8916 pub struct CResult_SignatureNoneZ {
8917         /// The contents of this CResult_SignatureNoneZ, accessible via either
8918         /// `err` or `result` depending on the state of `result_ok`.
8919         pub contents: CResult_SignatureNoneZPtr,
8920         /// Whether this CResult_SignatureNoneZ represents a success state.
8921         pub result_ok: bool,
8922 }
8923 #[no_mangle]
8924 /// Creates a new CResult_SignatureNoneZ in the success state.
8925 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
8926         CResult_SignatureNoneZ {
8927                 contents: CResult_SignatureNoneZPtr {
8928                         result: Box::into_raw(Box::new(o)),
8929                 },
8930                 result_ok: true,
8931         }
8932 }
8933 #[no_mangle]
8934 /// Creates a new CResult_SignatureNoneZ in the error state.
8935 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
8936         CResult_SignatureNoneZ {
8937                 contents: CResult_SignatureNoneZPtr {
8938                         err: std::ptr::null_mut(),
8939                 },
8940                 result_ok: false,
8941         }
8942 }
8943 #[no_mangle]
8944 /// Frees any resources used by the CResult_SignatureNoneZ.
8945 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
8946 impl Drop for CResult_SignatureNoneZ {
8947         fn drop(&mut self) {
8948                 if self.result_ok {
8949                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8950                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8951                         }
8952                 } else {
8953                 }
8954         }
8955 }
8956 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
8957         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
8958                 let contents = if o.result_ok {
8959                         let result = unsafe { o.contents.result };
8960                         unsafe { o.contents.result = std::ptr::null_mut() };
8961                         CResult_SignatureNoneZPtr { result }
8962                 } else {
8963                         let _ = unsafe { Box::from_raw(o.contents.err) };
8964                         o.contents.err = std::ptr::null_mut();
8965                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
8966                 };
8967                 Self {
8968                         contents,
8969                         result_ok: o.result_ok,
8970                 }
8971         }
8972 }
8973 impl Clone for CResult_SignatureNoneZ {
8974         fn clone(&self) -> Self {
8975                 if self.result_ok {
8976                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
8977                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
8978                         } }
8979                 } else {
8980                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
8981                                 err: std::ptr::null_mut()
8982                         } }
8983                 }
8984         }
8985 }
8986 #[no_mangle]
8987 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
8988 /// but with all dynamically-allocated buffers duplicated in new buffers.
8989 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
8990 #[repr(C)]
8991 /// The contents of CResult_SignDecodeErrorZ
8992 pub union CResult_SignDecodeErrorZPtr {
8993         /// A pointer to the contents in the success state.
8994         /// Reading from this pointer when `result_ok` is not set is undefined.
8995         pub result: *mut crate::lightning::chain::keysinterface::Sign,
8996         /// A pointer to the contents in the error state.
8997         /// Reading from this pointer when `result_ok` is set is undefined.
8998         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8999 }
9000 #[repr(C)]
9001 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
9002 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
9003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9004 pub struct CResult_SignDecodeErrorZ {
9005         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
9006         /// `err` or `result` depending on the state of `result_ok`.
9007         pub contents: CResult_SignDecodeErrorZPtr,
9008         /// Whether this CResult_SignDecodeErrorZ represents a success state.
9009         pub result_ok: bool,
9010 }
9011 #[no_mangle]
9012 /// Creates a new CResult_SignDecodeErrorZ in the success state.
9013 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
9014         CResult_SignDecodeErrorZ {
9015                 contents: CResult_SignDecodeErrorZPtr {
9016                         result: Box::into_raw(Box::new(o)),
9017                 },
9018                 result_ok: true,
9019         }
9020 }
9021 #[no_mangle]
9022 /// Creates a new CResult_SignDecodeErrorZ in the error state.
9023 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
9024         CResult_SignDecodeErrorZ {
9025                 contents: CResult_SignDecodeErrorZPtr {
9026                         err: Box::into_raw(Box::new(e)),
9027                 },
9028                 result_ok: false,
9029         }
9030 }
9031 #[no_mangle]
9032 /// Frees any resources used by the CResult_SignDecodeErrorZ.
9033 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
9034 impl Drop for CResult_SignDecodeErrorZ {
9035         fn drop(&mut self) {
9036                 if self.result_ok {
9037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9039                         }
9040                 } else {
9041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9043                         }
9044                 }
9045         }
9046 }
9047 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
9048         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
9049                 let contents = if o.result_ok {
9050                         let result = unsafe { o.contents.result };
9051                         unsafe { o.contents.result = std::ptr::null_mut() };
9052                         CResult_SignDecodeErrorZPtr { result }
9053                 } else {
9054                         let err = unsafe { o.contents.err };
9055                         unsafe { o.contents.err = std::ptr::null_mut(); }
9056                         CResult_SignDecodeErrorZPtr { err }
9057                 };
9058                 Self {
9059                         contents,
9060                         result_ok: o.result_ok,
9061                 }
9062         }
9063 }
9064 impl Clone for CResult_SignDecodeErrorZ {
9065         fn clone(&self) -> Self {
9066                 if self.result_ok {
9067                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
9068                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
9069                         } }
9070                 } else {
9071                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
9072                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9073                         } }
9074                 }
9075         }
9076 }
9077 #[no_mangle]
9078 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9079 /// but with all dynamically-allocated buffers duplicated in new buffers.
9080 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
9081 #[repr(C)]
9082 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
9083 /// This corresponds to std::vector in C++
9084 pub struct CVec_CVec_u8ZZ {
9085         /// The elements in the array.
9086         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9087         pub data: *mut crate::c_types::derived::CVec_u8Z,
9088         /// The number of elements pointed to by `data`.
9089         pub datalen: usize
9090 }
9091 impl CVec_CVec_u8ZZ {
9092         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
9093                 if self.datalen == 0 { return Vec::new(); }
9094                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9095                 self.data = std::ptr::null_mut();
9096                 self.datalen = 0;
9097                 ret
9098         }
9099         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
9100                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9101         }
9102 }
9103 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
9104         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
9105                 let datalen = v.len();
9106                 let data = Box::into_raw(v.into_boxed_slice());
9107                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9108         }
9109 }
9110 #[no_mangle]
9111 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9112 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
9113 impl Drop for CVec_CVec_u8ZZ {
9114         fn drop(&mut self) {
9115                 if self.datalen == 0 { return; }
9116                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9117         }
9118 }
9119 impl Clone for CVec_CVec_u8ZZ {
9120         fn clone(&self) -> Self {
9121                 let mut res = Vec::new();
9122                 if self.datalen == 0 { return Self::from(res); }
9123                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9124                 Self::from(res)
9125         }
9126 }
9127 #[repr(C)]
9128 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
9129 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
9130         /// A pointer to the contents in the success state.
9131         /// Reading from this pointer when `result_ok` is not set is undefined.
9132         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
9133         /// Note that this value is always NULL, as there are no contents in the Err variant
9134         pub err: *mut std::ffi::c_void,
9135 }
9136 #[repr(C)]
9137 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
9138 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
9139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9140 pub struct CResult_CVec_CVec_u8ZZNoneZ {
9141         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
9142         /// `err` or `result` depending on the state of `result_ok`.
9143         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
9144         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
9145         pub result_ok: bool,
9146 }
9147 #[no_mangle]
9148 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9149 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
9150         CResult_CVec_CVec_u8ZZNoneZ {
9151                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9152                         result: Box::into_raw(Box::new(o)),
9153                 },
9154                 result_ok: true,
9155         }
9156 }
9157 #[no_mangle]
9158 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9159 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
9160         CResult_CVec_CVec_u8ZZNoneZ {
9161                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9162                         err: std::ptr::null_mut(),
9163                 },
9164                 result_ok: false,
9165         }
9166 }
9167 #[no_mangle]
9168 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9169 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
9170 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
9171         fn drop(&mut self) {
9172                 if self.result_ok {
9173                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9174                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9175                         }
9176                 } else {
9177                 }
9178         }
9179 }
9180 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
9181         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
9182                 let contents = if o.result_ok {
9183                         let result = unsafe { o.contents.result };
9184                         unsafe { o.contents.result = std::ptr::null_mut() };
9185                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
9186                 } else {
9187                         let _ = unsafe { Box::from_raw(o.contents.err) };
9188                         o.contents.err = std::ptr::null_mut();
9189                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
9190                 };
9191                 Self {
9192                         contents,
9193                         result_ok: o.result_ok,
9194                 }
9195         }
9196 }
9197 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
9198         fn clone(&self) -> Self {
9199                 if self.result_ok {
9200                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9201                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
9202                         } }
9203                 } else {
9204                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
9205                                 err: std::ptr::null_mut()
9206                         } }
9207                 }
9208         }
9209 }
9210 #[no_mangle]
9211 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9212 /// but with all dynamically-allocated buffers duplicated in new buffers.
9213 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
9214 #[repr(C)]
9215 /// The contents of CResult_InMemorySignerDecodeErrorZ
9216 pub union CResult_InMemorySignerDecodeErrorZPtr {
9217         /// A pointer to the contents in the success state.
9218         /// Reading from this pointer when `result_ok` is not set is undefined.
9219         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
9220         /// A pointer to the contents in the error state.
9221         /// Reading from this pointer when `result_ok` is set is undefined.
9222         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9223 }
9224 #[repr(C)]
9225 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
9226 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
9227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9228 pub struct CResult_InMemorySignerDecodeErrorZ {
9229         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
9230         /// `err` or `result` depending on the state of `result_ok`.
9231         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
9232         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
9233         pub result_ok: bool,
9234 }
9235 #[no_mangle]
9236 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9237 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
9238         CResult_InMemorySignerDecodeErrorZ {
9239                 contents: CResult_InMemorySignerDecodeErrorZPtr {
9240                         result: Box::into_raw(Box::new(o)),
9241                 },
9242                 result_ok: true,
9243         }
9244 }
9245 #[no_mangle]
9246 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9247 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
9248         CResult_InMemorySignerDecodeErrorZ {
9249                 contents: CResult_InMemorySignerDecodeErrorZPtr {
9250                         err: Box::into_raw(Box::new(e)),
9251                 },
9252                 result_ok: false,
9253         }
9254 }
9255 #[no_mangle]
9256 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9257 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
9258 impl Drop for CResult_InMemorySignerDecodeErrorZ {
9259         fn drop(&mut self) {
9260                 if self.result_ok {
9261                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9262                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9263                         }
9264                 } else {
9265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9267                         }
9268                 }
9269         }
9270 }
9271 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
9272         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
9273                 let contents = if o.result_ok {
9274                         let result = unsafe { o.contents.result };
9275                         unsafe { o.contents.result = std::ptr::null_mut() };
9276                         CResult_InMemorySignerDecodeErrorZPtr { result }
9277                 } else {
9278                         let err = unsafe { o.contents.err };
9279                         unsafe { o.contents.err = std::ptr::null_mut(); }
9280                         CResult_InMemorySignerDecodeErrorZPtr { err }
9281                 };
9282                 Self {
9283                         contents,
9284                         result_ok: o.result_ok,
9285                 }
9286         }
9287 }
9288 impl Clone for CResult_InMemorySignerDecodeErrorZ {
9289         fn clone(&self) -> Self {
9290                 if self.result_ok {
9291                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
9292                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
9293                         } }
9294                 } else {
9295                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
9296                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9297                         } }
9298                 }
9299         }
9300 }
9301 #[no_mangle]
9302 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9303 /// but with all dynamically-allocated buffers duplicated in new buffers.
9304 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
9305 #[repr(C)]
9306 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
9307 /// This corresponds to std::vector in C++
9308 pub struct CVec_TxOutZ {
9309         /// The elements in the array.
9310         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9311         pub data: *mut crate::c_types::TxOut,
9312         /// The number of elements pointed to by `data`.
9313         pub datalen: usize
9314 }
9315 impl CVec_TxOutZ {
9316         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
9317                 if self.datalen == 0 { return Vec::new(); }
9318                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9319                 self.data = std::ptr::null_mut();
9320                 self.datalen = 0;
9321                 ret
9322         }
9323         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
9324                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9325         }
9326 }
9327 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
9328         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
9329                 let datalen = v.len();
9330                 let data = Box::into_raw(v.into_boxed_slice());
9331                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9332         }
9333 }
9334 #[no_mangle]
9335 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9336 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
9337 impl Drop for CVec_TxOutZ {
9338         fn drop(&mut self) {
9339                 if self.datalen == 0 { return; }
9340                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9341         }
9342 }
9343 impl Clone for CVec_TxOutZ {
9344         fn clone(&self) -> Self {
9345                 let mut res = Vec::new();
9346                 if self.datalen == 0 { return Self::from(res); }
9347                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9348                 Self::from(res)
9349         }
9350 }
9351 #[repr(C)]
9352 /// The contents of CResult_TransactionNoneZ
9353 pub union CResult_TransactionNoneZPtr {
9354         /// A pointer to the contents in the success state.
9355         /// Reading from this pointer when `result_ok` is not set is undefined.
9356         pub result: *mut crate::c_types::Transaction,
9357         /// Note that this value is always NULL, as there are no contents in the Err variant
9358         pub err: *mut std::ffi::c_void,
9359 }
9360 #[repr(C)]
9361 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
9362 /// containing a crate::c_types::Transaction on success and a () on failure.
9363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9364 pub struct CResult_TransactionNoneZ {
9365         /// The contents of this CResult_TransactionNoneZ, accessible via either
9366         /// `err` or `result` depending on the state of `result_ok`.
9367         pub contents: CResult_TransactionNoneZPtr,
9368         /// Whether this CResult_TransactionNoneZ represents a success state.
9369         pub result_ok: bool,
9370 }
9371 #[no_mangle]
9372 /// Creates a new CResult_TransactionNoneZ in the success state.
9373 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
9374         CResult_TransactionNoneZ {
9375                 contents: CResult_TransactionNoneZPtr {
9376                         result: Box::into_raw(Box::new(o)),
9377                 },
9378                 result_ok: true,
9379         }
9380 }
9381 #[no_mangle]
9382 /// Creates a new CResult_TransactionNoneZ in the error state.
9383 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
9384         CResult_TransactionNoneZ {
9385                 contents: CResult_TransactionNoneZPtr {
9386                         err: std::ptr::null_mut(),
9387                 },
9388                 result_ok: false,
9389         }
9390 }
9391 #[no_mangle]
9392 /// Frees any resources used by the CResult_TransactionNoneZ.
9393 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
9394 impl Drop for CResult_TransactionNoneZ {
9395         fn drop(&mut self) {
9396                 if self.result_ok {
9397                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9398                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9399                         }
9400                 } else {
9401                 }
9402         }
9403 }
9404 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
9405         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
9406                 let contents = if o.result_ok {
9407                         let result = unsafe { o.contents.result };
9408                         unsafe { o.contents.result = std::ptr::null_mut() };
9409                         CResult_TransactionNoneZPtr { result }
9410                 } else {
9411                         let _ = unsafe { Box::from_raw(o.contents.err) };
9412                         o.contents.err = std::ptr::null_mut();
9413                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
9414                 };
9415                 Self {
9416                         contents,
9417                         result_ok: o.result_ok,
9418                 }
9419         }
9420 }
9421 #[repr(C)]
9422 /// The contents of CResult_NoneErrorZ
9423 pub union CResult_NoneErrorZPtr {
9424         /// Note that this value is always NULL, as there are no contents in the OK variant
9425         pub result: *mut std::ffi::c_void,
9426         /// A pointer to the contents in the error state.
9427         /// Reading from this pointer when `result_ok` is set is undefined.
9428         pub err: *mut crate::c_types::IOError,
9429 }
9430 #[repr(C)]
9431 /// A CResult_NoneErrorZ represents the result of a fallible operation,
9432 /// containing a () on success and a crate::c_types::IOError on failure.
9433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9434 pub struct CResult_NoneErrorZ {
9435         /// The contents of this CResult_NoneErrorZ, accessible via either
9436         /// `err` or `result` depending on the state of `result_ok`.
9437         pub contents: CResult_NoneErrorZPtr,
9438         /// Whether this CResult_NoneErrorZ represents a success state.
9439         pub result_ok: bool,
9440 }
9441 #[no_mangle]
9442 /// Creates a new CResult_NoneErrorZ in the success state.
9443 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
9444         CResult_NoneErrorZ {
9445                 contents: CResult_NoneErrorZPtr {
9446                         result: std::ptr::null_mut(),
9447                 },
9448                 result_ok: true,
9449         }
9450 }
9451 #[no_mangle]
9452 /// Creates a new CResult_NoneErrorZ in the error state.
9453 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
9454         CResult_NoneErrorZ {
9455                 contents: CResult_NoneErrorZPtr {
9456                         err: Box::into_raw(Box::new(e)),
9457                 },
9458                 result_ok: false,
9459         }
9460 }
9461 #[no_mangle]
9462 /// Frees any resources used by the CResult_NoneErrorZ.
9463 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
9464 impl Drop for CResult_NoneErrorZ {
9465         fn drop(&mut self) {
9466                 if self.result_ok {
9467                 } else {
9468                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9469                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9470                         }
9471                 }
9472         }
9473 }
9474 impl From<crate::c_types::CResultTempl<u8, crate::c_types::IOError>> for CResult_NoneErrorZ {
9475         fn from(mut o: crate::c_types::CResultTempl<u8, crate::c_types::IOError>) -> Self {
9476                 let contents = if o.result_ok {
9477                         let _ = unsafe { Box::from_raw(o.contents.result) };
9478                         o.contents.result = std::ptr::null_mut();
9479                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
9480                 } else {
9481                         let err = unsafe { o.contents.err };
9482                         unsafe { o.contents.err = std::ptr::null_mut(); }
9483                         CResult_NoneErrorZPtr { err }
9484                 };
9485                 Self {
9486                         contents,
9487                         result_ok: o.result_ok,
9488                 }
9489         }
9490 }
9491 #[repr(C)]
9492 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
9493 /// This corresponds to std::vector in C++
9494 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
9495         /// The elements in the array.
9496         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9497         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9498         /// The number of elements pointed to by `data`.
9499         pub datalen: usize
9500 }
9501 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
9502         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
9503                 if self.datalen == 0 { return Vec::new(); }
9504                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9505                 self.data = std::ptr::null_mut();
9506                 self.datalen = 0;
9507                 ret
9508         }
9509         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
9510                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9511         }
9512 }
9513 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
9514         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
9515                 let datalen = v.len();
9516                 let data = Box::into_raw(v.into_boxed_slice());
9517                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9518         }
9519 }
9520 #[no_mangle]
9521 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9522 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
9523 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
9524         fn drop(&mut self) {
9525                 if self.datalen == 0 { return; }
9526                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9527         }
9528 }
9529 #[repr(C)]
9530 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
9531 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9532         /// A pointer to the contents in the success state.
9533         /// Reading from this pointer when `result_ok` is not set is undefined.
9534         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
9535         /// A pointer to the contents in the error state.
9536         /// Reading from this pointer when `result_ok` is set is undefined.
9537         pub err: *mut crate::c_types::IOError,
9538 }
9539 #[repr(C)]
9540 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
9541 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
9542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9543 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9544         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
9545         /// `err` or `result` depending on the state of `result_ok`.
9546         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
9547         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
9548         pub result_ok: bool,
9549 }
9550 #[no_mangle]
9551 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9552 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9553         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9554                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9555                         result: Box::into_raw(Box::new(o)),
9556                 },
9557                 result_ok: true,
9558         }
9559 }
9560 #[no_mangle]
9561 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9562 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9563         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9564                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
9565                         err: Box::into_raw(Box::new(e)),
9566                 },
9567                 result_ok: false,
9568         }
9569 }
9570 #[no_mangle]
9571 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9572 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
9573 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9574         fn drop(&mut self) {
9575                 if self.result_ok {
9576                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9577                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9578                         }
9579                 } else {
9580                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9581                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9582                         }
9583                 }
9584         }
9585 }
9586 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
9587         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
9588                 let contents = if o.result_ok {
9589                         let result = unsafe { o.contents.result };
9590                         unsafe { o.contents.result = std::ptr::null_mut() };
9591                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
9592                 } else {
9593                         let err = unsafe { o.contents.err };
9594                         unsafe { o.contents.err = std::ptr::null_mut(); }
9595                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
9596                 };
9597                 Self {
9598                         contents,
9599                         result_ok: o.result_ok,
9600                 }
9601         }
9602 }
9603 #[repr(C)]
9604 /// The contents of CResult_NoneAPIErrorZ
9605 pub union CResult_NoneAPIErrorZPtr {
9606         /// Note that this value is always NULL, as there are no contents in the OK variant
9607         pub result: *mut std::ffi::c_void,
9608         /// A pointer to the contents in the error state.
9609         /// Reading from this pointer when `result_ok` is set is undefined.
9610         pub err: *mut crate::lightning::util::errors::APIError,
9611 }
9612 #[repr(C)]
9613 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
9614 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
9615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9616 pub struct CResult_NoneAPIErrorZ {
9617         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
9618         /// `err` or `result` depending on the state of `result_ok`.
9619         pub contents: CResult_NoneAPIErrorZPtr,
9620         /// Whether this CResult_NoneAPIErrorZ represents a success state.
9621         pub result_ok: bool,
9622 }
9623 #[no_mangle]
9624 /// Creates a new CResult_NoneAPIErrorZ in the success state.
9625 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
9626         CResult_NoneAPIErrorZ {
9627                 contents: CResult_NoneAPIErrorZPtr {
9628                         result: std::ptr::null_mut(),
9629                 },
9630                 result_ok: true,
9631         }
9632 }
9633 #[no_mangle]
9634 /// Creates a new CResult_NoneAPIErrorZ in the error state.
9635 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
9636         CResult_NoneAPIErrorZ {
9637                 contents: CResult_NoneAPIErrorZPtr {
9638                         err: Box::into_raw(Box::new(e)),
9639                 },
9640                 result_ok: false,
9641         }
9642 }
9643 #[no_mangle]
9644 /// Frees any resources used by the CResult_NoneAPIErrorZ.
9645 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
9646 impl Drop for CResult_NoneAPIErrorZ {
9647         fn drop(&mut self) {
9648                 if self.result_ok {
9649                 } else {
9650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9652                         }
9653                 }
9654         }
9655 }
9656 impl From<crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
9657         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>) -> Self {
9658                 let contents = if o.result_ok {
9659                         let _ = unsafe { Box::from_raw(o.contents.result) };
9660                         o.contents.result = std::ptr::null_mut();
9661                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
9662                 } else {
9663                         let err = unsafe { o.contents.err };
9664                         unsafe { o.contents.err = std::ptr::null_mut(); }
9665                         CResult_NoneAPIErrorZPtr { err }
9666                 };
9667                 Self {
9668                         contents,
9669                         result_ok: o.result_ok,
9670                 }
9671         }
9672 }
9673 impl Clone for CResult_NoneAPIErrorZ {
9674         fn clone(&self) -> Self {
9675                 if self.result_ok {
9676                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
9677                                 result: std::ptr::null_mut()
9678                         } }
9679                 } else {
9680                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
9681                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9682                         } }
9683                 }
9684         }
9685 }
9686 #[no_mangle]
9687 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9688 /// but with all dynamically-allocated buffers duplicated in new buffers.
9689 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
9690 #[repr(C)]
9691 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
9692 /// This corresponds to std::vector in C++
9693 pub struct CVec_CResult_NoneAPIErrorZZ {
9694         /// The elements in the array.
9695         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9696         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
9697         /// The number of elements pointed to by `data`.
9698         pub datalen: usize
9699 }
9700 impl CVec_CResult_NoneAPIErrorZZ {
9701         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
9702                 if self.datalen == 0 { return Vec::new(); }
9703                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9704                 self.data = std::ptr::null_mut();
9705                 self.datalen = 0;
9706                 ret
9707         }
9708         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
9709                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9710         }
9711 }
9712 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
9713         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
9714                 let datalen = v.len();
9715                 let data = Box::into_raw(v.into_boxed_slice());
9716                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9717         }
9718 }
9719 #[no_mangle]
9720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9721 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
9722 impl Drop for CVec_CResult_NoneAPIErrorZZ {
9723         fn drop(&mut self) {
9724                 if self.datalen == 0 { return; }
9725                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9726         }
9727 }
9728 impl Clone for CVec_CResult_NoneAPIErrorZZ {
9729         fn clone(&self) -> Self {
9730                 let mut res = Vec::new();
9731                 if self.datalen == 0 { return Self::from(res); }
9732                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9733                 Self::from(res)
9734         }
9735 }
9736 #[repr(C)]
9737 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
9738 /// This corresponds to std::vector in C++
9739 pub struct CVec_APIErrorZ {
9740         /// The elements in the array.
9741         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9742         pub data: *mut crate::lightning::util::errors::APIError,
9743         /// The number of elements pointed to by `data`.
9744         pub datalen: usize
9745 }
9746 impl CVec_APIErrorZ {
9747         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
9748                 if self.datalen == 0 { return Vec::new(); }
9749                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9750                 self.data = std::ptr::null_mut();
9751                 self.datalen = 0;
9752                 ret
9753         }
9754         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
9755                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9756         }
9757 }
9758 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
9759         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
9760                 let datalen = v.len();
9761                 let data = Box::into_raw(v.into_boxed_slice());
9762                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9763         }
9764 }
9765 #[no_mangle]
9766 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9767 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
9768 impl Drop for CVec_APIErrorZ {
9769         fn drop(&mut self) {
9770                 if self.datalen == 0 { return; }
9771                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9772         }
9773 }
9774 impl Clone for CVec_APIErrorZ {
9775         fn clone(&self) -> Self {
9776                 let mut res = Vec::new();
9777                 if self.datalen == 0 { return Self::from(res); }
9778                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
9779                 Self::from(res)
9780         }
9781 }
9782 #[repr(C)]
9783 /// The contents of CResult_NonePaymentSendFailureZ
9784 pub union CResult_NonePaymentSendFailureZPtr {
9785         /// Note that this value is always NULL, as there are no contents in the OK variant
9786         pub result: *mut std::ffi::c_void,
9787         /// A pointer to the contents in the error state.
9788         /// Reading from this pointer when `result_ok` is set is undefined.
9789         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
9790 }
9791 #[repr(C)]
9792 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9793 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
9794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9795 pub struct CResult_NonePaymentSendFailureZ {
9796         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9797         /// `err` or `result` depending on the state of `result_ok`.
9798         pub contents: CResult_NonePaymentSendFailureZPtr,
9799         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9800         pub result_ok: bool,
9801 }
9802 #[no_mangle]
9803 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9804 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9805         CResult_NonePaymentSendFailureZ {
9806                 contents: CResult_NonePaymentSendFailureZPtr {
9807                         result: std::ptr::null_mut(),
9808                 },
9809                 result_ok: true,
9810         }
9811 }
9812 #[no_mangle]
9813 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9814 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9815         CResult_NonePaymentSendFailureZ {
9816                 contents: CResult_NonePaymentSendFailureZPtr {
9817                         err: Box::into_raw(Box::new(e)),
9818                 },
9819                 result_ok: false,
9820         }
9821 }
9822 #[no_mangle]
9823 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9824 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9825 impl Drop for CResult_NonePaymentSendFailureZ {
9826         fn drop(&mut self) {
9827                 if self.result_ok {
9828                 } else {
9829                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9830                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9831                         }
9832                 }
9833         }
9834 }
9835 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9836         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
9837                 let contents = if o.result_ok {
9838                         let _ = unsafe { Box::from_raw(o.contents.result) };
9839                         o.contents.result = std::ptr::null_mut();
9840                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
9841                 } else {
9842                         let err = unsafe { o.contents.err };
9843                         unsafe { o.contents.err = std::ptr::null_mut(); }
9844                         CResult_NonePaymentSendFailureZPtr { err }
9845                 };
9846                 Self {
9847                         contents,
9848                         result_ok: o.result_ok,
9849                 }
9850         }
9851 }
9852 impl Clone for CResult_NonePaymentSendFailureZ {
9853         fn clone(&self) -> Self {
9854                 if self.result_ok {
9855                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9856                                 result: std::ptr::null_mut()
9857                         } }
9858                 } else {
9859                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9860                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9861                         } }
9862                 }
9863         }
9864 }
9865 #[no_mangle]
9866 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9867 /// but with all dynamically-allocated buffers duplicated in new buffers.
9868 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
9869 #[repr(C)]
9870 /// A tuple of 2 elements. See the individual fields for the types contained.
9871 pub struct C2Tuple_PaymentHashPaymentSecretZ {
9872         /// The element at position 0
9873         pub a: crate::c_types::ThirtyTwoBytes,
9874         /// The element at position 1
9875         pub b: crate::c_types::ThirtyTwoBytes,
9876 }
9877 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
9878         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9879                 Self {
9880                         a: tup.0,
9881                         b: tup.1,
9882                 }
9883         }
9884 }
9885 impl C2Tuple_PaymentHashPaymentSecretZ {
9886         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9887                 (self.a, self.b)
9888         }
9889 }
9890 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9891 #[no_mangle]
9892 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
9893         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
9894 }
9895
9896 #[no_mangle]
9897 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9898 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
9899 #[repr(C)]
9900 /// The contents of CResult_PaymentSecretAPIErrorZ
9901 pub union CResult_PaymentSecretAPIErrorZPtr {
9902         /// A pointer to the contents in the success state.
9903         /// Reading from this pointer when `result_ok` is not set is undefined.
9904         pub result: *mut crate::c_types::ThirtyTwoBytes,
9905         /// A pointer to the contents in the error state.
9906         /// Reading from this pointer when `result_ok` is set is undefined.
9907         pub err: *mut crate::lightning::util::errors::APIError,
9908 }
9909 #[repr(C)]
9910 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9911 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9913 pub struct CResult_PaymentSecretAPIErrorZ {
9914         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9915         /// `err` or `result` depending on the state of `result_ok`.
9916         pub contents: CResult_PaymentSecretAPIErrorZPtr,
9917         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9918         pub result_ok: bool,
9919 }
9920 #[no_mangle]
9921 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9922 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9923         CResult_PaymentSecretAPIErrorZ {
9924                 contents: CResult_PaymentSecretAPIErrorZPtr {
9925                         result: Box::into_raw(Box::new(o)),
9926                 },
9927                 result_ok: true,
9928         }
9929 }
9930 #[no_mangle]
9931 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9932 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9933         CResult_PaymentSecretAPIErrorZ {
9934                 contents: CResult_PaymentSecretAPIErrorZPtr {
9935                         err: Box::into_raw(Box::new(e)),
9936                 },
9937                 result_ok: false,
9938         }
9939 }
9940 #[no_mangle]
9941 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9942 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9943 impl Drop for CResult_PaymentSecretAPIErrorZ {
9944         fn drop(&mut self) {
9945                 if self.result_ok {
9946                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9947                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9948                         }
9949                 } else {
9950                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9951                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9952                         }
9953                 }
9954         }
9955 }
9956 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9957         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9958                 let contents = if o.result_ok {
9959                         let result = unsafe { o.contents.result };
9960                         unsafe { o.contents.result = std::ptr::null_mut() };
9961                         CResult_PaymentSecretAPIErrorZPtr { result }
9962                 } else {
9963                         let err = unsafe { o.contents.err };
9964                         unsafe { o.contents.err = std::ptr::null_mut(); }
9965                         CResult_PaymentSecretAPIErrorZPtr { err }
9966                 };
9967                 Self {
9968                         contents,
9969                         result_ok: o.result_ok,
9970                 }
9971         }
9972 }
9973 #[repr(C)]
9974 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9975 /// This corresponds to std::vector in C++
9976 pub struct CVec_ChannelMonitorZ {
9977         /// The elements in the array.
9978         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9979         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9980         /// The number of elements pointed to by `data`.
9981         pub datalen: usize
9982 }
9983 impl CVec_ChannelMonitorZ {
9984         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9985                 if self.datalen == 0 { return Vec::new(); }
9986                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9987                 self.data = std::ptr::null_mut();
9988                 self.datalen = 0;
9989                 ret
9990         }
9991         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9992                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9993         }
9994 }
9995 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9996         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9997                 let datalen = v.len();
9998                 let data = Box::into_raw(v.into_boxed_slice());
9999                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10000         }
10001 }
10002 #[no_mangle]
10003 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10004 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10005 impl Drop for CVec_ChannelMonitorZ {
10006         fn drop(&mut self) {
10007                 if self.datalen == 0 { return; }
10008                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
10009         }
10010 }
10011 #[repr(C)]
10012 /// A tuple of 2 elements. See the individual fields for the types contained.
10013 pub struct C2Tuple_BlockHashChannelManagerZ {
10014         /// The element at position 0
10015         pub a: crate::c_types::ThirtyTwoBytes,
10016         /// The element at position 1
10017         pub b: crate::lightning::ln::channelmanager::ChannelManager,
10018 }
10019 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10020         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10021                 Self {
10022                         a: tup.0,
10023                         b: tup.1,
10024                 }
10025         }
10026 }
10027 impl C2Tuple_BlockHashChannelManagerZ {
10028         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10029                 (self.a, self.b)
10030         }
10031 }
10032 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10033 #[no_mangle]
10034 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10035         C2Tuple_BlockHashChannelManagerZ { a, b, }
10036 }
10037
10038 #[no_mangle]
10039 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10040 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10041 #[repr(C)]
10042 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10043 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10044         /// A pointer to the contents in the success state.
10045         /// Reading from this pointer when `result_ok` is not set is undefined.
10046         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10047         /// A pointer to the contents in the error state.
10048         /// Reading from this pointer when `result_ok` is set is undefined.
10049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10050 }
10051 #[repr(C)]
10052 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10053 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10055 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10056         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10057         /// `err` or `result` depending on the state of `result_ok`.
10058         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10059         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10060         pub result_ok: bool,
10061 }
10062 #[no_mangle]
10063 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10064 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10065         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10066                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10067                         result: Box::into_raw(Box::new(o)),
10068                 },
10069                 result_ok: true,
10070         }
10071 }
10072 #[no_mangle]
10073 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10074 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10075         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10076                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10077                         err: Box::into_raw(Box::new(e)),
10078                 },
10079                 result_ok: false,
10080         }
10081 }
10082 #[no_mangle]
10083 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10084 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10085 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10086         fn drop(&mut self) {
10087                 if self.result_ok {
10088                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10089                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10090                         }
10091                 } else {
10092                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10093                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10094                         }
10095                 }
10096         }
10097 }
10098 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10099         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10100                 let contents = if o.result_ok {
10101                         let result = unsafe { o.contents.result };
10102                         unsafe { o.contents.result = std::ptr::null_mut() };
10103                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10104                 } else {
10105                         let err = unsafe { o.contents.err };
10106                         unsafe { o.contents.err = std::ptr::null_mut(); }
10107                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10108                 };
10109                 Self {
10110                         contents,
10111                         result_ok: o.result_ok,
10112                 }
10113         }
10114 }