Merge pull request #14 from TheBlueMatt/main
[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 /// The contents of CResult_StringErrorZ
1372 pub union CResult_StringErrorZPtr {
1373         /// A pointer to the contents in the success state.
1374         /// Reading from this pointer when `result_ok` is not set is undefined.
1375         pub result: *mut crate::c_types::derived::CVec_u8Z,
1376         /// A pointer to the contents in the error state.
1377         /// Reading from this pointer when `result_ok` is set is undefined.
1378         pub err: *mut crate::c_types::Secp256k1Error,
1379 }
1380 #[repr(C)]
1381 /// A CResult_StringErrorZ represents the result of a fallible operation,
1382 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::Secp256k1Error on failure.
1383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1384 pub struct CResult_StringErrorZ {
1385         /// The contents of this CResult_StringErrorZ, accessible via either
1386         /// `err` or `result` depending on the state of `result_ok`.
1387         pub contents: CResult_StringErrorZPtr,
1388         /// Whether this CResult_StringErrorZ represents a success state.
1389         pub result_ok: bool,
1390 }
1391 #[no_mangle]
1392 /// Creates a new CResult_StringErrorZ in the success state.
1393 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_StringErrorZ {
1394         CResult_StringErrorZ {
1395                 contents: CResult_StringErrorZPtr {
1396                         result: Box::into_raw(Box::new(o)),
1397                 },
1398                 result_ok: true,
1399         }
1400 }
1401 #[no_mangle]
1402 /// Creates a new CResult_StringErrorZ in the error state.
1403 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
1404         CResult_StringErrorZ {
1405                 contents: CResult_StringErrorZPtr {
1406                         err: Box::into_raw(Box::new(e)),
1407                 },
1408                 result_ok: false,
1409         }
1410 }
1411 #[no_mangle]
1412 /// Frees any resources used by the CResult_StringErrorZ.
1413 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
1414 impl Drop for CResult_StringErrorZ {
1415         fn drop(&mut self) {
1416                 if self.result_ok {
1417                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1418                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1419                         }
1420                 } else {
1421                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1422                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1423                         }
1424                 }
1425         }
1426 }
1427 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
1428         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>) -> Self {
1429                 let contents = if o.result_ok {
1430                         let result = unsafe { o.contents.result };
1431                         unsafe { o.contents.result = std::ptr::null_mut() };
1432                         CResult_StringErrorZPtr { result }
1433                 } else {
1434                         let err = unsafe { o.contents.err };
1435                         unsafe { o.contents.err = std::ptr::null_mut(); }
1436                         CResult_StringErrorZPtr { err }
1437                 };
1438                 Self {
1439                         contents,
1440                         result_ok: o.result_ok,
1441                 }
1442         }
1443 }
1444 #[repr(C)]
1445 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1446 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1447         /// A pointer to the contents in the success state.
1448         /// Reading from this pointer when `result_ok` is not set is undefined.
1449         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
1450         /// A pointer to the contents in the error state.
1451         /// Reading from this pointer when `result_ok` is set is undefined.
1452         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1453 }
1454 #[repr(C)]
1455 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
1456 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1458 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
1459         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
1460         /// `err` or `result` depending on the state of `result_ok`.
1461         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
1462         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
1463         pub result_ok: bool,
1464 }
1465 #[no_mangle]
1466 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
1467 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
1468         CResult_ChannelMonitorUpdateDecodeErrorZ {
1469                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1470                         result: Box::into_raw(Box::new(o)),
1471                 },
1472                 result_ok: true,
1473         }
1474 }
1475 #[no_mangle]
1476 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
1477 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
1478         CResult_ChannelMonitorUpdateDecodeErrorZ {
1479                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1480                         err: Box::into_raw(Box::new(e)),
1481                 },
1482                 result_ok: false,
1483         }
1484 }
1485 #[no_mangle]
1486 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
1487 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
1488 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
1489         fn drop(&mut self) {
1490                 if self.result_ok {
1491                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1492                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1493                         }
1494                 } else {
1495                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1496                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1497                         }
1498                 }
1499         }
1500 }
1501 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
1502         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
1503                 let contents = if o.result_ok {
1504                         let result = unsafe { o.contents.result };
1505                         unsafe { o.contents.result = std::ptr::null_mut() };
1506                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
1507                 } else {
1508                         let err = unsafe { o.contents.err };
1509                         unsafe { o.contents.err = std::ptr::null_mut(); }
1510                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
1511                 };
1512                 Self {
1513                         contents,
1514                         result_ok: o.result_ok,
1515                 }
1516         }
1517 }
1518 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
1519         fn clone(&self) -> Self {
1520                 if self.result_ok {
1521                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1522                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
1523                         } }
1524                 } else {
1525                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1526                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1527                         } }
1528                 }
1529         }
1530 }
1531 #[no_mangle]
1532 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
1533 /// but with all dynamically-allocated buffers duplicated in new buffers.
1534 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
1535 #[repr(C)]
1536 /// The contents of CResult_HTLCUpdateDecodeErrorZ
1537 pub union CResult_HTLCUpdateDecodeErrorZPtr {
1538         /// A pointer to the contents in the success state.
1539         /// Reading from this pointer when `result_ok` is not set is undefined.
1540         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
1541         /// A pointer to the contents in the error state.
1542         /// Reading from this pointer when `result_ok` is set is undefined.
1543         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1544 }
1545 #[repr(C)]
1546 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
1547 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1548 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1549 pub struct CResult_HTLCUpdateDecodeErrorZ {
1550         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
1551         /// `err` or `result` depending on the state of `result_ok`.
1552         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
1553         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
1554         pub result_ok: bool,
1555 }
1556 #[no_mangle]
1557 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
1558 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
1559         CResult_HTLCUpdateDecodeErrorZ {
1560                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
1561                         result: Box::into_raw(Box::new(o)),
1562                 },
1563                 result_ok: true,
1564         }
1565 }
1566 #[no_mangle]
1567 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
1568 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
1569         CResult_HTLCUpdateDecodeErrorZ {
1570                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
1571                         err: Box::into_raw(Box::new(e)),
1572                 },
1573                 result_ok: false,
1574         }
1575 }
1576 #[no_mangle]
1577 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
1578 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
1579 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
1580         fn drop(&mut self) {
1581                 if self.result_ok {
1582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1584                         }
1585                 } else {
1586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1588                         }
1589                 }
1590         }
1591 }
1592 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
1593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
1594                 let contents = if o.result_ok {
1595                         let result = unsafe { o.contents.result };
1596                         unsafe { o.contents.result = std::ptr::null_mut() };
1597                         CResult_HTLCUpdateDecodeErrorZPtr { result }
1598                 } else {
1599                         let err = unsafe { o.contents.err };
1600                         unsafe { o.contents.err = std::ptr::null_mut(); }
1601                         CResult_HTLCUpdateDecodeErrorZPtr { err }
1602                 };
1603                 Self {
1604                         contents,
1605                         result_ok: o.result_ok,
1606                 }
1607         }
1608 }
1609 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
1610         fn clone(&self) -> Self {
1611                 if self.result_ok {
1612                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
1613                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
1614                         } }
1615                 } else {
1616                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
1617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1618                         } }
1619                 }
1620         }
1621 }
1622 #[no_mangle]
1623 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
1624 /// but with all dynamically-allocated buffers duplicated in new buffers.
1625 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
1626 #[repr(C)]
1627 /// The contents of CResult_NoneMonitorUpdateErrorZ
1628 pub union CResult_NoneMonitorUpdateErrorZPtr {
1629         /// Note that this value is always NULL, as there are no contents in the OK variant
1630         pub result: *mut std::ffi::c_void,
1631         /// A pointer to the contents in the error state.
1632         /// Reading from this pointer when `result_ok` is set is undefined.
1633         pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
1634 }
1635 #[repr(C)]
1636 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
1637 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
1638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1639 pub struct CResult_NoneMonitorUpdateErrorZ {
1640         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
1641         /// `err` or `result` depending on the state of `result_ok`.
1642         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
1643         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
1644         pub result_ok: bool,
1645 }
1646 #[no_mangle]
1647 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
1648 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
1649         CResult_NoneMonitorUpdateErrorZ {
1650                 contents: CResult_NoneMonitorUpdateErrorZPtr {
1651                         result: std::ptr::null_mut(),
1652                 },
1653                 result_ok: true,
1654         }
1655 }
1656 #[no_mangle]
1657 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
1658 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
1659         CResult_NoneMonitorUpdateErrorZ {
1660                 contents: CResult_NoneMonitorUpdateErrorZPtr {
1661                         err: Box::into_raw(Box::new(e)),
1662                 },
1663                 result_ok: false,
1664         }
1665 }
1666 #[no_mangle]
1667 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
1668 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
1669 impl Drop for CResult_NoneMonitorUpdateErrorZ {
1670         fn drop(&mut self) {
1671                 if self.result_ok {
1672                 } else {
1673                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1674                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1675                         }
1676                 }
1677         }
1678 }
1679 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
1680         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
1681                 let contents = if o.result_ok {
1682                         let _ = unsafe { Box::from_raw(o.contents.result) };
1683                         o.contents.result = std::ptr::null_mut();
1684                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
1685                 } else {
1686                         let err = unsafe { o.contents.err };
1687                         unsafe { o.contents.err = std::ptr::null_mut(); }
1688                         CResult_NoneMonitorUpdateErrorZPtr { err }
1689                 };
1690                 Self {
1691                         contents,
1692                         result_ok: o.result_ok,
1693                 }
1694         }
1695 }
1696 impl Clone for CResult_NoneMonitorUpdateErrorZ {
1697         fn clone(&self) -> Self {
1698                 if self.result_ok {
1699                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
1700                                 result: std::ptr::null_mut()
1701                         } }
1702                 } else {
1703                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
1704                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
1705                         } }
1706                 }
1707         }
1708 }
1709 #[no_mangle]
1710 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
1711 /// but with all dynamically-allocated buffers duplicated in new buffers.
1712 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
1713 #[repr(C)]
1714 /// A tuple of 2 elements. See the individual fields for the types contained.
1715 pub struct C2Tuple_OutPointScriptZ {
1716         /// The element at position 0
1717         pub a: crate::lightning::chain::transaction::OutPoint,
1718         /// The element at position 1
1719         pub b: crate::c_types::derived::CVec_u8Z,
1720 }
1721 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
1722         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
1723                 Self {
1724                         a: tup.0,
1725                         b: tup.1,
1726                 }
1727         }
1728 }
1729 impl C2Tuple_OutPointScriptZ {
1730         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
1731                 (self.a, self.b)
1732         }
1733 }
1734 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
1735 #[no_mangle]
1736 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
1737         C2Tuple_OutPointScriptZ { a, b, }
1738 }
1739
1740 #[no_mangle]
1741 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
1742 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
1743 #[repr(C)]
1744 /// A tuple of 2 elements. See the individual fields for the types contained.
1745 pub struct C2Tuple_u32ScriptZ {
1746         /// The element at position 0
1747         pub a: u32,
1748         /// The element at position 1
1749         pub b: crate::c_types::derived::CVec_u8Z,
1750 }
1751 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
1752         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
1753                 Self {
1754                         a: tup.0,
1755                         b: tup.1,
1756                 }
1757         }
1758 }
1759 impl C2Tuple_u32ScriptZ {
1760         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
1761                 (self.a, self.b)
1762         }
1763 }
1764 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
1765 #[no_mangle]
1766 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
1767         C2Tuple_u32ScriptZ { a, b, }
1768 }
1769
1770 #[no_mangle]
1771 /// Frees any resources used by the C2Tuple_u32ScriptZ.
1772 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
1773 #[repr(C)]
1774 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
1775 /// This corresponds to std::vector in C++
1776 pub struct CVec_C2Tuple_u32ScriptZZ {
1777         /// The elements in the array.
1778         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1779         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
1780         /// The number of elements pointed to by `data`.
1781         pub datalen: usize
1782 }
1783 impl CVec_C2Tuple_u32ScriptZZ {
1784         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
1785                 if self.datalen == 0 { return Vec::new(); }
1786                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1787                 self.data = std::ptr::null_mut();
1788                 self.datalen = 0;
1789                 ret
1790         }
1791         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
1792                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1793         }
1794 }
1795 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
1796         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
1797                 let datalen = v.len();
1798                 let data = Box::into_raw(v.into_boxed_slice());
1799                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1800         }
1801 }
1802 #[no_mangle]
1803 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1804 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
1805 impl Drop for CVec_C2Tuple_u32ScriptZZ {
1806         fn drop(&mut self) {
1807                 if self.datalen == 0 { return; }
1808                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1809         }
1810 }
1811 #[repr(C)]
1812 /// A tuple of 2 elements. See the individual fields for the types contained.
1813 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1814         /// The element at position 0
1815         pub a: crate::c_types::ThirtyTwoBytes,
1816         /// The element at position 1
1817         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
1818 }
1819 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1820         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
1821                 Self {
1822                         a: tup.0,
1823                         b: tup.1,
1824                 }
1825         }
1826 }
1827 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1828         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
1829                 (self.a, self.b)
1830         }
1831 }
1832 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
1833 #[no_mangle]
1834 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 {
1835         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
1836 }
1837
1838 #[no_mangle]
1839 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
1840 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
1841 #[repr(C)]
1842 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
1843 /// This corresponds to std::vector in C++
1844 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1845         /// The elements in the array.
1846         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1847         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
1848         /// The number of elements pointed to by `data`.
1849         pub datalen: usize
1850 }
1851 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1852         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
1853                 if self.datalen == 0 { return Vec::new(); }
1854                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1855                 self.data = std::ptr::null_mut();
1856                 self.datalen = 0;
1857                 ret
1858         }
1859         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
1860                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1861         }
1862 }
1863 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1864         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
1865                 let datalen = v.len();
1866                 let data = Box::into_raw(v.into_boxed_slice());
1867                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1868         }
1869 }
1870 #[no_mangle]
1871 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1872 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
1873 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1874         fn drop(&mut self) {
1875                 if self.datalen == 0 { return; }
1876                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1877         }
1878 }
1879 #[repr(C)]
1880 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1881 /// This corresponds to std::vector in C++
1882 pub struct CVec_MonitorEventZ {
1883         /// The elements in the array.
1884         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1885         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
1886         /// The number of elements pointed to by `data`.
1887         pub datalen: usize
1888 }
1889 impl CVec_MonitorEventZ {
1890         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
1891                 if self.datalen == 0 { return Vec::new(); }
1892                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1893                 self.data = std::ptr::null_mut();
1894                 self.datalen = 0;
1895                 ret
1896         }
1897         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
1898                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1899         }
1900 }
1901 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
1902         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
1903                 let datalen = v.len();
1904                 let data = Box::into_raw(v.into_boxed_slice());
1905                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1906         }
1907 }
1908 #[no_mangle]
1909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1910 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
1911 impl Drop for CVec_MonitorEventZ {
1912         fn drop(&mut self) {
1913                 if self.datalen == 0 { return; }
1914                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1915         }
1916 }
1917 impl Clone for CVec_MonitorEventZ {
1918         fn clone(&self) -> Self {
1919                 let mut res = Vec::new();
1920                 if self.datalen == 0 { return Self::from(res); }
1921                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1922                 Self::from(res)
1923         }
1924 }
1925 #[repr(C)]
1926 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
1927 /// This corresponds to std::vector in C++
1928 pub struct CVec_EventZ {
1929         /// The elements in the array.
1930         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1931         pub data: *mut crate::lightning::util::events::Event,
1932         /// The number of elements pointed to by `data`.
1933         pub datalen: usize
1934 }
1935 impl CVec_EventZ {
1936         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
1937                 if self.datalen == 0 { return Vec::new(); }
1938                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1939                 self.data = std::ptr::null_mut();
1940                 self.datalen = 0;
1941                 ret
1942         }
1943         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
1944                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1945         }
1946 }
1947 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
1948         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
1949                 let datalen = v.len();
1950                 let data = Box::into_raw(v.into_boxed_slice());
1951                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1952         }
1953 }
1954 #[no_mangle]
1955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1956 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
1957 impl Drop for CVec_EventZ {
1958         fn drop(&mut self) {
1959                 if self.datalen == 0 { return; }
1960                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1961         }
1962 }
1963 impl Clone for CVec_EventZ {
1964         fn clone(&self) -> Self {
1965                 let mut res = Vec::new();
1966                 if self.datalen == 0 { return Self::from(res); }
1967                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1968                 Self::from(res)
1969         }
1970 }
1971 #[repr(C)]
1972 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
1973 /// This corresponds to std::vector in C++
1974 pub struct CVec_TransactionZ {
1975         /// The elements in the array.
1976         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1977         pub data: *mut crate::c_types::Transaction,
1978         /// The number of elements pointed to by `data`.
1979         pub datalen: usize
1980 }
1981 impl CVec_TransactionZ {
1982         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
1983                 if self.datalen == 0 { return Vec::new(); }
1984                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1985                 self.data = std::ptr::null_mut();
1986                 self.datalen = 0;
1987                 ret
1988         }
1989         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
1990                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1991         }
1992 }
1993 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
1994         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
1995                 let datalen = v.len();
1996                 let data = Box::into_raw(v.into_boxed_slice());
1997                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1998         }
1999 }
2000 #[no_mangle]
2001 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2002 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
2003 impl Drop for CVec_TransactionZ {
2004         fn drop(&mut self) {
2005                 if self.datalen == 0 { return; }
2006                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2007         }
2008 }
2009 #[repr(C)]
2010 /// A tuple of 2 elements. See the individual fields for the types contained.
2011 pub struct C2Tuple_usizeTransactionZ {
2012         /// The element at position 0
2013         pub a: usize,
2014         /// The element at position 1
2015         pub b: crate::c_types::Transaction,
2016 }
2017 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2018         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2019                 Self {
2020                         a: tup.0,
2021                         b: tup.1,
2022                 }
2023         }
2024 }
2025 impl C2Tuple_usizeTransactionZ {
2026         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2027                 (self.a, self.b)
2028         }
2029 }
2030 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2031 #[no_mangle]
2032 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2033         C2Tuple_usizeTransactionZ { a, b, }
2034 }
2035
2036 #[no_mangle]
2037 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2038 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2039 #[repr(C)]
2040 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2041 /// This corresponds to std::vector in C++
2042 pub struct CVec_C2Tuple_usizeTransactionZZ {
2043         /// The elements in the array.
2044         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2045         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2046         /// The number of elements pointed to by `data`.
2047         pub datalen: usize
2048 }
2049 impl CVec_C2Tuple_usizeTransactionZZ {
2050         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2051                 if self.datalen == 0 { return Vec::new(); }
2052                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2053                 self.data = std::ptr::null_mut();
2054                 self.datalen = 0;
2055                 ret
2056         }
2057         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2058                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2059         }
2060 }
2061 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2062         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2063                 let datalen = v.len();
2064                 let data = Box::into_raw(v.into_boxed_slice());
2065                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2066         }
2067 }
2068 #[no_mangle]
2069 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2070 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2071 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2072         fn drop(&mut self) {
2073                 if self.datalen == 0 { return; }
2074                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2075         }
2076 }
2077 #[repr(C)]
2078 /// A tuple of 2 elements. See the individual fields for the types contained.
2079 pub struct C2Tuple_u32TxOutZ {
2080         /// The element at position 0
2081         pub a: u32,
2082         /// The element at position 1
2083         pub b: crate::c_types::TxOut,
2084 }
2085 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
2086         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
2087                 Self {
2088                         a: tup.0,
2089                         b: tup.1,
2090                 }
2091         }
2092 }
2093 impl C2Tuple_u32TxOutZ {
2094         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
2095                 (self.a, self.b)
2096         }
2097 }
2098 impl Clone for C2Tuple_u32TxOutZ {
2099         fn clone(&self) -> Self {
2100                 Self {
2101                         a: self.a.clone(),
2102                         b: self.b.clone(),
2103                 }
2104         }
2105 }
2106 #[no_mangle]
2107 /// Creates a new tuple which has the same data as `orig`
2108 /// but with all dynamically-allocated buffers duplicated in new buffers.
2109 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
2110 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
2111 #[no_mangle]
2112 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
2113         C2Tuple_u32TxOutZ { a, b, }
2114 }
2115
2116 #[no_mangle]
2117 /// Frees any resources used by the C2Tuple_u32TxOutZ.
2118 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
2119 #[repr(C)]
2120 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
2121 /// This corresponds to std::vector in C++
2122 pub struct CVec_C2Tuple_u32TxOutZZ {
2123         /// The elements in the array.
2124         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2125         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
2126         /// The number of elements pointed to by `data`.
2127         pub datalen: usize
2128 }
2129 impl CVec_C2Tuple_u32TxOutZZ {
2130         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
2131                 if self.datalen == 0 { return Vec::new(); }
2132                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2133                 self.data = std::ptr::null_mut();
2134                 self.datalen = 0;
2135                 ret
2136         }
2137         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
2138                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2139         }
2140 }
2141 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
2142         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
2143                 let datalen = v.len();
2144                 let data = Box::into_raw(v.into_boxed_slice());
2145                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2146         }
2147 }
2148 #[no_mangle]
2149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2150 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
2151 impl Drop for CVec_C2Tuple_u32TxOutZZ {
2152         fn drop(&mut self) {
2153                 if self.datalen == 0 { return; }
2154                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2155         }
2156 }
2157 impl Clone for CVec_C2Tuple_u32TxOutZZ {
2158         fn clone(&self) -> Self {
2159                 let mut res = Vec::new();
2160                 if self.datalen == 0 { return Self::from(res); }
2161                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2162                 Self::from(res)
2163         }
2164 }
2165 #[repr(C)]
2166 /// A tuple of 2 elements. See the individual fields for the types contained.
2167 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2168         /// The element at position 0
2169         pub a: crate::c_types::ThirtyTwoBytes,
2170         /// The element at position 1
2171         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
2172 }
2173 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2174         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
2175                 Self {
2176                         a: tup.0,
2177                         b: tup.1,
2178                 }
2179         }
2180 }
2181 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2182         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
2183                 (self.a, self.b)
2184         }
2185 }
2186 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
2187 #[no_mangle]
2188 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 {
2189         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
2190 }
2191
2192 #[no_mangle]
2193 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
2194 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
2195 #[repr(C)]
2196 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
2197 /// This corresponds to std::vector in C++
2198 pub struct CVec_TransactionOutputsZ {
2199         /// The elements in the array.
2200         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2201         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
2202         /// The number of elements pointed to by `data`.
2203         pub datalen: usize
2204 }
2205 impl CVec_TransactionOutputsZ {
2206         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
2207                 if self.datalen == 0 { return Vec::new(); }
2208                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2209                 self.data = std::ptr::null_mut();
2210                 self.datalen = 0;
2211                 ret
2212         }
2213         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
2214                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2215         }
2216 }
2217 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
2218         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
2219                 let datalen = v.len();
2220                 let data = Box::into_raw(v.into_boxed_slice());
2221                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2222         }
2223 }
2224 #[no_mangle]
2225 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2226 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
2227 impl Drop for CVec_TransactionOutputsZ {
2228         fn drop(&mut self) {
2229                 if self.datalen == 0 { return; }
2230                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2231         }
2232 }
2233 #[repr(C)]
2234 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2235 /// This corresponds to std::vector in C++
2236 pub struct CVec_TxidZ {
2237         /// The elements in the array.
2238         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2239         pub data: *mut crate::c_types::ThirtyTwoBytes,
2240         /// The number of elements pointed to by `data`.
2241         pub datalen: usize
2242 }
2243 impl CVec_TxidZ {
2244         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2245                 if self.datalen == 0 { return Vec::new(); }
2246                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2247                 self.data = std::ptr::null_mut();
2248                 self.datalen = 0;
2249                 ret
2250         }
2251         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2252                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2253         }
2254 }
2255 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2256         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2257                 let datalen = v.len();
2258                 let data = Box::into_raw(v.into_boxed_slice());
2259                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2260         }
2261 }
2262 #[no_mangle]
2263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2264 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2265 impl Drop for CVec_TxidZ {
2266         fn drop(&mut self) {
2267                 if self.datalen == 0 { return; }
2268                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2269         }
2270 }
2271 #[repr(C)]
2272 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2273 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2274         /// Note that this value is always NULL, as there are no contents in the OK variant
2275         pub result: *mut std::ffi::c_void,
2276         /// A pointer to the contents in the error state.
2277         /// Reading from this pointer when `result_ok` is set is undefined.
2278         pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2279 }
2280 #[repr(C)]
2281 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2282 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2284 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2285         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2286         /// `err` or `result` depending on the state of `result_ok`.
2287         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2288         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2289         pub result_ok: bool,
2290 }
2291 #[no_mangle]
2292 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2293 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2294         CResult_NoneChannelMonitorUpdateErrZ {
2295                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2296                         result: std::ptr::null_mut(),
2297                 },
2298                 result_ok: true,
2299         }
2300 }
2301 #[no_mangle]
2302 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2303 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2304         CResult_NoneChannelMonitorUpdateErrZ {
2305                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2306                         err: Box::into_raw(Box::new(e)),
2307                 },
2308                 result_ok: false,
2309         }
2310 }
2311 #[no_mangle]
2312 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2313 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2314 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2315         fn drop(&mut self) {
2316                 if self.result_ok {
2317                 } else {
2318                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2319                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2320                         }
2321                 }
2322         }
2323 }
2324 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2325         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2326                 let contents = if o.result_ok {
2327                         let _ = unsafe { Box::from_raw(o.contents.result) };
2328                         o.contents.result = std::ptr::null_mut();
2329                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2330                 } else {
2331                         let err = unsafe { o.contents.err };
2332                         unsafe { o.contents.err = std::ptr::null_mut(); }
2333                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2334                 };
2335                 Self {
2336                         contents,
2337                         result_ok: o.result_ok,
2338                 }
2339         }
2340 }
2341 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2342         fn clone(&self) -> Self {
2343                 if self.result_ok {
2344                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2345                                 result: std::ptr::null_mut()
2346                         } }
2347                 } else {
2348                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2349                                 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2350                         } }
2351                 }
2352         }
2353 }
2354 #[no_mangle]
2355 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2356 /// but with all dynamically-allocated buffers duplicated in new buffers.
2357 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2358 #[repr(C)]
2359 /// A tuple of 2 elements. See the individual fields for the types contained.
2360 pub struct C2Tuple_BlockHashChannelMonitorZ {
2361         /// The element at position 0
2362         pub a: crate::c_types::ThirtyTwoBytes,
2363         /// The element at position 1
2364         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
2365 }
2366 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
2367         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
2368                 Self {
2369                         a: tup.0,
2370                         b: tup.1,
2371                 }
2372         }
2373 }
2374 impl C2Tuple_BlockHashChannelMonitorZ {
2375         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
2376                 (self.a, self.b)
2377         }
2378 }
2379 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
2380 #[no_mangle]
2381 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
2382         C2Tuple_BlockHashChannelMonitorZ { a, b, }
2383 }
2384
2385 #[no_mangle]
2386 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
2387 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
2388 #[repr(C)]
2389 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
2390 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2391         /// A pointer to the contents in the success state.
2392         /// Reading from this pointer when `result_ok` is not set is undefined.
2393         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
2394         /// A pointer to the contents in the error state.
2395         /// Reading from this pointer when `result_ok` is set is undefined.
2396         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2397 }
2398 #[repr(C)]
2399 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
2400 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2402 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2403         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
2404         /// `err` or `result` depending on the state of `result_ok`.
2405         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
2406         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
2407         pub result_ok: bool,
2408 }
2409 #[no_mangle]
2410 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
2411 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2412         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2413                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2414                         result: Box::into_raw(Box::new(o)),
2415                 },
2416                 result_ok: true,
2417         }
2418 }
2419 #[no_mangle]
2420 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
2421 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2422         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2423                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2424                         err: Box::into_raw(Box::new(e)),
2425                 },
2426                 result_ok: false,
2427         }
2428 }
2429 #[no_mangle]
2430 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
2431 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
2432 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2433         fn drop(&mut self) {
2434                 if self.result_ok {
2435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2437                         }
2438                 } else {
2439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2441                         }
2442                 }
2443         }
2444 }
2445 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2446         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
2447                 let contents = if o.result_ok {
2448                         let result = unsafe { o.contents.result };
2449                         unsafe { o.contents.result = std::ptr::null_mut() };
2450                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
2451                 } else {
2452                         let err = unsafe { o.contents.err };
2453                         unsafe { o.contents.err = std::ptr::null_mut(); }
2454                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
2455                 };
2456                 Self {
2457                         contents,
2458                         result_ok: o.result_ok,
2459                 }
2460         }
2461 }
2462 #[repr(C)]
2463 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2464 /// This corresponds to std::vector in C++
2465 pub struct CVec_RouteHopZ {
2466         /// The elements in the array.
2467         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2468         pub data: *mut crate::lightning::routing::router::RouteHop,
2469         /// The number of elements pointed to by `data`.
2470         pub datalen: usize
2471 }
2472 impl CVec_RouteHopZ {
2473         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2474                 if self.datalen == 0 { return Vec::new(); }
2475                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2476                 self.data = std::ptr::null_mut();
2477                 self.datalen = 0;
2478                 ret
2479         }
2480         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2481                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2482         }
2483 }
2484 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2485         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2486                 let datalen = v.len();
2487                 let data = Box::into_raw(v.into_boxed_slice());
2488                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2489         }
2490 }
2491 #[no_mangle]
2492 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2493 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2494 impl Drop for CVec_RouteHopZ {
2495         fn drop(&mut self) {
2496                 if self.datalen == 0 { return; }
2497                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2498         }
2499 }
2500 impl Clone for CVec_RouteHopZ {
2501         fn clone(&self) -> Self {
2502                 let mut res = Vec::new();
2503                 if self.datalen == 0 { return Self::from(res); }
2504                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2505                 Self::from(res)
2506         }
2507 }
2508 #[repr(C)]
2509 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2510 /// This corresponds to std::vector in C++
2511 pub struct CVec_CVec_RouteHopZZ {
2512         /// The elements in the array.
2513         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2514         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2515         /// The number of elements pointed to by `data`.
2516         pub datalen: usize
2517 }
2518 impl CVec_CVec_RouteHopZZ {
2519         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2520                 if self.datalen == 0 { return Vec::new(); }
2521                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2522                 self.data = std::ptr::null_mut();
2523                 self.datalen = 0;
2524                 ret
2525         }
2526         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2527                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2528         }
2529 }
2530 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2531         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2532                 let datalen = v.len();
2533                 let data = Box::into_raw(v.into_boxed_slice());
2534                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2535         }
2536 }
2537 #[no_mangle]
2538 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2539 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2540 impl Drop for CVec_CVec_RouteHopZZ {
2541         fn drop(&mut self) {
2542                 if self.datalen == 0 { return; }
2543                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2544         }
2545 }
2546 impl Clone for CVec_CVec_RouteHopZZ {
2547         fn clone(&self) -> Self {
2548                 let mut res = Vec::new();
2549                 if self.datalen == 0 { return Self::from(res); }
2550                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2551                 Self::from(res)
2552         }
2553 }
2554 #[repr(C)]
2555 /// The contents of CResult_RouteDecodeErrorZ
2556 pub union CResult_RouteDecodeErrorZPtr {
2557         /// A pointer to the contents in the success state.
2558         /// Reading from this pointer when `result_ok` is not set is undefined.
2559         pub result: *mut crate::lightning::routing::router::Route,
2560         /// A pointer to the contents in the error state.
2561         /// Reading from this pointer when `result_ok` is set is undefined.
2562         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2563 }
2564 #[repr(C)]
2565 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2566 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2568 pub struct CResult_RouteDecodeErrorZ {
2569         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2570         /// `err` or `result` depending on the state of `result_ok`.
2571         pub contents: CResult_RouteDecodeErrorZPtr,
2572         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2573         pub result_ok: bool,
2574 }
2575 #[no_mangle]
2576 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2577 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2578         CResult_RouteDecodeErrorZ {
2579                 contents: CResult_RouteDecodeErrorZPtr {
2580                         result: Box::into_raw(Box::new(o)),
2581                 },
2582                 result_ok: true,
2583         }
2584 }
2585 #[no_mangle]
2586 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2587 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2588         CResult_RouteDecodeErrorZ {
2589                 contents: CResult_RouteDecodeErrorZPtr {
2590                         err: Box::into_raw(Box::new(e)),
2591                 },
2592                 result_ok: false,
2593         }
2594 }
2595 #[no_mangle]
2596 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2597 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2598 impl Drop for CResult_RouteDecodeErrorZ {
2599         fn drop(&mut self) {
2600                 if self.result_ok {
2601                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2602                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2603                         }
2604                 } else {
2605                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2606                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2607                         }
2608                 }
2609         }
2610 }
2611 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2612         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2613                 let contents = if o.result_ok {
2614                         let result = unsafe { o.contents.result };
2615                         unsafe { o.contents.result = std::ptr::null_mut() };
2616                         CResult_RouteDecodeErrorZPtr { result }
2617                 } else {
2618                         let err = unsafe { o.contents.err };
2619                         unsafe { o.contents.err = std::ptr::null_mut(); }
2620                         CResult_RouteDecodeErrorZPtr { err }
2621                 };
2622                 Self {
2623                         contents,
2624                         result_ok: o.result_ok,
2625                 }
2626         }
2627 }
2628 impl Clone for CResult_RouteDecodeErrorZ {
2629         fn clone(&self) -> Self {
2630                 if self.result_ok {
2631                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2632                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2633                         } }
2634                 } else {
2635                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2636                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2637                         } }
2638                 }
2639         }
2640 }
2641 #[no_mangle]
2642 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2643 /// but with all dynamically-allocated buffers duplicated in new buffers.
2644 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
2645 #[repr(C)]
2646 #[derive(Clone)]
2647 /// An enum which can either contain a u64 or not
2648 pub enum COption_u64Z {
2649         /// When we're in this state, this COption_u64Z contains a u64
2650         Some(u64),
2651         /// When we're in this state, this COption_u64Z contains nothing
2652         None
2653 }
2654 impl COption_u64Z {
2655         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2656                 if let Self::Some(_) = self { true } else { false }
2657         }
2658         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2659                 if let Self::Some(v) = self { v } else { unreachable!() }
2660         }
2661 }
2662 #[no_mangle]
2663 /// Constructs a new COption_u64Z containing a u64
2664 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2665         COption_u64Z::Some(o)
2666 }
2667 #[no_mangle]
2668 /// Constructs a new COption_u64Z containing nothing
2669 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2670         COption_u64Z::None
2671 }
2672 #[no_mangle]
2673 /// Frees any resources associated with the u64, if we are in the Some state
2674 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2675 #[no_mangle]
2676 /// Creates a new COption_u64Z which has the same data as `orig`
2677 /// but with all dynamically-allocated buffers duplicated in new buffers.
2678 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
2679 #[repr(C)]
2680 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2681 /// This corresponds to std::vector in C++
2682 pub struct CVec_ChannelDetailsZ {
2683         /// The elements in the array.
2684         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2685         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2686         /// The number of elements pointed to by `data`.
2687         pub datalen: usize
2688 }
2689 impl CVec_ChannelDetailsZ {
2690         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2691                 if self.datalen == 0 { return Vec::new(); }
2692                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2693                 self.data = std::ptr::null_mut();
2694                 self.datalen = 0;
2695                 ret
2696         }
2697         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2698                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2699         }
2700 }
2701 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2702         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2703                 let datalen = v.len();
2704                 let data = Box::into_raw(v.into_boxed_slice());
2705                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2706         }
2707 }
2708 #[no_mangle]
2709 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2710 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2711 impl Drop for CVec_ChannelDetailsZ {
2712         fn drop(&mut self) {
2713                 if self.datalen == 0 { return; }
2714                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2715         }
2716 }
2717 impl Clone for CVec_ChannelDetailsZ {
2718         fn clone(&self) -> Self {
2719                 let mut res = Vec::new();
2720                 if self.datalen == 0 { return Self::from(res); }
2721                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2722                 Self::from(res)
2723         }
2724 }
2725 #[repr(C)]
2726 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2727 /// This corresponds to std::vector in C++
2728 pub struct CVec_RouteHintHopZ {
2729         /// The elements in the array.
2730         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2731         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2732         /// The number of elements pointed to by `data`.
2733         pub datalen: usize
2734 }
2735 impl CVec_RouteHintHopZ {
2736         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2737                 if self.datalen == 0 { return Vec::new(); }
2738                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2739                 self.data = std::ptr::null_mut();
2740                 self.datalen = 0;
2741                 ret
2742         }
2743         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2744                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2745         }
2746 }
2747 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2748         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2749                 let datalen = v.len();
2750                 let data = Box::into_raw(v.into_boxed_slice());
2751                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2752         }
2753 }
2754 #[no_mangle]
2755 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2756 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2757 impl Drop for CVec_RouteHintHopZ {
2758         fn drop(&mut self) {
2759                 if self.datalen == 0 { return; }
2760                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2761         }
2762 }
2763 impl Clone for CVec_RouteHintHopZ {
2764         fn clone(&self) -> Self {
2765                 let mut res = Vec::new();
2766                 if self.datalen == 0 { return Self::from(res); }
2767                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2768                 Self::from(res)
2769         }
2770 }
2771 #[repr(C)]
2772 /// The contents of CResult_RouteLightningErrorZ
2773 pub union CResult_RouteLightningErrorZPtr {
2774         /// A pointer to the contents in the success state.
2775         /// Reading from this pointer when `result_ok` is not set is undefined.
2776         pub result: *mut crate::lightning::routing::router::Route,
2777         /// A pointer to the contents in the error state.
2778         /// Reading from this pointer when `result_ok` is set is undefined.
2779         pub err: *mut crate::lightning::ln::msgs::LightningError,
2780 }
2781 #[repr(C)]
2782 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2783 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2785 pub struct CResult_RouteLightningErrorZ {
2786         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2787         /// `err` or `result` depending on the state of `result_ok`.
2788         pub contents: CResult_RouteLightningErrorZPtr,
2789         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2790         pub result_ok: bool,
2791 }
2792 #[no_mangle]
2793 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2794 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2795         CResult_RouteLightningErrorZ {
2796                 contents: CResult_RouteLightningErrorZPtr {
2797                         result: Box::into_raw(Box::new(o)),
2798                 },
2799                 result_ok: true,
2800         }
2801 }
2802 #[no_mangle]
2803 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2804 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2805         CResult_RouteLightningErrorZ {
2806                 contents: CResult_RouteLightningErrorZPtr {
2807                         err: Box::into_raw(Box::new(e)),
2808                 },
2809                 result_ok: false,
2810         }
2811 }
2812 #[no_mangle]
2813 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2814 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2815 impl Drop for CResult_RouteLightningErrorZ {
2816         fn drop(&mut self) {
2817                 if self.result_ok {
2818                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2819                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2820                         }
2821                 } else {
2822                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2823                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2824                         }
2825                 }
2826         }
2827 }
2828 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2829         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2830                 let contents = if o.result_ok {
2831                         let result = unsafe { o.contents.result };
2832                         unsafe { o.contents.result = std::ptr::null_mut() };
2833                         CResult_RouteLightningErrorZPtr { result }
2834                 } else {
2835                         let err = unsafe { o.contents.err };
2836                         unsafe { o.contents.err = std::ptr::null_mut(); }
2837                         CResult_RouteLightningErrorZPtr { err }
2838                 };
2839                 Self {
2840                         contents,
2841                         result_ok: o.result_ok,
2842                 }
2843         }
2844 }
2845 impl Clone for CResult_RouteLightningErrorZ {
2846         fn clone(&self) -> Self {
2847                 if self.result_ok {
2848                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2849                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2850                         } }
2851                 } else {
2852                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2853                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2854                         } }
2855                 }
2856         }
2857 }
2858 #[no_mangle]
2859 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2860 /// but with all dynamically-allocated buffers duplicated in new buffers.
2861 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
2862 #[repr(C)]
2863 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2864 /// This corresponds to std::vector in C++
2865 pub struct CVec_MessageSendEventZ {
2866         /// The elements in the array.
2867         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2868         pub data: *mut crate::lightning::util::events::MessageSendEvent,
2869         /// The number of elements pointed to by `data`.
2870         pub datalen: usize
2871 }
2872 impl CVec_MessageSendEventZ {
2873         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2874                 if self.datalen == 0 { return Vec::new(); }
2875                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2876                 self.data = std::ptr::null_mut();
2877                 self.datalen = 0;
2878                 ret
2879         }
2880         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2881                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2882         }
2883 }
2884 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2885         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2886                 let datalen = v.len();
2887                 let data = Box::into_raw(v.into_boxed_slice());
2888                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2889         }
2890 }
2891 #[no_mangle]
2892 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2893 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2894 impl Drop for CVec_MessageSendEventZ {
2895         fn drop(&mut self) {
2896                 if self.datalen == 0 { return; }
2897                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2898         }
2899 }
2900 impl Clone for CVec_MessageSendEventZ {
2901         fn clone(&self) -> Self {
2902                 let mut res = Vec::new();
2903                 if self.datalen == 0 { return Self::from(res); }
2904                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2905                 Self::from(res)
2906         }
2907 }
2908 #[repr(C)]
2909 /// The contents of CResult_boolLightningErrorZ
2910 pub union CResult_boolLightningErrorZPtr {
2911         /// A pointer to the contents in the success state.
2912         /// Reading from this pointer when `result_ok` is not set is undefined.
2913         pub result: *mut bool,
2914         /// A pointer to the contents in the error state.
2915         /// Reading from this pointer when `result_ok` is set is undefined.
2916         pub err: *mut crate::lightning::ln::msgs::LightningError,
2917 }
2918 #[repr(C)]
2919 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
2920 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
2921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2922 pub struct CResult_boolLightningErrorZ {
2923         /// The contents of this CResult_boolLightningErrorZ, accessible via either
2924         /// `err` or `result` depending on the state of `result_ok`.
2925         pub contents: CResult_boolLightningErrorZPtr,
2926         /// Whether this CResult_boolLightningErrorZ represents a success state.
2927         pub result_ok: bool,
2928 }
2929 #[no_mangle]
2930 /// Creates a new CResult_boolLightningErrorZ in the success state.
2931 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
2932         CResult_boolLightningErrorZ {
2933                 contents: CResult_boolLightningErrorZPtr {
2934                         result: Box::into_raw(Box::new(o)),
2935                 },
2936                 result_ok: true,
2937         }
2938 }
2939 #[no_mangle]
2940 /// Creates a new CResult_boolLightningErrorZ in the error state.
2941 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
2942         CResult_boolLightningErrorZ {
2943                 contents: CResult_boolLightningErrorZPtr {
2944                         err: Box::into_raw(Box::new(e)),
2945                 },
2946                 result_ok: false,
2947         }
2948 }
2949 #[no_mangle]
2950 /// Frees any resources used by the CResult_boolLightningErrorZ.
2951 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
2952 impl Drop for CResult_boolLightningErrorZ {
2953         fn drop(&mut self) {
2954                 if self.result_ok {
2955                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2956                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2957                         }
2958                 } else {
2959                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2960                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2961                         }
2962                 }
2963         }
2964 }
2965 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
2966         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
2967                 let contents = if o.result_ok {
2968                         let result = unsafe { o.contents.result };
2969                         unsafe { o.contents.result = std::ptr::null_mut() };
2970                         CResult_boolLightningErrorZPtr { result }
2971                 } else {
2972                         let err = unsafe { o.contents.err };
2973                         unsafe { o.contents.err = std::ptr::null_mut(); }
2974                         CResult_boolLightningErrorZPtr { err }
2975                 };
2976                 Self {
2977                         contents,
2978                         result_ok: o.result_ok,
2979                 }
2980         }
2981 }
2982 impl Clone for CResult_boolLightningErrorZ {
2983         fn clone(&self) -> Self {
2984                 if self.result_ok {
2985                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
2986                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
2987                         } }
2988                 } else {
2989                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
2990                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2991                         } }
2992                 }
2993         }
2994 }
2995 #[no_mangle]
2996 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
2997 /// but with all dynamically-allocated buffers duplicated in new buffers.
2998 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
2999 #[repr(C)]
3000 /// A tuple of 3 elements. See the individual fields for the types contained.
3001 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3002         /// The element at position 0
3003         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
3004         /// The element at position 1
3005         pub b: crate::lightning::ln::msgs::ChannelUpdate,
3006         /// The element at position 2
3007         pub c: crate::lightning::ln::msgs::ChannelUpdate,
3008 }
3009 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3010         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
3011                 Self {
3012                         a: tup.0,
3013                         b: tup.1,
3014                         c: tup.2,
3015                 }
3016         }
3017 }
3018 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3019         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
3020                 (self.a, self.b, self.c)
3021         }
3022 }
3023 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3024         fn clone(&self) -> Self {
3025                 Self {
3026                         a: self.a.clone(),
3027                         b: self.b.clone(),
3028                         c: self.c.clone(),
3029                 }
3030         }
3031 }
3032 #[no_mangle]
3033 /// Creates a new tuple which has the same data as `orig`
3034 /// but with all dynamically-allocated buffers duplicated in new buffers.
3035 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
3036 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
3037 #[no_mangle]
3038 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 {
3039         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
3040 }
3041
3042 #[no_mangle]
3043 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
3044 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
3045 #[repr(C)]
3046 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
3047 /// This corresponds to std::vector in C++
3048 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3049         /// The elements in the array.
3050         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3051         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
3052         /// The number of elements pointed to by `data`.
3053         pub datalen: usize
3054 }
3055 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3056         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
3057                 if self.datalen == 0 { return Vec::new(); }
3058                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3059                 self.data = std::ptr::null_mut();
3060                 self.datalen = 0;
3061                 ret
3062         }
3063         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
3064                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3065         }
3066 }
3067 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3068         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
3069                 let datalen = v.len();
3070                 let data = Box::into_raw(v.into_boxed_slice());
3071                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3072         }
3073 }
3074 #[no_mangle]
3075 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3076 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
3077 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3078         fn drop(&mut self) {
3079                 if self.datalen == 0 { return; }
3080                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3081         }
3082 }
3083 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3084         fn clone(&self) -> Self {
3085                 let mut res = Vec::new();
3086                 if self.datalen == 0 { return Self::from(res); }
3087                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3088                 Self::from(res)
3089         }
3090 }
3091 #[repr(C)]
3092 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3093 /// This corresponds to std::vector in C++
3094 pub struct CVec_NodeAnnouncementZ {
3095         /// The elements in the array.
3096         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3097         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
3098         /// The number of elements pointed to by `data`.
3099         pub datalen: usize
3100 }
3101 impl CVec_NodeAnnouncementZ {
3102         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
3103                 if self.datalen == 0 { return Vec::new(); }
3104                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3105                 self.data = std::ptr::null_mut();
3106                 self.datalen = 0;
3107                 ret
3108         }
3109         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
3110                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3111         }
3112 }
3113 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
3114         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
3115                 let datalen = v.len();
3116                 let data = Box::into_raw(v.into_boxed_slice());
3117                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3118         }
3119 }
3120 #[no_mangle]
3121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3122 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
3123 impl Drop for CVec_NodeAnnouncementZ {
3124         fn drop(&mut self) {
3125                 if self.datalen == 0 { return; }
3126                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3127         }
3128 }
3129 impl Clone for CVec_NodeAnnouncementZ {
3130         fn clone(&self) -> Self {
3131                 let mut res = Vec::new();
3132                 if self.datalen == 0 { return Self::from(res); }
3133                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3134                 Self::from(res)
3135         }
3136 }
3137 #[repr(C)]
3138 /// The contents of CResult_NoneLightningErrorZ
3139 pub union CResult_NoneLightningErrorZPtr {
3140         /// Note that this value is always NULL, as there are no contents in the OK variant
3141         pub result: *mut std::ffi::c_void,
3142         /// A pointer to the contents in the error state.
3143         /// Reading from this pointer when `result_ok` is set is undefined.
3144         pub err: *mut crate::lightning::ln::msgs::LightningError,
3145 }
3146 #[repr(C)]
3147 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
3148 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
3149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3150 pub struct CResult_NoneLightningErrorZ {
3151         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
3152         /// `err` or `result` depending on the state of `result_ok`.
3153         pub contents: CResult_NoneLightningErrorZPtr,
3154         /// Whether this CResult_NoneLightningErrorZ represents a success state.
3155         pub result_ok: bool,
3156 }
3157 #[no_mangle]
3158 /// Creates a new CResult_NoneLightningErrorZ in the success state.
3159 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
3160         CResult_NoneLightningErrorZ {
3161                 contents: CResult_NoneLightningErrorZPtr {
3162                         result: std::ptr::null_mut(),
3163                 },
3164                 result_ok: true,
3165         }
3166 }
3167 #[no_mangle]
3168 /// Creates a new CResult_NoneLightningErrorZ in the error state.
3169 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
3170         CResult_NoneLightningErrorZ {
3171                 contents: CResult_NoneLightningErrorZPtr {
3172                         err: Box::into_raw(Box::new(e)),
3173                 },
3174                 result_ok: false,
3175         }
3176 }
3177 #[no_mangle]
3178 /// Frees any resources used by the CResult_NoneLightningErrorZ.
3179 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
3180 impl Drop for CResult_NoneLightningErrorZ {
3181         fn drop(&mut self) {
3182                 if self.result_ok {
3183                 } else {
3184                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3185                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3186                         }
3187                 }
3188         }
3189 }
3190 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
3191         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>) -> Self {
3192                 let contents = if o.result_ok {
3193                         let _ = unsafe { Box::from_raw(o.contents.result) };
3194                         o.contents.result = std::ptr::null_mut();
3195                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
3196                 } else {
3197                         let err = unsafe { o.contents.err };
3198                         unsafe { o.contents.err = std::ptr::null_mut(); }
3199                         CResult_NoneLightningErrorZPtr { err }
3200                 };
3201                 Self {
3202                         contents,
3203                         result_ok: o.result_ok,
3204                 }
3205         }
3206 }
3207 impl Clone for CResult_NoneLightningErrorZ {
3208         fn clone(&self) -> Self {
3209                 if self.result_ok {
3210                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
3211                                 result: std::ptr::null_mut()
3212                         } }
3213                 } else {
3214                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
3215                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3216                         } }
3217                 }
3218         }
3219 }
3220 #[no_mangle]
3221 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
3222 /// but with all dynamically-allocated buffers duplicated in new buffers.
3223 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
3224 #[repr(C)]
3225 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3226 /// This corresponds to std::vector in C++
3227 pub struct CVec_PublicKeyZ {
3228         /// The elements in the array.
3229         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3230         pub data: *mut crate::c_types::PublicKey,
3231         /// The number of elements pointed to by `data`.
3232         pub datalen: usize
3233 }
3234 impl CVec_PublicKeyZ {
3235         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3236                 if self.datalen == 0 { return Vec::new(); }
3237                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3238                 self.data = std::ptr::null_mut();
3239                 self.datalen = 0;
3240                 ret
3241         }
3242         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3243                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3244         }
3245 }
3246 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3247         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3248                 let datalen = v.len();
3249                 let data = Box::into_raw(v.into_boxed_slice());
3250                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3251         }
3252 }
3253 #[no_mangle]
3254 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3255 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3256 impl Drop for CVec_PublicKeyZ {
3257         fn drop(&mut self) {
3258                 if self.datalen == 0 { return; }
3259                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3260         }
3261 }
3262 #[repr(C)]
3263 /// A dynamically-allocated array of u8s of arbitrary size.
3264 /// This corresponds to std::vector in C++
3265 pub struct CVec_u8Z {
3266         /// The elements in the array.
3267         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3268         pub data: *mut u8,
3269         /// The number of elements pointed to by `data`.
3270         pub datalen: usize
3271 }
3272 impl CVec_u8Z {
3273         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3274                 if self.datalen == 0 { return Vec::new(); }
3275                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3276                 self.data = std::ptr::null_mut();
3277                 self.datalen = 0;
3278                 ret
3279         }
3280         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3281                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3282         }
3283 }
3284 impl From<Vec<u8>> for CVec_u8Z {
3285         fn from(v: Vec<u8>) -> Self {
3286                 let datalen = v.len();
3287                 let data = Box::into_raw(v.into_boxed_slice());
3288                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3289         }
3290 }
3291 #[no_mangle]
3292 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3293 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3294 impl Drop for CVec_u8Z {
3295         fn drop(&mut self) {
3296                 if self.datalen == 0 { return; }
3297                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3298         }
3299 }
3300 impl Clone for CVec_u8Z {
3301         fn clone(&self) -> Self {
3302                 let mut res = Vec::new();
3303                 if self.datalen == 0 { return Self::from(res); }
3304                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3305                 Self::from(res)
3306         }
3307 }
3308 #[repr(C)]
3309 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
3310 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
3311         /// A pointer to the contents in the success state.
3312         /// Reading from this pointer when `result_ok` is not set is undefined.
3313         pub result: *mut crate::c_types::derived::CVec_u8Z,
3314         /// A pointer to the contents in the error state.
3315         /// Reading from this pointer when `result_ok` is set is undefined.
3316         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3317 }
3318 #[repr(C)]
3319 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
3320 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3321 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3322 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
3323         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
3324         /// `err` or `result` depending on the state of `result_ok`.
3325         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
3326         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
3327         pub result_ok: bool,
3328 }
3329 #[no_mangle]
3330 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
3331 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
3332         CResult_CVec_u8ZPeerHandleErrorZ {
3333                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3334                         result: Box::into_raw(Box::new(o)),
3335                 },
3336                 result_ok: true,
3337         }
3338 }
3339 #[no_mangle]
3340 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
3341 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
3342         CResult_CVec_u8ZPeerHandleErrorZ {
3343                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3344                         err: Box::into_raw(Box::new(e)),
3345                 },
3346                 result_ok: false,
3347         }
3348 }
3349 #[no_mangle]
3350 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
3351 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
3352 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
3353         fn drop(&mut self) {
3354                 if self.result_ok {
3355                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3356                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3357                         }
3358                 } else {
3359                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3360                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3361                         }
3362                 }
3363         }
3364 }
3365 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
3366         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3367                 let contents = if o.result_ok {
3368                         let result = unsafe { o.contents.result };
3369                         unsafe { o.contents.result = std::ptr::null_mut() };
3370                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
3371                 } else {
3372                         let err = unsafe { o.contents.err };
3373                         unsafe { o.contents.err = std::ptr::null_mut(); }
3374                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
3375                 };
3376                 Self {
3377                         contents,
3378                         result_ok: o.result_ok,
3379                 }
3380         }
3381 }
3382 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
3383         fn clone(&self) -> Self {
3384                 if self.result_ok {
3385                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3386                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3387                         } }
3388                 } else {
3389                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3390                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3391                         } }
3392                 }
3393         }
3394 }
3395 #[no_mangle]
3396 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
3397 /// but with all dynamically-allocated buffers duplicated in new buffers.
3398 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
3399 #[repr(C)]
3400 /// The contents of CResult_NonePeerHandleErrorZ
3401 pub union CResult_NonePeerHandleErrorZPtr {
3402         /// Note that this value is always NULL, as there are no contents in the OK variant
3403         pub result: *mut std::ffi::c_void,
3404         /// A pointer to the contents in the error state.
3405         /// Reading from this pointer when `result_ok` is set is undefined.
3406         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3407 }
3408 #[repr(C)]
3409 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
3410 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3411 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3412 pub struct CResult_NonePeerHandleErrorZ {
3413         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
3414         /// `err` or `result` depending on the state of `result_ok`.
3415         pub contents: CResult_NonePeerHandleErrorZPtr,
3416         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
3417         pub result_ok: bool,
3418 }
3419 #[no_mangle]
3420 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
3421 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
3422         CResult_NonePeerHandleErrorZ {
3423                 contents: CResult_NonePeerHandleErrorZPtr {
3424                         result: std::ptr::null_mut(),
3425                 },
3426                 result_ok: true,
3427         }
3428 }
3429 #[no_mangle]
3430 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
3431 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
3432         CResult_NonePeerHandleErrorZ {
3433                 contents: CResult_NonePeerHandleErrorZPtr {
3434                         err: Box::into_raw(Box::new(e)),
3435                 },
3436                 result_ok: false,
3437         }
3438 }
3439 #[no_mangle]
3440 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
3441 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
3442 impl Drop for CResult_NonePeerHandleErrorZ {
3443         fn drop(&mut self) {
3444                 if self.result_ok {
3445                 } else {
3446                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3447                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3448                         }
3449                 }
3450         }
3451 }
3452 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
3453         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3454                 let contents = if o.result_ok {
3455                         let _ = unsafe { Box::from_raw(o.contents.result) };
3456                         o.contents.result = std::ptr::null_mut();
3457                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
3458                 } else {
3459                         let err = unsafe { o.contents.err };
3460                         unsafe { o.contents.err = std::ptr::null_mut(); }
3461                         CResult_NonePeerHandleErrorZPtr { err }
3462                 };
3463                 Self {
3464                         contents,
3465                         result_ok: o.result_ok,
3466                 }
3467         }
3468 }
3469 impl Clone for CResult_NonePeerHandleErrorZ {
3470         fn clone(&self) -> Self {
3471                 if self.result_ok {
3472                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
3473                                 result: std::ptr::null_mut()
3474                         } }
3475                 } else {
3476                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
3477                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3478                         } }
3479                 }
3480         }
3481 }
3482 #[no_mangle]
3483 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
3484 /// but with all dynamically-allocated buffers duplicated in new buffers.
3485 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
3486 #[repr(C)]
3487 /// The contents of CResult_boolPeerHandleErrorZ
3488 pub union CResult_boolPeerHandleErrorZPtr {
3489         /// A pointer to the contents in the success state.
3490         /// Reading from this pointer when `result_ok` is not set is undefined.
3491         pub result: *mut bool,
3492         /// A pointer to the contents in the error state.
3493         /// Reading from this pointer when `result_ok` is set is undefined.
3494         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3495 }
3496 #[repr(C)]
3497 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
3498 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3500 pub struct CResult_boolPeerHandleErrorZ {
3501         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
3502         /// `err` or `result` depending on the state of `result_ok`.
3503         pub contents: CResult_boolPeerHandleErrorZPtr,
3504         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
3505         pub result_ok: bool,
3506 }
3507 #[no_mangle]
3508 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
3509 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
3510         CResult_boolPeerHandleErrorZ {
3511                 contents: CResult_boolPeerHandleErrorZPtr {
3512                         result: Box::into_raw(Box::new(o)),
3513                 },
3514                 result_ok: true,
3515         }
3516 }
3517 #[no_mangle]
3518 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
3519 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
3520         CResult_boolPeerHandleErrorZ {
3521                 contents: CResult_boolPeerHandleErrorZPtr {
3522                         err: Box::into_raw(Box::new(e)),
3523                 },
3524                 result_ok: false,
3525         }
3526 }
3527 #[no_mangle]
3528 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
3529 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
3530 impl Drop for CResult_boolPeerHandleErrorZ {
3531         fn drop(&mut self) {
3532                 if self.result_ok {
3533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3535                         }
3536                 } else {
3537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3539                         }
3540                 }
3541         }
3542 }
3543 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
3544         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3545                 let contents = if o.result_ok {
3546                         let result = unsafe { o.contents.result };
3547                         unsafe { o.contents.result = std::ptr::null_mut() };
3548                         CResult_boolPeerHandleErrorZPtr { result }
3549                 } else {
3550                         let err = unsafe { o.contents.err };
3551                         unsafe { o.contents.err = std::ptr::null_mut(); }
3552                         CResult_boolPeerHandleErrorZPtr { err }
3553                 };
3554                 Self {
3555                         contents,
3556                         result_ok: o.result_ok,
3557                 }
3558         }
3559 }
3560 impl Clone for CResult_boolPeerHandleErrorZ {
3561         fn clone(&self) -> Self {
3562                 if self.result_ok {
3563                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
3564                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
3565                         } }
3566                 } else {
3567                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
3568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3569                         } }
3570                 }
3571         }
3572 }
3573 #[no_mangle]
3574 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
3575 /// but with all dynamically-allocated buffers duplicated in new buffers.
3576 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
3577 #[repr(C)]
3578 /// The contents of CResult_TxOutAccessErrorZ
3579 pub union CResult_TxOutAccessErrorZPtr {
3580         /// A pointer to the contents in the success state.
3581         /// Reading from this pointer when `result_ok` is not set is undefined.
3582         pub result: *mut crate::c_types::TxOut,
3583         /// A pointer to the contents in the error state.
3584         /// Reading from this pointer when `result_ok` is set is undefined.
3585         pub err: *mut crate::lightning::chain::AccessError,
3586 }
3587 #[repr(C)]
3588 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3589 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3591 pub struct CResult_TxOutAccessErrorZ {
3592         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3593         /// `err` or `result` depending on the state of `result_ok`.
3594         pub contents: CResult_TxOutAccessErrorZPtr,
3595         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3596         pub result_ok: bool,
3597 }
3598 #[no_mangle]
3599 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3600 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3601         CResult_TxOutAccessErrorZ {
3602                 contents: CResult_TxOutAccessErrorZPtr {
3603                         result: Box::into_raw(Box::new(o)),
3604                 },
3605                 result_ok: true,
3606         }
3607 }
3608 #[no_mangle]
3609 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3610 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3611         CResult_TxOutAccessErrorZ {
3612                 contents: CResult_TxOutAccessErrorZPtr {
3613                         err: Box::into_raw(Box::new(e)),
3614                 },
3615                 result_ok: false,
3616         }
3617 }
3618 #[no_mangle]
3619 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3620 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3621 impl Drop for CResult_TxOutAccessErrorZ {
3622         fn drop(&mut self) {
3623                 if self.result_ok {
3624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3626                         }
3627                 } else {
3628                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3629                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3630                         }
3631                 }
3632         }
3633 }
3634 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3635         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3636                 let contents = if o.result_ok {
3637                         let result = unsafe { o.contents.result };
3638                         unsafe { o.contents.result = std::ptr::null_mut() };
3639                         CResult_TxOutAccessErrorZPtr { result }
3640                 } else {
3641                         let err = unsafe { o.contents.err };
3642                         unsafe { o.contents.err = std::ptr::null_mut(); }
3643                         CResult_TxOutAccessErrorZPtr { err }
3644                 };
3645                 Self {
3646                         contents,
3647                         result_ok: o.result_ok,
3648                 }
3649         }
3650 }
3651 impl Clone for CResult_TxOutAccessErrorZ {
3652         fn clone(&self) -> Self {
3653                 if self.result_ok {
3654                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3655                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3656                         } }
3657                 } else {
3658                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3659                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3660                         } }
3661                 }
3662         }
3663 }
3664 #[no_mangle]
3665 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3666 /// but with all dynamically-allocated buffers duplicated in new buffers.
3667 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
3668 #[repr(C)]
3669 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3670 pub enum COption_C2Tuple_usizeTransactionZZ {
3671         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3672         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3673         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3674         None
3675 }
3676 impl COption_C2Tuple_usizeTransactionZZ {
3677         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3678                 if let Self::Some(_) = self { true } else { false }
3679         }
3680         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3681                 if let Self::Some(v) = self { v } else { unreachable!() }
3682         }
3683 }
3684 #[no_mangle]
3685 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3686 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3687         COption_C2Tuple_usizeTransactionZZ::Some(o)
3688 }
3689 #[no_mangle]
3690 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3691 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3692         COption_C2Tuple_usizeTransactionZZ::None
3693 }
3694 #[no_mangle]
3695 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3696 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3697 #[repr(C)]
3698 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3699 /// This corresponds to std::vector in C++
3700 pub struct CVec_SpendableOutputDescriptorZ {
3701         /// The elements in the array.
3702         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3703         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3704         /// The number of elements pointed to by `data`.
3705         pub datalen: usize
3706 }
3707 impl CVec_SpendableOutputDescriptorZ {
3708         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3709                 if self.datalen == 0 { return Vec::new(); }
3710                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3711                 self.data = std::ptr::null_mut();
3712                 self.datalen = 0;
3713                 ret
3714         }
3715         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3716                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3717         }
3718 }
3719 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3720         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3721                 let datalen = v.len();
3722                 let data = Box::into_raw(v.into_boxed_slice());
3723                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3724         }
3725 }
3726 #[no_mangle]
3727 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3728 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3729 impl Drop for CVec_SpendableOutputDescriptorZ {
3730         fn drop(&mut self) {
3731                 if self.datalen == 0 { return; }
3732                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3733         }
3734 }
3735 impl Clone for CVec_SpendableOutputDescriptorZ {
3736         fn clone(&self) -> Self {
3737                 let mut res = Vec::new();
3738                 if self.datalen == 0 { return Self::from(res); }
3739                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3740                 Self::from(res)
3741         }
3742 }
3743 #[repr(C)]
3744 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
3745 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
3746         /// A pointer to the contents in the success state.
3747         /// Reading from this pointer when `result_ok` is not set is undefined.
3748         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
3749         /// A pointer to the contents in the error state.
3750         /// Reading from this pointer when `result_ok` is set is undefined.
3751         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3752 }
3753 #[repr(C)]
3754 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
3755 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3756 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3757 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
3758         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
3759         /// `err` or `result` depending on the state of `result_ok`.
3760         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
3761         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
3762         pub result_ok: bool,
3763 }
3764 #[no_mangle]
3765 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
3766 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
3767         CResult_DirectionalChannelInfoDecodeErrorZ {
3768                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3769                         result: Box::into_raw(Box::new(o)),
3770                 },
3771                 result_ok: true,
3772         }
3773 }
3774 #[no_mangle]
3775 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
3776 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
3777         CResult_DirectionalChannelInfoDecodeErrorZ {
3778                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3779                         err: Box::into_raw(Box::new(e)),
3780                 },
3781                 result_ok: false,
3782         }
3783 }
3784 #[no_mangle]
3785 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
3786 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
3787 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
3788         fn drop(&mut self) {
3789                 if self.result_ok {
3790                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3791                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3792                         }
3793                 } else {
3794                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3795                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3796                         }
3797                 }
3798         }
3799 }
3800 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
3801         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
3802                 let contents = if o.result_ok {
3803                         let result = unsafe { o.contents.result };
3804                         unsafe { o.contents.result = std::ptr::null_mut() };
3805                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
3806                 } else {
3807                         let err = unsafe { o.contents.err };
3808                         unsafe { o.contents.err = std::ptr::null_mut(); }
3809                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
3810                 };
3811                 Self {
3812                         contents,
3813                         result_ok: o.result_ok,
3814                 }
3815         }
3816 }
3817 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
3818         fn clone(&self) -> Self {
3819                 if self.result_ok {
3820                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3821                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
3822                         } }
3823                 } else {
3824                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3825                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3826                         } }
3827                 }
3828         }
3829 }
3830 #[no_mangle]
3831 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
3832 /// but with all dynamically-allocated buffers duplicated in new buffers.
3833 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
3834 #[repr(C)]
3835 /// The contents of CResult_ChannelInfoDecodeErrorZ
3836 pub union CResult_ChannelInfoDecodeErrorZPtr {
3837         /// A pointer to the contents in the success state.
3838         /// Reading from this pointer when `result_ok` is not set is undefined.
3839         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
3840         /// A pointer to the contents in the error state.
3841         /// Reading from this pointer when `result_ok` is set is undefined.
3842         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3843 }
3844 #[repr(C)]
3845 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
3846 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3847 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3848 pub struct CResult_ChannelInfoDecodeErrorZ {
3849         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
3850         /// `err` or `result` depending on the state of `result_ok`.
3851         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
3852         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
3853         pub result_ok: bool,
3854 }
3855 #[no_mangle]
3856 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
3857 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
3858         CResult_ChannelInfoDecodeErrorZ {
3859                 contents: CResult_ChannelInfoDecodeErrorZPtr {
3860                         result: Box::into_raw(Box::new(o)),
3861                 },
3862                 result_ok: true,
3863         }
3864 }
3865 #[no_mangle]
3866 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
3867 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
3868         CResult_ChannelInfoDecodeErrorZ {
3869                 contents: CResult_ChannelInfoDecodeErrorZPtr {
3870                         err: Box::into_raw(Box::new(e)),
3871                 },
3872                 result_ok: false,
3873         }
3874 }
3875 #[no_mangle]
3876 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
3877 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
3878 impl Drop for CResult_ChannelInfoDecodeErrorZ {
3879         fn drop(&mut self) {
3880                 if self.result_ok {
3881                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3882                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3883                         }
3884                 } else {
3885                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3886                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3887                         }
3888                 }
3889         }
3890 }
3891 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
3892         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
3893                 let contents = if o.result_ok {
3894                         let result = unsafe { o.contents.result };
3895                         unsafe { o.contents.result = std::ptr::null_mut() };
3896                         CResult_ChannelInfoDecodeErrorZPtr { result }
3897                 } else {
3898                         let err = unsafe { o.contents.err };
3899                         unsafe { o.contents.err = std::ptr::null_mut(); }
3900                         CResult_ChannelInfoDecodeErrorZPtr { err }
3901                 };
3902                 Self {
3903                         contents,
3904                         result_ok: o.result_ok,
3905                 }
3906         }
3907 }
3908 impl Clone for CResult_ChannelInfoDecodeErrorZ {
3909         fn clone(&self) -> Self {
3910                 if self.result_ok {
3911                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
3912                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
3913                         } }
3914                 } else {
3915                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
3916                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3917                         } }
3918                 }
3919         }
3920 }
3921 #[no_mangle]
3922 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
3923 /// but with all dynamically-allocated buffers duplicated in new buffers.
3924 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
3925 #[repr(C)]
3926 /// The contents of CResult_RoutingFeesDecodeErrorZ
3927 pub union CResult_RoutingFeesDecodeErrorZPtr {
3928         /// A pointer to the contents in the success state.
3929         /// Reading from this pointer when `result_ok` is not set is undefined.
3930         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
3931         /// A pointer to the contents in the error state.
3932         /// Reading from this pointer when `result_ok` is set is undefined.
3933         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3934 }
3935 #[repr(C)]
3936 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
3937 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
3938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3939 pub struct CResult_RoutingFeesDecodeErrorZ {
3940         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
3941         /// `err` or `result` depending on the state of `result_ok`.
3942         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
3943         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
3944         pub result_ok: bool,
3945 }
3946 #[no_mangle]
3947 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
3948 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
3949         CResult_RoutingFeesDecodeErrorZ {
3950                 contents: CResult_RoutingFeesDecodeErrorZPtr {
3951                         result: Box::into_raw(Box::new(o)),
3952                 },
3953                 result_ok: true,
3954         }
3955 }
3956 #[no_mangle]
3957 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
3958 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
3959         CResult_RoutingFeesDecodeErrorZ {
3960                 contents: CResult_RoutingFeesDecodeErrorZPtr {
3961                         err: Box::into_raw(Box::new(e)),
3962                 },
3963                 result_ok: false,
3964         }
3965 }
3966 #[no_mangle]
3967 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
3968 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
3969 impl Drop for CResult_RoutingFeesDecodeErrorZ {
3970         fn drop(&mut self) {
3971                 if self.result_ok {
3972                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3973                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3974                         }
3975                 } else {
3976                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3977                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3978                         }
3979                 }
3980         }
3981 }
3982 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
3983         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
3984                 let contents = if o.result_ok {
3985                         let result = unsafe { o.contents.result };
3986                         unsafe { o.contents.result = std::ptr::null_mut() };
3987                         CResult_RoutingFeesDecodeErrorZPtr { result }
3988                 } else {
3989                         let err = unsafe { o.contents.err };
3990                         unsafe { o.contents.err = std::ptr::null_mut(); }
3991                         CResult_RoutingFeesDecodeErrorZPtr { err }
3992                 };
3993                 Self {
3994                         contents,
3995                         result_ok: o.result_ok,
3996                 }
3997         }
3998 }
3999 impl Clone for CResult_RoutingFeesDecodeErrorZ {
4000         fn clone(&self) -> Self {
4001                 if self.result_ok {
4002                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
4003                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
4004                         } }
4005                 } else {
4006                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
4007                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4008                         } }
4009                 }
4010         }
4011 }
4012 #[no_mangle]
4013 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
4014 /// but with all dynamically-allocated buffers duplicated in new buffers.
4015 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
4016 #[repr(C)]
4017 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4018 /// This corresponds to std::vector in C++
4019 pub struct CVec_NetAddressZ {
4020         /// The elements in the array.
4021         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4022         pub data: *mut crate::lightning::ln::msgs::NetAddress,
4023         /// The number of elements pointed to by `data`.
4024         pub datalen: usize
4025 }
4026 impl CVec_NetAddressZ {
4027         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4028                 if self.datalen == 0 { return Vec::new(); }
4029                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4030                 self.data = std::ptr::null_mut();
4031                 self.datalen = 0;
4032                 ret
4033         }
4034         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4035                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4036         }
4037 }
4038 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4039         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4040                 let datalen = v.len();
4041                 let data = Box::into_raw(v.into_boxed_slice());
4042                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4043         }
4044 }
4045 #[no_mangle]
4046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4047 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4048 impl Drop for CVec_NetAddressZ {
4049         fn drop(&mut self) {
4050                 if self.datalen == 0 { return; }
4051                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4052         }
4053 }
4054 impl Clone for CVec_NetAddressZ {
4055         fn clone(&self) -> Self {
4056                 let mut res = Vec::new();
4057                 if self.datalen == 0 { return Self::from(res); }
4058                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4059                 Self::from(res)
4060         }
4061 }
4062 #[repr(C)]
4063 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4064 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4065         /// A pointer to the contents in the success state.
4066         /// Reading from this pointer when `result_ok` is not set is undefined.
4067         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
4068         /// A pointer to the contents in the error state.
4069         /// Reading from this pointer when `result_ok` is set is undefined.
4070         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4071 }
4072 #[repr(C)]
4073 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4074 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4076 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
4077         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4078         /// `err` or `result` depending on the state of `result_ok`.
4079         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
4080         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4081         pub result_ok: bool,
4082 }
4083 #[no_mangle]
4084 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
4085 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4086         CResult_NodeAnnouncementInfoDecodeErrorZ {
4087                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4088                         result: Box::into_raw(Box::new(o)),
4089                 },
4090                 result_ok: true,
4091         }
4092 }
4093 #[no_mangle]
4094 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
4095 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4096         CResult_NodeAnnouncementInfoDecodeErrorZ {
4097                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4098                         err: Box::into_raw(Box::new(e)),
4099                 },
4100                 result_ok: false,
4101         }
4102 }
4103 #[no_mangle]
4104 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
4105 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
4106 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
4107         fn drop(&mut self) {
4108                 if self.result_ok {
4109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4111                         }
4112                 } else {
4113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4115                         }
4116                 }
4117         }
4118 }
4119 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
4120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4121                 let contents = if o.result_ok {
4122                         let result = unsafe { o.contents.result };
4123                         unsafe { o.contents.result = std::ptr::null_mut() };
4124                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
4125                 } else {
4126                         let err = unsafe { o.contents.err };
4127                         unsafe { o.contents.err = std::ptr::null_mut(); }
4128                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
4129                 };
4130                 Self {
4131                         contents,
4132                         result_ok: o.result_ok,
4133                 }
4134         }
4135 }
4136 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
4137         fn clone(&self) -> Self {
4138                 if self.result_ok {
4139                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4140                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
4141                         } }
4142                 } else {
4143                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4144                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4145                         } }
4146                 }
4147         }
4148 }
4149 #[no_mangle]
4150 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
4151 /// but with all dynamically-allocated buffers duplicated in new buffers.
4152 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
4153 #[repr(C)]
4154 /// A dynamically-allocated array of u64s of arbitrary size.
4155 /// This corresponds to std::vector in C++
4156 pub struct CVec_u64Z {
4157         /// The elements in the array.
4158         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4159         pub data: *mut u64,
4160         /// The number of elements pointed to by `data`.
4161         pub datalen: usize
4162 }
4163 impl CVec_u64Z {
4164         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4165                 if self.datalen == 0 { return Vec::new(); }
4166                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4167                 self.data = std::ptr::null_mut();
4168                 self.datalen = 0;
4169                 ret
4170         }
4171         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4172                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4173         }
4174 }
4175 impl From<Vec<u64>> for CVec_u64Z {
4176         fn from(v: Vec<u64>) -> Self {
4177                 let datalen = v.len();
4178                 let data = Box::into_raw(v.into_boxed_slice());
4179                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4180         }
4181 }
4182 #[no_mangle]
4183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4184 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4185 impl Drop for CVec_u64Z {
4186         fn drop(&mut self) {
4187                 if self.datalen == 0 { return; }
4188                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4189         }
4190 }
4191 impl Clone for CVec_u64Z {
4192         fn clone(&self) -> Self {
4193                 let mut res = Vec::new();
4194                 if self.datalen == 0 { return Self::from(res); }
4195                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4196                 Self::from(res)
4197         }
4198 }
4199 #[repr(C)]
4200 /// The contents of CResult_NodeInfoDecodeErrorZ
4201 pub union CResult_NodeInfoDecodeErrorZPtr {
4202         /// A pointer to the contents in the success state.
4203         /// Reading from this pointer when `result_ok` is not set is undefined.
4204         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
4205         /// A pointer to the contents in the error state.
4206         /// Reading from this pointer when `result_ok` is set is undefined.
4207         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4208 }
4209 #[repr(C)]
4210 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4211 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4213 pub struct CResult_NodeInfoDecodeErrorZ {
4214         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4215         /// `err` or `result` depending on the state of `result_ok`.
4216         pub contents: CResult_NodeInfoDecodeErrorZPtr,
4217         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4218         pub result_ok: bool,
4219 }
4220 #[no_mangle]
4221 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
4222 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
4223         CResult_NodeInfoDecodeErrorZ {
4224                 contents: CResult_NodeInfoDecodeErrorZPtr {
4225                         result: Box::into_raw(Box::new(o)),
4226                 },
4227                 result_ok: true,
4228         }
4229 }
4230 #[no_mangle]
4231 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
4232 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
4233         CResult_NodeInfoDecodeErrorZ {
4234                 contents: CResult_NodeInfoDecodeErrorZPtr {
4235                         err: Box::into_raw(Box::new(e)),
4236                 },
4237                 result_ok: false,
4238         }
4239 }
4240 #[no_mangle]
4241 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
4242 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
4243 impl Drop for CResult_NodeInfoDecodeErrorZ {
4244         fn drop(&mut self) {
4245                 if self.result_ok {
4246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4248                         }
4249                 } else {
4250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4252                         }
4253                 }
4254         }
4255 }
4256 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
4257         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4258                 let contents = if o.result_ok {
4259                         let result = unsafe { o.contents.result };
4260                         unsafe { o.contents.result = std::ptr::null_mut() };
4261                         CResult_NodeInfoDecodeErrorZPtr { result }
4262                 } else {
4263                         let err = unsafe { o.contents.err };
4264                         unsafe { o.contents.err = std::ptr::null_mut(); }
4265                         CResult_NodeInfoDecodeErrorZPtr { err }
4266                 };
4267                 Self {
4268                         contents,
4269                         result_ok: o.result_ok,
4270                 }
4271         }
4272 }
4273 impl Clone for CResult_NodeInfoDecodeErrorZ {
4274         fn clone(&self) -> Self {
4275                 if self.result_ok {
4276                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
4277                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
4278                         } }
4279                 } else {
4280                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
4281                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4282                         } }
4283                 }
4284         }
4285 }
4286 #[no_mangle]
4287 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
4288 /// but with all dynamically-allocated buffers duplicated in new buffers.
4289 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
4290 #[repr(C)]
4291 /// The contents of CResult_NetworkGraphDecodeErrorZ
4292 pub union CResult_NetworkGraphDecodeErrorZPtr {
4293         /// A pointer to the contents in the success state.
4294         /// Reading from this pointer when `result_ok` is not set is undefined.
4295         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
4296         /// A pointer to the contents in the error state.
4297         /// Reading from this pointer when `result_ok` is set is undefined.
4298         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4299 }
4300 #[repr(C)]
4301 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4302 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4304 pub struct CResult_NetworkGraphDecodeErrorZ {
4305         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4306         /// `err` or `result` depending on the state of `result_ok`.
4307         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
4308         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4309         pub result_ok: bool,
4310 }
4311 #[no_mangle]
4312 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
4313 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
4314         CResult_NetworkGraphDecodeErrorZ {
4315                 contents: CResult_NetworkGraphDecodeErrorZPtr {
4316                         result: Box::into_raw(Box::new(o)),
4317                 },
4318                 result_ok: true,
4319         }
4320 }
4321 #[no_mangle]
4322 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
4323 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
4324         CResult_NetworkGraphDecodeErrorZ {
4325                 contents: CResult_NetworkGraphDecodeErrorZPtr {
4326                         err: Box::into_raw(Box::new(e)),
4327                 },
4328                 result_ok: false,
4329         }
4330 }
4331 #[no_mangle]
4332 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
4333 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
4334 impl Drop for CResult_NetworkGraphDecodeErrorZ {
4335         fn drop(&mut self) {
4336                 if self.result_ok {
4337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4339                         }
4340                 } else {
4341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4343                         }
4344                 }
4345         }
4346 }
4347 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
4348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
4349                 let contents = if o.result_ok {
4350                         let result = unsafe { o.contents.result };
4351                         unsafe { o.contents.result = std::ptr::null_mut() };
4352                         CResult_NetworkGraphDecodeErrorZPtr { result }
4353                 } else {
4354                         let err = unsafe { o.contents.err };
4355                         unsafe { o.contents.err = std::ptr::null_mut(); }
4356                         CResult_NetworkGraphDecodeErrorZPtr { err }
4357                 };
4358                 Self {
4359                         contents,
4360                         result_ok: o.result_ok,
4361                 }
4362         }
4363 }
4364 impl Clone for CResult_NetworkGraphDecodeErrorZ {
4365         fn clone(&self) -> Self {
4366                 if self.result_ok {
4367                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
4368                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
4369                         } }
4370                 } else {
4371                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
4372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4373                         } }
4374                 }
4375         }
4376 }
4377 #[no_mangle]
4378 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
4379 /// but with all dynamically-allocated buffers duplicated in new buffers.
4380 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
4381 #[repr(C)]
4382 /// The contents of CResult_InitFeaturesDecodeErrorZ
4383 pub union CResult_InitFeaturesDecodeErrorZPtr {
4384         /// A pointer to the contents in the success state.
4385         /// Reading from this pointer when `result_ok` is not set is undefined.
4386         pub result: *mut crate::lightning::ln::features::InitFeatures,
4387         /// A pointer to the contents in the error state.
4388         /// Reading from this pointer when `result_ok` is set is undefined.
4389         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4390 }
4391 #[repr(C)]
4392 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4393 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4395 pub struct CResult_InitFeaturesDecodeErrorZ {
4396         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4397         /// `err` or `result` depending on the state of `result_ok`.
4398         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4399         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4400         pub result_ok: bool,
4401 }
4402 #[no_mangle]
4403 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4404 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4405         CResult_InitFeaturesDecodeErrorZ {
4406                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4407                         result: Box::into_raw(Box::new(o)),
4408                 },
4409                 result_ok: true,
4410         }
4411 }
4412 #[no_mangle]
4413 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4414 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4415         CResult_InitFeaturesDecodeErrorZ {
4416                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4417                         err: Box::into_raw(Box::new(e)),
4418                 },
4419                 result_ok: false,
4420         }
4421 }
4422 #[no_mangle]
4423 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4424 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4425 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4426         fn drop(&mut self) {
4427                 if self.result_ok {
4428                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4429                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4430                         }
4431                 } else {
4432                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4433                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4434                         }
4435                 }
4436         }
4437 }
4438 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4439         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4440                 let contents = if o.result_ok {
4441                         let result = unsafe { o.contents.result };
4442                         unsafe { o.contents.result = std::ptr::null_mut() };
4443                         CResult_InitFeaturesDecodeErrorZPtr { result }
4444                 } else {
4445                         let err = unsafe { o.contents.err };
4446                         unsafe { o.contents.err = std::ptr::null_mut(); }
4447                         CResult_InitFeaturesDecodeErrorZPtr { err }
4448                 };
4449                 Self {
4450                         contents,
4451                         result_ok: o.result_ok,
4452                 }
4453         }
4454 }
4455 #[repr(C)]
4456 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4457 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4458         /// A pointer to the contents in the success state.
4459         /// Reading from this pointer when `result_ok` is not set is undefined.
4460         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4461         /// A pointer to the contents in the error state.
4462         /// Reading from this pointer when `result_ok` is set is undefined.
4463         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4464 }
4465 #[repr(C)]
4466 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4467 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4469 pub struct CResult_NodeFeaturesDecodeErrorZ {
4470         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4471         /// `err` or `result` depending on the state of `result_ok`.
4472         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4473         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4474         pub result_ok: bool,
4475 }
4476 #[no_mangle]
4477 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4478 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4479         CResult_NodeFeaturesDecodeErrorZ {
4480                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4481                         result: Box::into_raw(Box::new(o)),
4482                 },
4483                 result_ok: true,
4484         }
4485 }
4486 #[no_mangle]
4487 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4488 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4489         CResult_NodeFeaturesDecodeErrorZ {
4490                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4491                         err: Box::into_raw(Box::new(e)),
4492                 },
4493                 result_ok: false,
4494         }
4495 }
4496 #[no_mangle]
4497 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4498 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4499 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4500         fn drop(&mut self) {
4501                 if self.result_ok {
4502                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4503                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4504                         }
4505                 } else {
4506                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4507                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4508                         }
4509                 }
4510         }
4511 }
4512 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4513         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4514                 let contents = if o.result_ok {
4515                         let result = unsafe { o.contents.result };
4516                         unsafe { o.contents.result = std::ptr::null_mut() };
4517                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4518                 } else {
4519                         let err = unsafe { o.contents.err };
4520                         unsafe { o.contents.err = std::ptr::null_mut(); }
4521                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4522                 };
4523                 Self {
4524                         contents,
4525                         result_ok: o.result_ok,
4526                 }
4527         }
4528 }
4529 #[repr(C)]
4530 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4531 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4532         /// A pointer to the contents in the success state.
4533         /// Reading from this pointer when `result_ok` is not set is undefined.
4534         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4535         /// A pointer to the contents in the error state.
4536         /// Reading from this pointer when `result_ok` is set is undefined.
4537         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4538 }
4539 #[repr(C)]
4540 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4541 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4543 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4544         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4545         /// `err` or `result` depending on the state of `result_ok`.
4546         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4547         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4548         pub result_ok: bool,
4549 }
4550 #[no_mangle]
4551 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4552 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4553         CResult_ChannelFeaturesDecodeErrorZ {
4554                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4555                         result: Box::into_raw(Box::new(o)),
4556                 },
4557                 result_ok: true,
4558         }
4559 }
4560 #[no_mangle]
4561 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4562 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4563         CResult_ChannelFeaturesDecodeErrorZ {
4564                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4565                         err: Box::into_raw(Box::new(e)),
4566                 },
4567                 result_ok: false,
4568         }
4569 }
4570 #[no_mangle]
4571 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4572 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4573 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4574         fn drop(&mut self) {
4575                 if self.result_ok {
4576                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4577                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4578                         }
4579                 } else {
4580                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4581                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4582                         }
4583                 }
4584         }
4585 }
4586 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4587         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4588                 let contents = if o.result_ok {
4589                         let result = unsafe { o.contents.result };
4590                         unsafe { o.contents.result = std::ptr::null_mut() };
4591                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4592                 } else {
4593                         let err = unsafe { o.contents.err };
4594                         unsafe { o.contents.err = std::ptr::null_mut(); }
4595                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4596                 };
4597                 Self {
4598                         contents,
4599                         result_ok: o.result_ok,
4600                 }
4601         }
4602 }
4603 #[repr(C)]
4604 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4605 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4606         /// A pointer to the contents in the success state.
4607         /// Reading from this pointer when `result_ok` is not set is undefined.
4608         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4609         /// A pointer to the contents in the error state.
4610         /// Reading from this pointer when `result_ok` is set is undefined.
4611         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4612 }
4613 #[repr(C)]
4614 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4615 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4617 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4618         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4619         /// `err` or `result` depending on the state of `result_ok`.
4620         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4621         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4622         pub result_ok: bool,
4623 }
4624 #[no_mangle]
4625 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4626 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4627         CResult_InvoiceFeaturesDecodeErrorZ {
4628                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4629                         result: Box::into_raw(Box::new(o)),
4630                 },
4631                 result_ok: true,
4632         }
4633 }
4634 #[no_mangle]
4635 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4636 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4637         CResult_InvoiceFeaturesDecodeErrorZ {
4638                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4639                         err: Box::into_raw(Box::new(e)),
4640                 },
4641                 result_ok: false,
4642         }
4643 }
4644 #[no_mangle]
4645 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4646 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4647 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4648         fn drop(&mut self) {
4649                 if self.result_ok {
4650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4652                         }
4653                 } else {
4654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4656                         }
4657                 }
4658         }
4659 }
4660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4661         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4662                 let contents = if o.result_ok {
4663                         let result = unsafe { o.contents.result };
4664                         unsafe { o.contents.result = std::ptr::null_mut() };
4665                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4666                 } else {
4667                         let err = unsafe { o.contents.err };
4668                         unsafe { o.contents.err = std::ptr::null_mut(); }
4669                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4670                 };
4671                 Self {
4672                         contents,
4673                         result_ok: o.result_ok,
4674                 }
4675         }
4676 }
4677 #[repr(C)]
4678 /// The contents of CResult_NetAddressu8Z
4679 pub union CResult_NetAddressu8ZPtr {
4680         /// A pointer to the contents in the success state.
4681         /// Reading from this pointer when `result_ok` is not set is undefined.
4682         pub result: *mut crate::lightning::ln::msgs::NetAddress,
4683         /// A pointer to the contents in the error state.
4684         /// Reading from this pointer when `result_ok` is set is undefined.
4685         pub err: *mut u8,
4686 }
4687 #[repr(C)]
4688 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
4689 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
4690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4691 pub struct CResult_NetAddressu8Z {
4692         /// The contents of this CResult_NetAddressu8Z, accessible via either
4693         /// `err` or `result` depending on the state of `result_ok`.
4694         pub contents: CResult_NetAddressu8ZPtr,
4695         /// Whether this CResult_NetAddressu8Z represents a success state.
4696         pub result_ok: bool,
4697 }
4698 #[no_mangle]
4699 /// Creates a new CResult_NetAddressu8Z in the success state.
4700 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
4701         CResult_NetAddressu8Z {
4702                 contents: CResult_NetAddressu8ZPtr {
4703                         result: Box::into_raw(Box::new(o)),
4704                 },
4705                 result_ok: true,
4706         }
4707 }
4708 #[no_mangle]
4709 /// Creates a new CResult_NetAddressu8Z in the error state.
4710 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
4711         CResult_NetAddressu8Z {
4712                 contents: CResult_NetAddressu8ZPtr {
4713                         err: Box::into_raw(Box::new(e)),
4714                 },
4715                 result_ok: false,
4716         }
4717 }
4718 #[no_mangle]
4719 /// Frees any resources used by the CResult_NetAddressu8Z.
4720 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
4721 impl Drop for CResult_NetAddressu8Z {
4722         fn drop(&mut self) {
4723                 if self.result_ok {
4724                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4725                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4726                         }
4727                 } else {
4728                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4729                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4730                         }
4731                 }
4732         }
4733 }
4734 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
4735         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
4736                 let contents = if o.result_ok {
4737                         let result = unsafe { o.contents.result };
4738                         unsafe { o.contents.result = std::ptr::null_mut() };
4739                         CResult_NetAddressu8ZPtr { result }
4740                 } else {
4741                         let err = unsafe { o.contents.err };
4742                         unsafe { o.contents.err = std::ptr::null_mut(); }
4743                         CResult_NetAddressu8ZPtr { err }
4744                 };
4745                 Self {
4746                         contents,
4747                         result_ok: o.result_ok,
4748                 }
4749         }
4750 }
4751 impl Clone for CResult_NetAddressu8Z {
4752         fn clone(&self) -> Self {
4753                 if self.result_ok {
4754                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
4755                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
4756                         } }
4757                 } else {
4758                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
4759                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
4760                         } }
4761                 }
4762         }
4763 }
4764 #[no_mangle]
4765 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
4766 /// but with all dynamically-allocated buffers duplicated in new buffers.
4767 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
4768 #[repr(C)]
4769 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
4770 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4771         /// A pointer to the contents in the success state.
4772         /// Reading from this pointer when `result_ok` is not set is undefined.
4773         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
4774         /// A pointer to the contents in the error state.
4775         /// Reading from this pointer when `result_ok` is set is undefined.
4776         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4777 }
4778 #[repr(C)]
4779 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
4780 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
4781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4782 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
4783         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
4784         /// `err` or `result` depending on the state of `result_ok`.
4785         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
4786         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
4787         pub result_ok: bool,
4788 }
4789 #[no_mangle]
4790 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
4791 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4792         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4793                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4794                         result: Box::into_raw(Box::new(o)),
4795                 },
4796                 result_ok: true,
4797         }
4798 }
4799 #[no_mangle]
4800 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
4801 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4802         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4803                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4804                         err: Box::into_raw(Box::new(e)),
4805                 },
4806                 result_ok: false,
4807         }
4808 }
4809 #[no_mangle]
4810 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
4811 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
4812 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4813         fn drop(&mut self) {
4814                 if self.result_ok {
4815                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4816                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4817                         }
4818                 } else {
4819                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4820                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4821                         }
4822                 }
4823         }
4824 }
4825 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4826         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
4827                 let contents = if o.result_ok {
4828                         let result = unsafe { o.contents.result };
4829                         unsafe { o.contents.result = std::ptr::null_mut() };
4830                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
4831                 } else {
4832                         let err = unsafe { o.contents.err };
4833                         unsafe { o.contents.err = std::ptr::null_mut(); }
4834                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
4835                 };
4836                 Self {
4837                         contents,
4838                         result_ok: o.result_ok,
4839                 }
4840         }
4841 }
4842 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4843         fn clone(&self) -> Self {
4844                 if self.result_ok {
4845                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4846                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
4847                         } }
4848                 } else {
4849                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4850                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4851                         } }
4852                 }
4853         }
4854 }
4855 #[no_mangle]
4856 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
4857 /// but with all dynamically-allocated buffers duplicated in new buffers.
4858 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
4859 #[repr(C)]
4860 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
4861 /// This corresponds to std::vector in C++
4862 pub struct CVec_UpdateAddHTLCZ {
4863         /// The elements in the array.
4864         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4865         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
4866         /// The number of elements pointed to by `data`.
4867         pub datalen: usize
4868 }
4869 impl CVec_UpdateAddHTLCZ {
4870         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
4871                 if self.datalen == 0 { return Vec::new(); }
4872                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4873                 self.data = std::ptr::null_mut();
4874                 self.datalen = 0;
4875                 ret
4876         }
4877         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
4878                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4879         }
4880 }
4881 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
4882         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
4883                 let datalen = v.len();
4884                 let data = Box::into_raw(v.into_boxed_slice());
4885                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4886         }
4887 }
4888 #[no_mangle]
4889 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4890 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
4891 impl Drop for CVec_UpdateAddHTLCZ {
4892         fn drop(&mut self) {
4893                 if self.datalen == 0 { return; }
4894                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4895         }
4896 }
4897 impl Clone for CVec_UpdateAddHTLCZ {
4898         fn clone(&self) -> Self {
4899                 let mut res = Vec::new();
4900                 if self.datalen == 0 { return Self::from(res); }
4901                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4902                 Self::from(res)
4903         }
4904 }
4905 #[repr(C)]
4906 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
4907 /// This corresponds to std::vector in C++
4908 pub struct CVec_UpdateFulfillHTLCZ {
4909         /// The elements in the array.
4910         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4911         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
4912         /// The number of elements pointed to by `data`.
4913         pub datalen: usize
4914 }
4915 impl CVec_UpdateFulfillHTLCZ {
4916         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
4917                 if self.datalen == 0 { return Vec::new(); }
4918                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4919                 self.data = std::ptr::null_mut();
4920                 self.datalen = 0;
4921                 ret
4922         }
4923         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
4924                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4925         }
4926 }
4927 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
4928         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
4929                 let datalen = v.len();
4930                 let data = Box::into_raw(v.into_boxed_slice());
4931                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4932         }
4933 }
4934 #[no_mangle]
4935 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4936 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
4937 impl Drop for CVec_UpdateFulfillHTLCZ {
4938         fn drop(&mut self) {
4939                 if self.datalen == 0 { return; }
4940                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4941         }
4942 }
4943 impl Clone for CVec_UpdateFulfillHTLCZ {
4944         fn clone(&self) -> Self {
4945                 let mut res = Vec::new();
4946                 if self.datalen == 0 { return Self::from(res); }
4947                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4948                 Self::from(res)
4949         }
4950 }
4951 #[repr(C)]
4952 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
4953 /// This corresponds to std::vector in C++
4954 pub struct CVec_UpdateFailHTLCZ {
4955         /// The elements in the array.
4956         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4957         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
4958         /// The number of elements pointed to by `data`.
4959         pub datalen: usize
4960 }
4961 impl CVec_UpdateFailHTLCZ {
4962         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
4963                 if self.datalen == 0 { return Vec::new(); }
4964                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4965                 self.data = std::ptr::null_mut();
4966                 self.datalen = 0;
4967                 ret
4968         }
4969         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
4970                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4971         }
4972 }
4973 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
4974         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
4975                 let datalen = v.len();
4976                 let data = Box::into_raw(v.into_boxed_slice());
4977                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4978         }
4979 }
4980 #[no_mangle]
4981 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4982 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
4983 impl Drop for CVec_UpdateFailHTLCZ {
4984         fn drop(&mut self) {
4985                 if self.datalen == 0 { return; }
4986                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4987         }
4988 }
4989 impl Clone for CVec_UpdateFailHTLCZ {
4990         fn clone(&self) -> Self {
4991                 let mut res = Vec::new();
4992                 if self.datalen == 0 { return Self::from(res); }
4993                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4994                 Self::from(res)
4995         }
4996 }
4997 #[repr(C)]
4998 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
4999 /// This corresponds to std::vector in C++
5000 pub struct CVec_UpdateFailMalformedHTLCZ {
5001         /// The elements in the array.
5002         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5003         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
5004         /// The number of elements pointed to by `data`.
5005         pub datalen: usize
5006 }
5007 impl CVec_UpdateFailMalformedHTLCZ {
5008         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
5009                 if self.datalen == 0 { return Vec::new(); }
5010                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5011                 self.data = std::ptr::null_mut();
5012                 self.datalen = 0;
5013                 ret
5014         }
5015         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
5016                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5017         }
5018 }
5019 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
5020         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
5021                 let datalen = v.len();
5022                 let data = Box::into_raw(v.into_boxed_slice());
5023                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5024         }
5025 }
5026 #[no_mangle]
5027 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5028 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
5029 impl Drop for CVec_UpdateFailMalformedHTLCZ {
5030         fn drop(&mut self) {
5031                 if self.datalen == 0 { return; }
5032                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5033         }
5034 }
5035 impl Clone for CVec_UpdateFailMalformedHTLCZ {
5036         fn clone(&self) -> Self {
5037                 let mut res = Vec::new();
5038                 if self.datalen == 0 { return Self::from(res); }
5039                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5040                 Self::from(res)
5041         }
5042 }
5043 #[repr(C)]
5044 /// The contents of CResult_AcceptChannelDecodeErrorZ
5045 pub union CResult_AcceptChannelDecodeErrorZPtr {
5046         /// A pointer to the contents in the success state.
5047         /// Reading from this pointer when `result_ok` is not set is undefined.
5048         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
5049         /// A pointer to the contents in the error state.
5050         /// Reading from this pointer when `result_ok` is set is undefined.
5051         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5052 }
5053 #[repr(C)]
5054 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5055 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5057 pub struct CResult_AcceptChannelDecodeErrorZ {
5058         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5059         /// `err` or `result` depending on the state of `result_ok`.
5060         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
5061         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5062         pub result_ok: bool,
5063 }
5064 #[no_mangle]
5065 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
5066 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
5067         CResult_AcceptChannelDecodeErrorZ {
5068                 contents: CResult_AcceptChannelDecodeErrorZPtr {
5069                         result: Box::into_raw(Box::new(o)),
5070                 },
5071                 result_ok: true,
5072         }
5073 }
5074 #[no_mangle]
5075 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
5076 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
5077         CResult_AcceptChannelDecodeErrorZ {
5078                 contents: CResult_AcceptChannelDecodeErrorZPtr {
5079                         err: Box::into_raw(Box::new(e)),
5080                 },
5081                 result_ok: false,
5082         }
5083 }
5084 #[no_mangle]
5085 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
5086 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
5087 impl Drop for CResult_AcceptChannelDecodeErrorZ {
5088         fn drop(&mut self) {
5089                 if self.result_ok {
5090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5092                         }
5093                 } else {
5094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5096                         }
5097                 }
5098         }
5099 }
5100 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
5101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
5102                 let contents = if o.result_ok {
5103                         let result = unsafe { o.contents.result };
5104                         unsafe { o.contents.result = std::ptr::null_mut() };
5105                         CResult_AcceptChannelDecodeErrorZPtr { result }
5106                 } else {
5107                         let err = unsafe { o.contents.err };
5108                         unsafe { o.contents.err = std::ptr::null_mut(); }
5109                         CResult_AcceptChannelDecodeErrorZPtr { err }
5110                 };
5111                 Self {
5112                         contents,
5113                         result_ok: o.result_ok,
5114                 }
5115         }
5116 }
5117 impl Clone for CResult_AcceptChannelDecodeErrorZ {
5118         fn clone(&self) -> Self {
5119                 if self.result_ok {
5120                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
5121                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
5122                         } }
5123                 } else {
5124                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
5125                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5126                         } }
5127                 }
5128         }
5129 }
5130 #[no_mangle]
5131 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
5132 /// but with all dynamically-allocated buffers duplicated in new buffers.
5133 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
5134 #[repr(C)]
5135 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5136 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
5137         /// A pointer to the contents in the success state.
5138         /// Reading from this pointer when `result_ok` is not set is undefined.
5139         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
5140         /// A pointer to the contents in the error state.
5141         /// Reading from this pointer when `result_ok` is set is undefined.
5142         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5143 }
5144 #[repr(C)]
5145 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5146 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5148 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
5149         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5150         /// `err` or `result` depending on the state of `result_ok`.
5151         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
5152         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5153         pub result_ok: bool,
5154 }
5155 #[no_mangle]
5156 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
5157 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5158         CResult_AnnouncementSignaturesDecodeErrorZ {
5159                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5160                         result: Box::into_raw(Box::new(o)),
5161                 },
5162                 result_ok: true,
5163         }
5164 }
5165 #[no_mangle]
5166 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
5167 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5168         CResult_AnnouncementSignaturesDecodeErrorZ {
5169                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5170                         err: Box::into_raw(Box::new(e)),
5171                 },
5172                 result_ok: false,
5173         }
5174 }
5175 #[no_mangle]
5176 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
5177 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
5178 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
5179         fn drop(&mut self) {
5180                 if self.result_ok {
5181                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5182                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5183                         }
5184                 } else {
5185                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5186                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5187                         }
5188                 }
5189         }
5190 }
5191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
5192         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5193                 let contents = if o.result_ok {
5194                         let result = unsafe { o.contents.result };
5195                         unsafe { o.contents.result = std::ptr::null_mut() };
5196                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
5197                 } else {
5198                         let err = unsafe { o.contents.err };
5199                         unsafe { o.contents.err = std::ptr::null_mut(); }
5200                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
5201                 };
5202                 Self {
5203                         contents,
5204                         result_ok: o.result_ok,
5205                 }
5206         }
5207 }
5208 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
5209         fn clone(&self) -> Self {
5210                 if self.result_ok {
5211                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5212                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
5213                         } }
5214                 } else {
5215                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5216                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5217                         } }
5218                 }
5219         }
5220 }
5221 #[no_mangle]
5222 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
5223 /// but with all dynamically-allocated buffers duplicated in new buffers.
5224 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
5225 #[repr(C)]
5226 /// The contents of CResult_ChannelReestablishDecodeErrorZ
5227 pub union CResult_ChannelReestablishDecodeErrorZPtr {
5228         /// A pointer to the contents in the success state.
5229         /// Reading from this pointer when `result_ok` is not set is undefined.
5230         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
5231         /// A pointer to the contents in the error state.
5232         /// Reading from this pointer when `result_ok` is set is undefined.
5233         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5234 }
5235 #[repr(C)]
5236 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5237 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
5238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5239 pub struct CResult_ChannelReestablishDecodeErrorZ {
5240         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5241         /// `err` or `result` depending on the state of `result_ok`.
5242         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
5243         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5244         pub result_ok: bool,
5245 }
5246 #[no_mangle]
5247 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
5248 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
5249         CResult_ChannelReestablishDecodeErrorZ {
5250                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5251                         result: Box::into_raw(Box::new(o)),
5252                 },
5253                 result_ok: true,
5254         }
5255 }
5256 #[no_mangle]
5257 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
5258 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
5259         CResult_ChannelReestablishDecodeErrorZ {
5260                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5261                         err: Box::into_raw(Box::new(e)),
5262                 },
5263                 result_ok: false,
5264         }
5265 }
5266 #[no_mangle]
5267 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
5268 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
5269 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
5270         fn drop(&mut self) {
5271                 if self.result_ok {
5272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5274                         }
5275                 } else {
5276                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5277                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5278                         }
5279                 }
5280         }
5281 }
5282 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
5283         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
5284                 let contents = if o.result_ok {
5285                         let result = unsafe { o.contents.result };
5286                         unsafe { o.contents.result = std::ptr::null_mut() };
5287                         CResult_ChannelReestablishDecodeErrorZPtr { result }
5288                 } else {
5289                         let err = unsafe { o.contents.err };
5290                         unsafe { o.contents.err = std::ptr::null_mut(); }
5291                         CResult_ChannelReestablishDecodeErrorZPtr { err }
5292                 };
5293                 Self {
5294                         contents,
5295                         result_ok: o.result_ok,
5296                 }
5297         }
5298 }
5299 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
5300         fn clone(&self) -> Self {
5301                 if self.result_ok {
5302                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5303                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
5304                         } }
5305                 } else {
5306                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5307                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5308                         } }
5309                 }
5310         }
5311 }
5312 #[no_mangle]
5313 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
5314 /// but with all dynamically-allocated buffers duplicated in new buffers.
5315 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
5316 #[repr(C)]
5317 /// The contents of CResult_ClosingSignedDecodeErrorZ
5318 pub union CResult_ClosingSignedDecodeErrorZPtr {
5319         /// A pointer to the contents in the success state.
5320         /// Reading from this pointer when `result_ok` is not set is undefined.
5321         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
5322         /// A pointer to the contents in the error state.
5323         /// Reading from this pointer when `result_ok` is set is undefined.
5324         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5325 }
5326 #[repr(C)]
5327 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5328 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5330 pub struct CResult_ClosingSignedDecodeErrorZ {
5331         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5332         /// `err` or `result` depending on the state of `result_ok`.
5333         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
5334         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5335         pub result_ok: bool,
5336 }
5337 #[no_mangle]
5338 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
5339 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
5340         CResult_ClosingSignedDecodeErrorZ {
5341                 contents: CResult_ClosingSignedDecodeErrorZPtr {
5342                         result: Box::into_raw(Box::new(o)),
5343                 },
5344                 result_ok: true,
5345         }
5346 }
5347 #[no_mangle]
5348 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
5349 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
5350         CResult_ClosingSignedDecodeErrorZ {
5351                 contents: CResult_ClosingSignedDecodeErrorZPtr {
5352                         err: Box::into_raw(Box::new(e)),
5353                 },
5354                 result_ok: false,
5355         }
5356 }
5357 #[no_mangle]
5358 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
5359 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
5360 impl Drop for CResult_ClosingSignedDecodeErrorZ {
5361         fn drop(&mut self) {
5362                 if self.result_ok {
5363                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5364                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5365                         }
5366                 } else {
5367                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5368                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5369                         }
5370                 }
5371         }
5372 }
5373 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
5374         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5375                 let contents = if o.result_ok {
5376                         let result = unsafe { o.contents.result };
5377                         unsafe { o.contents.result = std::ptr::null_mut() };
5378                         CResult_ClosingSignedDecodeErrorZPtr { result }
5379                 } else {
5380                         let err = unsafe { o.contents.err };
5381                         unsafe { o.contents.err = std::ptr::null_mut(); }
5382                         CResult_ClosingSignedDecodeErrorZPtr { err }
5383                 };
5384                 Self {
5385                         contents,
5386                         result_ok: o.result_ok,
5387                 }
5388         }
5389 }
5390 impl Clone for CResult_ClosingSignedDecodeErrorZ {
5391         fn clone(&self) -> Self {
5392                 if self.result_ok {
5393                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
5394                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
5395                         } }
5396                 } else {
5397                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
5398                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5399                         } }
5400                 }
5401         }
5402 }
5403 #[no_mangle]
5404 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
5405 /// but with all dynamically-allocated buffers duplicated in new buffers.
5406 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
5407 #[repr(C)]
5408 /// The contents of CResult_CommitmentSignedDecodeErrorZ
5409 pub union CResult_CommitmentSignedDecodeErrorZPtr {
5410         /// A pointer to the contents in the success state.
5411         /// Reading from this pointer when `result_ok` is not set is undefined.
5412         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
5413         /// A pointer to the contents in the error state.
5414         /// Reading from this pointer when `result_ok` is set is undefined.
5415         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5416 }
5417 #[repr(C)]
5418 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5419 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5420 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5421 pub struct CResult_CommitmentSignedDecodeErrorZ {
5422         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5423         /// `err` or `result` depending on the state of `result_ok`.
5424         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
5425         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5426         pub result_ok: bool,
5427 }
5428 #[no_mangle]
5429 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
5430 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
5431         CResult_CommitmentSignedDecodeErrorZ {
5432                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5433                         result: Box::into_raw(Box::new(o)),
5434                 },
5435                 result_ok: true,
5436         }
5437 }
5438 #[no_mangle]
5439 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
5440 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
5441         CResult_CommitmentSignedDecodeErrorZ {
5442                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5443                         err: Box::into_raw(Box::new(e)),
5444                 },
5445                 result_ok: false,
5446         }
5447 }
5448 #[no_mangle]
5449 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
5450 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
5451 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
5452         fn drop(&mut self) {
5453                 if self.result_ok {
5454                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5455                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5456                         }
5457                 } else {
5458                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5459                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5460                         }
5461                 }
5462         }
5463 }
5464 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
5465         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5466                 let contents = if o.result_ok {
5467                         let result = unsafe { o.contents.result };
5468                         unsafe { o.contents.result = std::ptr::null_mut() };
5469                         CResult_CommitmentSignedDecodeErrorZPtr { result }
5470                 } else {
5471                         let err = unsafe { o.contents.err };
5472                         unsafe { o.contents.err = std::ptr::null_mut(); }
5473                         CResult_CommitmentSignedDecodeErrorZPtr { err }
5474                 };
5475                 Self {
5476                         contents,
5477                         result_ok: o.result_ok,
5478                 }
5479         }
5480 }
5481 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
5482         fn clone(&self) -> Self {
5483                 if self.result_ok {
5484                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5485                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
5486                         } }
5487                 } else {
5488                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5489                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5490                         } }
5491                 }
5492         }
5493 }
5494 #[no_mangle]
5495 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
5496 /// but with all dynamically-allocated buffers duplicated in new buffers.
5497 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
5498 #[repr(C)]
5499 /// The contents of CResult_FundingCreatedDecodeErrorZ
5500 pub union CResult_FundingCreatedDecodeErrorZPtr {
5501         /// A pointer to the contents in the success state.
5502         /// Reading from this pointer when `result_ok` is not set is undefined.
5503         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
5504         /// A pointer to the contents in the error state.
5505         /// Reading from this pointer when `result_ok` is set is undefined.
5506         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5507 }
5508 #[repr(C)]
5509 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5510 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
5511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5512 pub struct CResult_FundingCreatedDecodeErrorZ {
5513         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5514         /// `err` or `result` depending on the state of `result_ok`.
5515         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
5516         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5517         pub result_ok: bool,
5518 }
5519 #[no_mangle]
5520 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
5521 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
5522         CResult_FundingCreatedDecodeErrorZ {
5523                 contents: CResult_FundingCreatedDecodeErrorZPtr {
5524                         result: Box::into_raw(Box::new(o)),
5525                 },
5526                 result_ok: true,
5527         }
5528 }
5529 #[no_mangle]
5530 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
5531 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
5532         CResult_FundingCreatedDecodeErrorZ {
5533                 contents: CResult_FundingCreatedDecodeErrorZPtr {
5534                         err: Box::into_raw(Box::new(e)),
5535                 },
5536                 result_ok: false,
5537         }
5538 }
5539 #[no_mangle]
5540 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
5541 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
5542 impl Drop for CResult_FundingCreatedDecodeErrorZ {
5543         fn drop(&mut self) {
5544                 if self.result_ok {
5545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5547                         }
5548                 } else {
5549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5551                         }
5552                 }
5553         }
5554 }
5555 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
5556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
5557                 let contents = if o.result_ok {
5558                         let result = unsafe { o.contents.result };
5559                         unsafe { o.contents.result = std::ptr::null_mut() };
5560                         CResult_FundingCreatedDecodeErrorZPtr { result }
5561                 } else {
5562                         let err = unsafe { o.contents.err };
5563                         unsafe { o.contents.err = std::ptr::null_mut(); }
5564                         CResult_FundingCreatedDecodeErrorZPtr { err }
5565                 };
5566                 Self {
5567                         contents,
5568                         result_ok: o.result_ok,
5569                 }
5570         }
5571 }
5572 impl Clone for CResult_FundingCreatedDecodeErrorZ {
5573         fn clone(&self) -> Self {
5574                 if self.result_ok {
5575                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
5576                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
5577                         } }
5578                 } else {
5579                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
5580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5581                         } }
5582                 }
5583         }
5584 }
5585 #[no_mangle]
5586 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
5587 /// but with all dynamically-allocated buffers duplicated in new buffers.
5588 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
5589 #[repr(C)]
5590 /// The contents of CResult_FundingSignedDecodeErrorZ
5591 pub union CResult_FundingSignedDecodeErrorZPtr {
5592         /// A pointer to the contents in the success state.
5593         /// Reading from this pointer when `result_ok` is not set is undefined.
5594         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
5595         /// A pointer to the contents in the error state.
5596         /// Reading from this pointer when `result_ok` is set is undefined.
5597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5598 }
5599 #[repr(C)]
5600 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5601 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5603 pub struct CResult_FundingSignedDecodeErrorZ {
5604         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5605         /// `err` or `result` depending on the state of `result_ok`.
5606         pub contents: CResult_FundingSignedDecodeErrorZPtr,
5607         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5608         pub result_ok: bool,
5609 }
5610 #[no_mangle]
5611 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
5612 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
5613         CResult_FundingSignedDecodeErrorZ {
5614                 contents: CResult_FundingSignedDecodeErrorZPtr {
5615                         result: Box::into_raw(Box::new(o)),
5616                 },
5617                 result_ok: true,
5618         }
5619 }
5620 #[no_mangle]
5621 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
5622 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
5623         CResult_FundingSignedDecodeErrorZ {
5624                 contents: CResult_FundingSignedDecodeErrorZPtr {
5625                         err: Box::into_raw(Box::new(e)),
5626                 },
5627                 result_ok: false,
5628         }
5629 }
5630 #[no_mangle]
5631 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
5632 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
5633 impl Drop for CResult_FundingSignedDecodeErrorZ {
5634         fn drop(&mut self) {
5635                 if self.result_ok {
5636                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5637                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5638                         }
5639                 } else {
5640                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5641                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5642                         }
5643                 }
5644         }
5645 }
5646 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
5647         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5648                 let contents = if o.result_ok {
5649                         let result = unsafe { o.contents.result };
5650                         unsafe { o.contents.result = std::ptr::null_mut() };
5651                         CResult_FundingSignedDecodeErrorZPtr { result }
5652                 } else {
5653                         let err = unsafe { o.contents.err };
5654                         unsafe { o.contents.err = std::ptr::null_mut(); }
5655                         CResult_FundingSignedDecodeErrorZPtr { err }
5656                 };
5657                 Self {
5658                         contents,
5659                         result_ok: o.result_ok,
5660                 }
5661         }
5662 }
5663 impl Clone for CResult_FundingSignedDecodeErrorZ {
5664         fn clone(&self) -> Self {
5665                 if self.result_ok {
5666                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
5667                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
5668                         } }
5669                 } else {
5670                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
5671                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5672                         } }
5673                 }
5674         }
5675 }
5676 #[no_mangle]
5677 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
5678 /// but with all dynamically-allocated buffers duplicated in new buffers.
5679 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
5680 #[repr(C)]
5681 /// The contents of CResult_FundingLockedDecodeErrorZ
5682 pub union CResult_FundingLockedDecodeErrorZPtr {
5683         /// A pointer to the contents in the success state.
5684         /// Reading from this pointer when `result_ok` is not set is undefined.
5685         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
5686         /// A pointer to the contents in the error state.
5687         /// Reading from this pointer when `result_ok` is set is undefined.
5688         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5689 }
5690 #[repr(C)]
5691 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5692 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
5693 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5694 pub struct CResult_FundingLockedDecodeErrorZ {
5695         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5696         /// `err` or `result` depending on the state of `result_ok`.
5697         pub contents: CResult_FundingLockedDecodeErrorZPtr,
5698         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5699         pub result_ok: bool,
5700 }
5701 #[no_mangle]
5702 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
5703 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
5704         CResult_FundingLockedDecodeErrorZ {
5705                 contents: CResult_FundingLockedDecodeErrorZPtr {
5706                         result: Box::into_raw(Box::new(o)),
5707                 },
5708                 result_ok: true,
5709         }
5710 }
5711 #[no_mangle]
5712 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
5713 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
5714         CResult_FundingLockedDecodeErrorZ {
5715                 contents: CResult_FundingLockedDecodeErrorZPtr {
5716                         err: Box::into_raw(Box::new(e)),
5717                 },
5718                 result_ok: false,
5719         }
5720 }
5721 #[no_mangle]
5722 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
5723 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
5724 impl Drop for CResult_FundingLockedDecodeErrorZ {
5725         fn drop(&mut self) {
5726                 if self.result_ok {
5727                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5728                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5729                         }
5730                 } else {
5731                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5732                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5733                         }
5734                 }
5735         }
5736 }
5737 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
5738         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
5739                 let contents = if o.result_ok {
5740                         let result = unsafe { o.contents.result };
5741                         unsafe { o.contents.result = std::ptr::null_mut() };
5742                         CResult_FundingLockedDecodeErrorZPtr { result }
5743                 } else {
5744                         let err = unsafe { o.contents.err };
5745                         unsafe { o.contents.err = std::ptr::null_mut(); }
5746                         CResult_FundingLockedDecodeErrorZPtr { err }
5747                 };
5748                 Self {
5749                         contents,
5750                         result_ok: o.result_ok,
5751                 }
5752         }
5753 }
5754 impl Clone for CResult_FundingLockedDecodeErrorZ {
5755         fn clone(&self) -> Self {
5756                 if self.result_ok {
5757                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
5758                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
5759                         } }
5760                 } else {
5761                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
5762                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5763                         } }
5764                 }
5765         }
5766 }
5767 #[no_mangle]
5768 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
5769 /// but with all dynamically-allocated buffers duplicated in new buffers.
5770 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
5771 #[repr(C)]
5772 /// The contents of CResult_InitDecodeErrorZ
5773 pub union CResult_InitDecodeErrorZPtr {
5774         /// A pointer to the contents in the success state.
5775         /// Reading from this pointer when `result_ok` is not set is undefined.
5776         pub result: *mut crate::lightning::ln::msgs::Init,
5777         /// A pointer to the contents in the error state.
5778         /// Reading from this pointer when `result_ok` is set is undefined.
5779         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5780 }
5781 #[repr(C)]
5782 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5783 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
5784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5785 pub struct CResult_InitDecodeErrorZ {
5786         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
5787         /// `err` or `result` depending on the state of `result_ok`.
5788         pub contents: CResult_InitDecodeErrorZPtr,
5789         /// Whether this CResult_InitDecodeErrorZ represents a success state.
5790         pub result_ok: bool,
5791 }
5792 #[no_mangle]
5793 /// Creates a new CResult_InitDecodeErrorZ in the success state.
5794 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
5795         CResult_InitDecodeErrorZ {
5796                 contents: CResult_InitDecodeErrorZPtr {
5797                         result: Box::into_raw(Box::new(o)),
5798                 },
5799                 result_ok: true,
5800         }
5801 }
5802 #[no_mangle]
5803 /// Creates a new CResult_InitDecodeErrorZ in the error state.
5804 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
5805         CResult_InitDecodeErrorZ {
5806                 contents: CResult_InitDecodeErrorZPtr {
5807                         err: Box::into_raw(Box::new(e)),
5808                 },
5809                 result_ok: false,
5810         }
5811 }
5812 #[no_mangle]
5813 /// Frees any resources used by the CResult_InitDecodeErrorZ.
5814 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
5815 impl Drop for CResult_InitDecodeErrorZ {
5816         fn drop(&mut self) {
5817                 if self.result_ok {
5818                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5819                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5820                         }
5821                 } else {
5822                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5823                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5824                         }
5825                 }
5826         }
5827 }
5828 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
5829         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
5830                 let contents = if o.result_ok {
5831                         let result = unsafe { o.contents.result };
5832                         unsafe { o.contents.result = std::ptr::null_mut() };
5833                         CResult_InitDecodeErrorZPtr { result }
5834                 } else {
5835                         let err = unsafe { o.contents.err };
5836                         unsafe { o.contents.err = std::ptr::null_mut(); }
5837                         CResult_InitDecodeErrorZPtr { err }
5838                 };
5839                 Self {
5840                         contents,
5841                         result_ok: o.result_ok,
5842                 }
5843         }
5844 }
5845 impl Clone for CResult_InitDecodeErrorZ {
5846         fn clone(&self) -> Self {
5847                 if self.result_ok {
5848                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
5849                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
5850                         } }
5851                 } else {
5852                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
5853                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5854                         } }
5855                 }
5856         }
5857 }
5858 #[no_mangle]
5859 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
5860 /// but with all dynamically-allocated buffers duplicated in new buffers.
5861 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
5862 #[repr(C)]
5863 /// The contents of CResult_OpenChannelDecodeErrorZ
5864 pub union CResult_OpenChannelDecodeErrorZPtr {
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::OpenChannel,
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_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5874 /// containing a crate::lightning::ln::msgs::OpenChannel 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_OpenChannelDecodeErrorZ {
5877         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5878         /// `err` or `result` depending on the state of `result_ok`.
5879         pub contents: CResult_OpenChannelDecodeErrorZPtr,
5880         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5881         pub result_ok: bool,
5882 }
5883 #[no_mangle]
5884 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
5885 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
5886         CResult_OpenChannelDecodeErrorZ {
5887                 contents: CResult_OpenChannelDecodeErrorZPtr {
5888                         result: Box::into_raw(Box::new(o)),
5889                 },
5890                 result_ok: true,
5891         }
5892 }
5893 #[no_mangle]
5894 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
5895 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
5896         CResult_OpenChannelDecodeErrorZ {
5897                 contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ.
5905 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
5906 impl Drop for CResult_OpenChannelDecodeErrorZ {
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::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
5920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, 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_OpenChannelDecodeErrorZPtr { result }
5925                 } else {
5926                         let err = unsafe { o.contents.err };
5927                         unsafe { o.contents.err = std::ptr::null_mut(); }
5928                         CResult_OpenChannelDecodeErrorZPtr { err }
5929                 };
5930                 Self {
5931                         contents,
5932                         result_ok: o.result_ok,
5933                 }
5934         }
5935 }
5936 impl Clone for CResult_OpenChannelDecodeErrorZ {
5937         fn clone(&self) -> Self {
5938                 if self.result_ok {
5939                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
5940                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
5941                         } }
5942                 } else {
5943                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ which has the same data as `orig`
5951 /// but with all dynamically-allocated buffers duplicated in new buffers.
5952 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
5953 #[repr(C)]
5954 /// The contents of CResult_RevokeAndACKDecodeErrorZ
5955 pub union CResult_RevokeAndACKDecodeErrorZPtr {
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::RevokeAndACK,
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_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5965 /// containing a crate::lightning::ln::msgs::RevokeAndACK 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_RevokeAndACKDecodeErrorZ {
5968         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5969         /// `err` or `result` depending on the state of `result_ok`.
5970         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
5971         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5972         pub result_ok: bool,
5973 }
5974 #[no_mangle]
5975 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
5976 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
5977         CResult_RevokeAndACKDecodeErrorZ {
5978                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5979                         result: Box::into_raw(Box::new(o)),
5980                 },
5981                 result_ok: true,
5982         }
5983 }
5984 #[no_mangle]
5985 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
5986 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
5987         CResult_RevokeAndACKDecodeErrorZ {
5988                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ.
5996 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
5997 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
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::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
6011         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, 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_RevokeAndACKDecodeErrorZPtr { result }
6016                 } else {
6017                         let err = unsafe { o.contents.err };
6018                         unsafe { o.contents.err = std::ptr::null_mut(); }
6019                         CResult_RevokeAndACKDecodeErrorZPtr { err }
6020                 };
6021                 Self {
6022                         contents,
6023                         result_ok: o.result_ok,
6024                 }
6025         }
6026 }
6027 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
6028         fn clone(&self) -> Self {
6029                 if self.result_ok {
6030                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
6031                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
6032                         } }
6033                 } else {
6034                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ which has the same data as `orig`
6042 /// but with all dynamically-allocated buffers duplicated in new buffers.
6043 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
6044 #[repr(C)]
6045 /// The contents of CResult_ShutdownDecodeErrorZ
6046 pub union CResult_ShutdownDecodeErrorZPtr {
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::Shutdown,
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_ShutdownDecodeErrorZ represents the result of a fallible operation,
6056 /// containing a crate::lightning::ln::msgs::Shutdown 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_ShutdownDecodeErrorZ {
6059         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
6060         /// `err` or `result` depending on the state of `result_ok`.
6061         pub contents: CResult_ShutdownDecodeErrorZPtr,
6062         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
6063         pub result_ok: bool,
6064 }
6065 #[no_mangle]
6066 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
6067 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
6068         CResult_ShutdownDecodeErrorZ {
6069                 contents: CResult_ShutdownDecodeErrorZPtr {
6070                         result: Box::into_raw(Box::new(o)),
6071                 },
6072                 result_ok: true,
6073         }
6074 }
6075 #[no_mangle]
6076 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
6077 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
6078         CResult_ShutdownDecodeErrorZ {
6079                 contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ.
6087 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
6088 impl Drop for CResult_ShutdownDecodeErrorZ {
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::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
6102         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, 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_ShutdownDecodeErrorZPtr { result }
6107                 } else {
6108                         let err = unsafe { o.contents.err };
6109                         unsafe { o.contents.err = std::ptr::null_mut(); }
6110                         CResult_ShutdownDecodeErrorZPtr { err }
6111                 };
6112                 Self {
6113                         contents,
6114                         result_ok: o.result_ok,
6115                 }
6116         }
6117 }
6118 impl Clone for CResult_ShutdownDecodeErrorZ {
6119         fn clone(&self) -> Self {
6120                 if self.result_ok {
6121                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
6122                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
6123                         } }
6124                 } else {
6125                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ which has the same data as `orig`
6133 /// but with all dynamically-allocated buffers duplicated in new buffers.
6134 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
6135 #[repr(C)]
6136 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
6137 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
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::UpdateFailHTLC,
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_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
6147 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ {
6150         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
6151         /// `err` or `result` depending on the state of `result_ok`.
6152         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
6153         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
6154         pub result_ok: bool,
6155 }
6156 #[no_mangle]
6157 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
6158 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
6159         CResult_UpdateFailHTLCDecodeErrorZ {
6160                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6161                         result: Box::into_raw(Box::new(o)),
6162                 },
6163                 result_ok: true,
6164         }
6165 }
6166 #[no_mangle]
6167 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
6168 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
6169         CResult_UpdateFailHTLCDecodeErrorZ {
6170                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ.
6178 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
6179 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
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::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
6193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, 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_UpdateFailHTLCDecodeErrorZPtr { result }
6198                 } else {
6199                         let err = unsafe { o.contents.err };
6200                         unsafe { o.contents.err = std::ptr::null_mut(); }
6201                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
6202                 };
6203                 Self {
6204                         contents,
6205                         result_ok: o.result_ok,
6206                 }
6207         }
6208 }
6209 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
6210         fn clone(&self) -> Self {
6211                 if self.result_ok {
6212                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6213                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
6214                         } }
6215                 } else {
6216                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
6224 /// but with all dynamically-allocated buffers duplicated in new buffers.
6225 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
6226 #[repr(C)]
6227 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
6228 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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::UpdateFailMalformedHTLC,
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_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
6238 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
6241         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
6242         /// `err` or `result` depending on the state of `result_ok`.
6243         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
6244         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
6245         pub result_ok: bool,
6246 }
6247 #[no_mangle]
6248 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
6249 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6250         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6251                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6252                         result: Box::into_raw(Box::new(o)),
6253                 },
6254                 result_ok: true,
6255         }
6256 }
6257 #[no_mangle]
6258 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
6259 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6260         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6261                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ.
6269 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
6270 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
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::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6284         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
6289                 } else {
6290                         let err = unsafe { o.contents.err };
6291                         unsafe { o.contents.err = std::ptr::null_mut(); }
6292                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
6293                 };
6294                 Self {
6295                         contents,
6296                         result_ok: o.result_ok,
6297                 }
6298         }
6299 }
6300 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6301         fn clone(&self) -> Self {
6302                 if self.result_ok {
6303                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6304                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
6305                         } }
6306                 } else {
6307                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
6315 /// but with all dynamically-allocated buffers duplicated in new buffers.
6316 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
6317 #[repr(C)]
6318 /// The contents of CResult_UpdateFeeDecodeErrorZ
6319 pub union CResult_UpdateFeeDecodeErrorZPtr {
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::UpdateFee,
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_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
6329 /// containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
6332         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
6333         /// `err` or `result` depending on the state of `result_ok`.
6334         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
6335         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
6336         pub result_ok: bool,
6337 }
6338 #[no_mangle]
6339 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
6340 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
6341         CResult_UpdateFeeDecodeErrorZ {
6342                 contents: CResult_UpdateFeeDecodeErrorZPtr {
6343                         result: Box::into_raw(Box::new(o)),
6344                 },
6345                 result_ok: true,
6346         }
6347 }
6348 #[no_mangle]
6349 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
6350 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
6351         CResult_UpdateFeeDecodeErrorZ {
6352                 contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ.
6360 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
6361 impl Drop for CResult_UpdateFeeDecodeErrorZ {
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::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
6375         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, 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_UpdateFeeDecodeErrorZPtr { result }
6380                 } else {
6381                         let err = unsafe { o.contents.err };
6382                         unsafe { o.contents.err = std::ptr::null_mut(); }
6383                         CResult_UpdateFeeDecodeErrorZPtr { err }
6384                 };
6385                 Self {
6386                         contents,
6387                         result_ok: o.result_ok,
6388                 }
6389         }
6390 }
6391 impl Clone for CResult_UpdateFeeDecodeErrorZ {
6392         fn clone(&self) -> Self {
6393                 if self.result_ok {
6394                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
6395                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
6396                         } }
6397                 } else {
6398                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ which has the same data as `orig`
6406 /// but with all dynamically-allocated buffers duplicated in new buffers.
6407 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
6408 #[repr(C)]
6409 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
6410 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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::UpdateFulfillHTLC,
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_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
6420 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
6423         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
6424         /// `err` or `result` depending on the state of `result_ok`.
6425         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
6426         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
6427         pub result_ok: bool,
6428 }
6429 #[no_mangle]
6430 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
6431 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6432         CResult_UpdateFulfillHTLCDecodeErrorZ {
6433                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6434                         result: Box::into_raw(Box::new(o)),
6435                 },
6436                 result_ok: true,
6437         }
6438 }
6439 #[no_mangle]
6440 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
6441 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6442         CResult_UpdateFulfillHTLCDecodeErrorZ {
6443                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ.
6451 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
6452 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
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::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
6466         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, 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_UpdateFulfillHTLCDecodeErrorZPtr { result }
6471                 } else {
6472                         let err = unsafe { o.contents.err };
6473                         unsafe { o.contents.err = std::ptr::null_mut(); }
6474                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
6475                 };
6476                 Self {
6477                         contents,
6478                         result_ok: o.result_ok,
6479                 }
6480         }
6481 }
6482 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
6483         fn clone(&self) -> Self {
6484                 if self.result_ok {
6485                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6486                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
6487                         } }
6488                 } else {
6489                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
6497 /// but with all dynamically-allocated buffers duplicated in new buffers.
6498 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
6499 #[repr(C)]
6500 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
6501 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
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::UpdateAddHTLC,
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_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
6511 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
6514         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
6515         /// `err` or `result` depending on the state of `result_ok`.
6516         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
6517         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
6518         pub result_ok: bool,
6519 }
6520 #[no_mangle]
6521 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
6522 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
6523         CResult_UpdateAddHTLCDecodeErrorZ {
6524                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6525                         result: Box::into_raw(Box::new(o)),
6526                 },
6527                 result_ok: true,
6528         }
6529 }
6530 #[no_mangle]
6531 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
6532 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
6533         CResult_UpdateAddHTLCDecodeErrorZ {
6534                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ.
6542 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
6543 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
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::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
6557         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, 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_UpdateAddHTLCDecodeErrorZPtr { result }
6562                 } else {
6563                         let err = unsafe { o.contents.err };
6564                         unsafe { o.contents.err = std::ptr::null_mut(); }
6565                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
6566                 };
6567                 Self {
6568                         contents,
6569                         result_ok: o.result_ok,
6570                 }
6571         }
6572 }
6573 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
6574         fn clone(&self) -> Self {
6575                 if self.result_ok {
6576                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6577                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
6578                         } }
6579                 } else {
6580                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
6588 /// but with all dynamically-allocated buffers duplicated in new buffers.
6589 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
6590 #[repr(C)]
6591 /// The contents of CResult_PingDecodeErrorZ
6592 pub union CResult_PingDecodeErrorZPtr {
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::Ping,
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_PingDecodeErrorZ represents the result of a fallible operation,
6602 /// containing a crate::lightning::ln::msgs::Ping 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_PingDecodeErrorZ {
6605         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
6606         /// `err` or `result` depending on the state of `result_ok`.
6607         pub contents: CResult_PingDecodeErrorZPtr,
6608         /// Whether this CResult_PingDecodeErrorZ represents a success state.
6609         pub result_ok: bool,
6610 }
6611 #[no_mangle]
6612 /// Creates a new CResult_PingDecodeErrorZ in the success state.
6613 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
6614         CResult_PingDecodeErrorZ {
6615                 contents: CResult_PingDecodeErrorZPtr {
6616                         result: Box::into_raw(Box::new(o)),
6617                 },
6618                 result_ok: true,
6619         }
6620 }
6621 #[no_mangle]
6622 /// Creates a new CResult_PingDecodeErrorZ in the error state.
6623 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
6624         CResult_PingDecodeErrorZ {
6625                 contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ.
6633 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
6634 impl Drop for CResult_PingDecodeErrorZ {
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::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
6648         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, 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_PingDecodeErrorZPtr { result }
6653                 } else {
6654                         let err = unsafe { o.contents.err };
6655                         unsafe { o.contents.err = std::ptr::null_mut(); }
6656                         CResult_PingDecodeErrorZPtr { err }
6657                 };
6658                 Self {
6659                         contents,
6660                         result_ok: o.result_ok,
6661                 }
6662         }
6663 }
6664 impl Clone for CResult_PingDecodeErrorZ {
6665         fn clone(&self) -> Self {
6666                 if self.result_ok {
6667                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
6668                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
6669                         } }
6670                 } else {
6671                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ which has the same data as `orig`
6679 /// but with all dynamically-allocated buffers duplicated in new buffers.
6680 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
6681 #[repr(C)]
6682 /// The contents of CResult_PongDecodeErrorZ
6683 pub union CResult_PongDecodeErrorZPtr {
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::Pong,
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_PongDecodeErrorZ represents the result of a fallible operation,
6693 /// containing a crate::lightning::ln::msgs::Pong 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_PongDecodeErrorZ {
6696         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
6697         /// `err` or `result` depending on the state of `result_ok`.
6698         pub contents: CResult_PongDecodeErrorZPtr,
6699         /// Whether this CResult_PongDecodeErrorZ represents a success state.
6700         pub result_ok: bool,
6701 }
6702 #[no_mangle]
6703 /// Creates a new CResult_PongDecodeErrorZ in the success state.
6704 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
6705         CResult_PongDecodeErrorZ {
6706                 contents: CResult_PongDecodeErrorZPtr {
6707                         result: Box::into_raw(Box::new(o)),
6708                 },
6709                 result_ok: true,
6710         }
6711 }
6712 #[no_mangle]
6713 /// Creates a new CResult_PongDecodeErrorZ in the error state.
6714 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
6715         CResult_PongDecodeErrorZ {
6716                 contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ.
6724 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
6725 impl Drop for CResult_PongDecodeErrorZ {
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::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
6739         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, 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_PongDecodeErrorZPtr { result }
6744                 } else {
6745                         let err = unsafe { o.contents.err };
6746                         unsafe { o.contents.err = std::ptr::null_mut(); }
6747                         CResult_PongDecodeErrorZPtr { err }
6748                 };
6749                 Self {
6750                         contents,
6751                         result_ok: o.result_ok,
6752                 }
6753         }
6754 }
6755 impl Clone for CResult_PongDecodeErrorZ {
6756         fn clone(&self) -> Self {
6757                 if self.result_ok {
6758                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
6759                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
6760                         } }
6761                 } else {
6762                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ which has the same data as `orig`
6770 /// but with all dynamically-allocated buffers duplicated in new buffers.
6771 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
6772 #[repr(C)]
6773 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6774 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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::UnsignedChannelAnnouncement,
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_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6784 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ {
6787         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6788         /// `err` or `result` depending on the state of `result_ok`.
6789         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
6790         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6791         pub result_ok: bool,
6792 }
6793 #[no_mangle]
6794 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
6795 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6796         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6797                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6798                         result: Box::into_raw(Box::new(o)),
6799                 },
6800                 result_ok: true,
6801         }
6802 }
6803 #[no_mangle]
6804 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
6805 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6806         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6807                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ.
6815 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
6816 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
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::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6830         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
6835                 } else {
6836                         let err = unsafe { o.contents.err };
6837                         unsafe { o.contents.err = std::ptr::null_mut(); }
6838                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
6839                 };
6840                 Self {
6841                         contents,
6842                         result_ok: o.result_ok,
6843                 }
6844         }
6845 }
6846 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6847         fn clone(&self) -> Self {
6848                 if self.result_ok {
6849                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6850                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6851                         } }
6852                 } else {
6853                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
6861 /// but with all dynamically-allocated buffers duplicated in new buffers.
6862 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
6863 #[repr(C)]
6864 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
6865 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
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::ChannelAnnouncement,
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_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6875 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ {
6878         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6879         /// `err` or `result` depending on the state of `result_ok`.
6880         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
6881         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6882         pub result_ok: bool,
6883 }
6884 #[no_mangle]
6885 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
6886 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
6887         CResult_ChannelAnnouncementDecodeErrorZ {
6888                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6889                         result: Box::into_raw(Box::new(o)),
6890                 },
6891                 result_ok: true,
6892         }
6893 }
6894 #[no_mangle]
6895 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
6896 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
6897         CResult_ChannelAnnouncementDecodeErrorZ {
6898                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ.
6906 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
6907 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
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::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
6921         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, 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_ChannelAnnouncementDecodeErrorZPtr { result }
6926                 } else {
6927                         let err = unsafe { o.contents.err };
6928                         unsafe { o.contents.err = std::ptr::null_mut(); }
6929                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
6930                 };
6931                 Self {
6932                         contents,
6933                         result_ok: o.result_ok,
6934                 }
6935         }
6936 }
6937 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
6938         fn clone(&self) -> Self {
6939                 if self.result_ok {
6940                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6941                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6942                         } }
6943                 } else {
6944                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
6954 #[repr(C)]
6955 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6956 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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::UnsignedChannelUpdate,
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_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6966 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate 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_UnsignedChannelUpdateDecodeErrorZ {
6969         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6970         /// `err` or `result` depending on the state of `result_ok`.
6971         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
6972         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6973         pub result_ok: bool,
6974 }
6975 #[no_mangle]
6976 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
6977 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6978         CResult_UnsignedChannelUpdateDecodeErrorZ {
6979                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6980                         result: Box::into_raw(Box::new(o)),
6981                 },
6982                 result_ok: true,
6983         }
6984 }
6985 #[no_mangle]
6986 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
6987 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6988         CResult_UnsignedChannelUpdateDecodeErrorZ {
6989                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ.
6997 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
6998 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
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::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
7012         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, 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_UnsignedChannelUpdateDecodeErrorZPtr { result }
7017                 } else {
7018                         let err = unsafe { o.contents.err };
7019                         unsafe { o.contents.err = std::ptr::null_mut(); }
7020                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
7021                 };
7022                 Self {
7023                         contents,
7024                         result_ok: o.result_ok,
7025                 }
7026         }
7027 }
7028 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
7029         fn clone(&self) -> Self {
7030                 if self.result_ok {
7031                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7032                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
7033                         } }
7034                 } else {
7035                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
7043 /// but with all dynamically-allocated buffers duplicated in new buffers.
7044 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
7045 #[repr(C)]
7046 /// The contents of CResult_ChannelUpdateDecodeErrorZ
7047 pub union CResult_ChannelUpdateDecodeErrorZPtr {
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::ChannelUpdate,
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_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7057 /// containing a crate::lightning::ln::msgs::ChannelUpdate 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_ChannelUpdateDecodeErrorZ {
7060         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7061         /// `err` or `result` depending on the state of `result_ok`.
7062         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
7063         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7064         pub result_ok: bool,
7065 }
7066 #[no_mangle]
7067 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
7068 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
7069         CResult_ChannelUpdateDecodeErrorZ {
7070                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7071                         result: Box::into_raw(Box::new(o)),
7072                 },
7073                 result_ok: true,
7074         }
7075 }
7076 #[no_mangle]
7077 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
7078 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
7079         CResult_ChannelUpdateDecodeErrorZ {
7080                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
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_ChannelUpdateDecodeErrorZ.
7088 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
7089 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
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::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
7103         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, 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_ChannelUpdateDecodeErrorZPtr { result }
7108                 } else {
7109                         let err = unsafe { o.contents.err };
7110                         unsafe { o.contents.err = std::ptr::null_mut(); }
7111                         CResult_ChannelUpdateDecodeErrorZPtr { err }
7112                 };
7113                 Self {
7114                         contents,
7115                         result_ok: o.result_ok,
7116                 }
7117         }
7118 }
7119 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
7120         fn clone(&self) -> Self {
7121                 if self.result_ok {
7122                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7123                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
7124                         } }
7125                 } else {
7126                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
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_ChannelUpdateDecodeErrorZ which has the same data as `orig`
7134 /// but with all dynamically-allocated buffers duplicated in new buffers.
7135 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
7136 #[repr(C)]
7137 /// The contents of CResult_ErrorMessageDecodeErrorZ
7138 pub union CResult_ErrorMessageDecodeErrorZPtr {
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::ErrorMessage,
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_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7148 /// containing a crate::lightning::ln::msgs::ErrorMessage 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_ErrorMessageDecodeErrorZ {
7151         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7152         /// `err` or `result` depending on the state of `result_ok`.
7153         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
7154         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7155         pub result_ok: bool,
7156 }
7157 #[no_mangle]
7158 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
7159 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
7160         CResult_ErrorMessageDecodeErrorZ {
7161                 contents: CResult_ErrorMessageDecodeErrorZPtr {
7162                         result: Box::into_raw(Box::new(o)),
7163                 },
7164                 result_ok: true,
7165         }
7166 }
7167 #[no_mangle]
7168 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
7169 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
7170         CResult_ErrorMessageDecodeErrorZ {
7171                 contents: CResult_ErrorMessageDecodeErrorZPtr {
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_ErrorMessageDecodeErrorZ.
7179 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
7180 impl Drop for CResult_ErrorMessageDecodeErrorZ {
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::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
7194         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, 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_ErrorMessageDecodeErrorZPtr { result }
7199                 } else {
7200                         let err = unsafe { o.contents.err };
7201                         unsafe { o.contents.err = std::ptr::null_mut(); }
7202                         CResult_ErrorMessageDecodeErrorZPtr { err }
7203                 };
7204                 Self {
7205                         contents,
7206                         result_ok: o.result_ok,
7207                 }
7208         }
7209 }
7210 impl Clone for CResult_ErrorMessageDecodeErrorZ {
7211         fn clone(&self) -> Self {
7212                 if self.result_ok {
7213                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
7214                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
7215                         } }
7216                 } else {
7217                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
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_ErrorMessageDecodeErrorZ which has the same data as `orig`
7225 /// but with all dynamically-allocated buffers duplicated in new buffers.
7226 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
7227 #[repr(C)]
7228 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
7229 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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::UnsignedNodeAnnouncement,
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_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7239 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement 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_UnsignedNodeAnnouncementDecodeErrorZ {
7242         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
7243         /// `err` or `result` depending on the state of `result_ok`.
7244         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
7245         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
7246         pub result_ok: bool,
7247 }
7248 #[no_mangle]
7249 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
7250 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7251         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7252                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7253                         result: Box::into_raw(Box::new(o)),
7254                 },
7255                 result_ok: true,
7256         }
7257 }
7258 #[no_mangle]
7259 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
7260 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7261         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7262                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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_UnsignedNodeAnnouncementDecodeErrorZ.
7270 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
7271 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
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::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7285         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, 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_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
7290                 } else {
7291                         let err = unsafe { o.contents.err };
7292                         unsafe { o.contents.err = std::ptr::null_mut(); }
7293                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
7294                 };
7295                 Self {
7296                         contents,
7297                         result_ok: o.result_ok,
7298                 }
7299         }
7300 }
7301 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7302         fn clone(&self) -> Self {
7303                 if self.result_ok {
7304                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7305                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
7306                         } }
7307                 } else {
7308                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
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_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
7316 /// but with all dynamically-allocated buffers duplicated in new buffers.
7317 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
7318 #[repr(C)]
7319 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
7320 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
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::NodeAnnouncement,
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_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7330 /// containing a crate::lightning::ln::msgs::NodeAnnouncement 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_NodeAnnouncementDecodeErrorZ {
7333         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
7334         /// `err` or `result` depending on the state of `result_ok`.
7335         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
7336         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
7337         pub result_ok: bool,
7338 }
7339 #[no_mangle]
7340 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
7341 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
7342         CResult_NodeAnnouncementDecodeErrorZ {
7343                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7344                         result: Box::into_raw(Box::new(o)),
7345                 },
7346                 result_ok: true,
7347         }
7348 }
7349 #[no_mangle]
7350 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
7351 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
7352         CResult_NodeAnnouncementDecodeErrorZ {
7353                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
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_NodeAnnouncementDecodeErrorZ.
7361 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
7362 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
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::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
7376         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, 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_NodeAnnouncementDecodeErrorZPtr { result }
7381                 } else {
7382                         let err = unsafe { o.contents.err };
7383                         unsafe { o.contents.err = std::ptr::null_mut(); }
7384                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
7385                 };
7386                 Self {
7387                         contents,
7388                         result_ok: o.result_ok,
7389                 }
7390         }
7391 }
7392 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
7393         fn clone(&self) -> Self {
7394                 if self.result_ok {
7395                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7396                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
7397                         } }
7398                 } else {
7399                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
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_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
7407 /// but with all dynamically-allocated buffers duplicated in new buffers.
7408 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
7409 #[repr(C)]
7410 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
7411 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
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::QueryShortChannelIds,
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_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
7421 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds 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_QueryShortChannelIdsDecodeErrorZ {
7424         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
7425         /// `err` or `result` depending on the state of `result_ok`.
7426         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
7427         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
7428         pub result_ok: bool,
7429 }
7430 #[no_mangle]
7431 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
7432 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
7433         CResult_QueryShortChannelIdsDecodeErrorZ {
7434                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7435                         result: Box::into_raw(Box::new(o)),
7436                 },
7437                 result_ok: true,
7438         }
7439 }
7440 #[no_mangle]
7441 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
7442 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
7443         CResult_QueryShortChannelIdsDecodeErrorZ {
7444                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
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_QueryShortChannelIdsDecodeErrorZ.
7452 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
7453 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
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::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
7467         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, 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_QueryShortChannelIdsDecodeErrorZPtr { result }
7472                 } else {
7473                         let err = unsafe { o.contents.err };
7474                         unsafe { o.contents.err = std::ptr::null_mut(); }
7475                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
7476                 };
7477                 Self {
7478                         contents,
7479                         result_ok: o.result_ok,
7480                 }
7481         }
7482 }
7483 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
7484         fn clone(&self) -> Self {
7485                 if self.result_ok {
7486                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7487                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
7488                         } }
7489                 } else {
7490                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
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_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
7498 /// but with all dynamically-allocated buffers duplicated in new buffers.
7499 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
7500 #[repr(C)]
7501 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
7502 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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::ReplyShortChannelIdsEnd,
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_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
7512 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd 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_ReplyShortChannelIdsEndDecodeErrorZ {
7515         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
7516         /// `err` or `result` depending on the state of `result_ok`.
7517         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
7518         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
7519         pub result_ok: bool,
7520 }
7521 #[no_mangle]
7522 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
7523 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7524         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7525                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7526                         result: Box::into_raw(Box::new(o)),
7527                 },
7528                 result_ok: true,
7529         }
7530 }
7531 #[no_mangle]
7532 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
7533 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7534         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7535                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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_ReplyShortChannelIdsEndDecodeErrorZ.
7543 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
7544 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
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::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7558         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, 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_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
7563                 } else {
7564                         let err = unsafe { o.contents.err };
7565                         unsafe { o.contents.err = std::ptr::null_mut(); }
7566                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
7567                 };
7568                 Self {
7569                         contents,
7570                         result_ok: o.result_ok,
7571                 }
7572         }
7573 }
7574 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7575         fn clone(&self) -> Self {
7576                 if self.result_ok {
7577                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7578                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
7579                         } }
7580                 } else {
7581                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
7589 /// but with all dynamically-allocated buffers duplicated in new buffers.
7590 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
7591 #[repr(C)]
7592 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
7593 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
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::QueryChannelRange,
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_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
7603 /// containing a crate::lightning::ln::msgs::QueryChannelRange 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_QueryChannelRangeDecodeErrorZ {
7606         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
7607         /// `err` or `result` depending on the state of `result_ok`.
7608         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
7609         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
7610         pub result_ok: bool,
7611 }
7612 #[no_mangle]
7613 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
7614 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
7615         CResult_QueryChannelRangeDecodeErrorZ {
7616                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7617                         result: Box::into_raw(Box::new(o)),
7618                 },
7619                 result_ok: true,
7620         }
7621 }
7622 #[no_mangle]
7623 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
7624 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
7625         CResult_QueryChannelRangeDecodeErrorZ {
7626                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
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_QueryChannelRangeDecodeErrorZ.
7634 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
7635 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
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::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
7649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, 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_QueryChannelRangeDecodeErrorZPtr { result }
7654                 } else {
7655                         let err = unsafe { o.contents.err };
7656                         unsafe { o.contents.err = std::ptr::null_mut(); }
7657                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
7658                 };
7659                 Self {
7660                         contents,
7661                         result_ok: o.result_ok,
7662                 }
7663         }
7664 }
7665 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
7666         fn clone(&self) -> Self {
7667                 if self.result_ok {
7668                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7669                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
7670                         } }
7671                 } else {
7672                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
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_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
7680 /// but with all dynamically-allocated buffers duplicated in new buffers.
7681 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
7682 #[repr(C)]
7683 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
7684 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
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::ReplyChannelRange,
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_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
7694 /// containing a crate::lightning::ln::msgs::ReplyChannelRange 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_ReplyChannelRangeDecodeErrorZ {
7697         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
7698         /// `err` or `result` depending on the state of `result_ok`.
7699         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
7700         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
7701         pub result_ok: bool,
7702 }
7703 #[no_mangle]
7704 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
7705 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
7706         CResult_ReplyChannelRangeDecodeErrorZ {
7707                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7708                         result: Box::into_raw(Box::new(o)),
7709                 },
7710                 result_ok: true,
7711         }
7712 }
7713 #[no_mangle]
7714 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
7715 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
7716         CResult_ReplyChannelRangeDecodeErrorZ {
7717                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
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_ReplyChannelRangeDecodeErrorZ.
7725 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
7726 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
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::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
7740         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, 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_ReplyChannelRangeDecodeErrorZPtr { result }
7745                 } else {
7746                         let err = unsafe { o.contents.err };
7747                         unsafe { o.contents.err = std::ptr::null_mut(); }
7748                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
7749                 };
7750                 Self {
7751                         contents,
7752                         result_ok: o.result_ok,
7753                 }
7754         }
7755 }
7756 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
7757         fn clone(&self) -> Self {
7758                 if self.result_ok {
7759                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7760                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
7761                         } }
7762                 } else {
7763                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
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_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
7771 /// but with all dynamically-allocated buffers duplicated in new buffers.
7772 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
7773 #[repr(C)]
7774 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
7775 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
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::GossipTimestampFilter,
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_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
7785 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter 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_GossipTimestampFilterDecodeErrorZ {
7788         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
7789         /// `err` or `result` depending on the state of `result_ok`.
7790         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
7791         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
7792         pub result_ok: bool,
7793 }
7794 #[no_mangle]
7795 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
7796 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
7797         CResult_GossipTimestampFilterDecodeErrorZ {
7798                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7799                         result: Box::into_raw(Box::new(o)),
7800                 },
7801                 result_ok: true,
7802         }
7803 }
7804 #[no_mangle]
7805 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
7806 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
7807         CResult_GossipTimestampFilterDecodeErrorZ {
7808                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
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_GossipTimestampFilterDecodeErrorZ.
7816 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
7817 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
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::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
7831         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, 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_GossipTimestampFilterDecodeErrorZPtr { result }
7836                 } else {
7837                         let err = unsafe { o.contents.err };
7838                         unsafe { o.contents.err = std::ptr::null_mut(); }
7839                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
7840                 };
7841                 Self {
7842                         contents,
7843                         result_ok: o.result_ok,
7844                 }
7845         }
7846 }
7847 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
7848         fn clone(&self) -> Self {
7849                 if self.result_ok {
7850                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7851                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
7852                         } }
7853                 } else {
7854                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
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_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
7862 /// but with all dynamically-allocated buffers duplicated in new buffers.
7863 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
7864 #[repr(C)]
7865 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7866 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
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::chain::keysinterface::SpendableOutputDescriptor,
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_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7876 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor 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_SpendableOutputDescriptorDecodeErrorZ {
7879         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7880         /// `err` or `result` depending on the state of `result_ok`.
7881         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
7882         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7883         pub result_ok: bool,
7884 }
7885 #[no_mangle]
7886 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
7887 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7888         CResult_SpendableOutputDescriptorDecodeErrorZ {
7889                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7890                         result: Box::into_raw(Box::new(o)),
7891                 },
7892                 result_ok: true,
7893         }
7894 }
7895 #[no_mangle]
7896 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
7897 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7898         CResult_SpendableOutputDescriptorDecodeErrorZ {
7899                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
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_SpendableOutputDescriptorDecodeErrorZ.
7907 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
7908 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
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::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
7922         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, 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_SpendableOutputDescriptorDecodeErrorZPtr { result }
7927                 } else {
7928                         let err = unsafe { o.contents.err };
7929                         unsafe { o.contents.err = std::ptr::null_mut(); }
7930                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
7931                 };
7932                 Self {
7933                         contents,
7934                         result_ok: o.result_ok,
7935                 }
7936         }
7937 }
7938 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
7939         fn clone(&self) -> Self {
7940                 if self.result_ok {
7941                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7942                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7943                         } }
7944                 } else {
7945                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
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_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
7953 /// but with all dynamically-allocated buffers duplicated in new buffers.
7954 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
7955 #[repr(C)]
7956 /// A tuple of 2 elements. See the individual fields for the types contained.
7957 pub struct C2Tuple_SignatureCVec_SignatureZZ {
7958         /// The element at position 0
7959         pub a: crate::c_types::Signature,
7960         /// The element at position 1
7961         pub b: crate::c_types::derived::CVec_SignatureZ,
7962 }
7963 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
7964         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
7965                 Self {
7966                         a: tup.0,
7967                         b: tup.1,
7968                 }
7969         }
7970 }
7971 impl C2Tuple_SignatureCVec_SignatureZZ {
7972         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
7973                 (self.a, self.b)
7974         }
7975 }
7976 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
7977         fn clone(&self) -> Self {
7978                 Self {
7979                         a: self.a.clone(),
7980                         b: self.b.clone(),
7981                 }
7982         }
7983 }
7984 #[no_mangle]
7985 /// Creates a new tuple which has the same data as `orig`
7986 /// but with all dynamically-allocated buffers duplicated in new buffers.
7987 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
7988 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
7989 #[no_mangle]
7990 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
7991         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
7992 }
7993
7994 #[no_mangle]
7995 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
7996 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
7997 #[repr(C)]
7998 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7999 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8000         /// A pointer to the contents in the success state.
8001         /// Reading from this pointer when `result_ok` is not set is undefined.
8002         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
8003         /// Note that this value is always NULL, as there are no contents in the Err variant
8004         pub err: *mut std::ffi::c_void,
8005 }
8006 #[repr(C)]
8007 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
8008 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
8009 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8010 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8011         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
8012         /// `err` or `result` depending on the state of `result_ok`.
8013         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
8014         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
8015         pub result_ok: bool,
8016 }
8017 #[no_mangle]
8018 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
8019 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8020         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8021                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8022                         result: Box::into_raw(Box::new(o)),
8023                 },
8024                 result_ok: true,
8025         }
8026 }
8027 #[no_mangle]
8028 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
8029 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8030         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8031                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8032                         err: std::ptr::null_mut(),
8033                 },
8034                 result_ok: false,
8035         }
8036 }
8037 #[no_mangle]
8038 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
8039 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
8040 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8041         fn drop(&mut self) {
8042                 if self.result_ok {
8043                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8044                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8045                         }
8046                 } else {
8047                 }
8048         }
8049 }
8050 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8051         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
8052                 let contents = if o.result_ok {
8053                         let result = unsafe { o.contents.result };
8054                         unsafe { o.contents.result = std::ptr::null_mut() };
8055                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
8056                 } else {
8057                         let _ = unsafe { Box::from_raw(o.contents.err) };
8058                         o.contents.err = std::ptr::null_mut();
8059                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
8060                 };
8061                 Self {
8062                         contents,
8063                         result_ok: o.result_ok,
8064                 }
8065         }
8066 }
8067 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8068         fn clone(&self) -> Self {
8069                 if self.result_ok {
8070                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8071                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
8072                         } }
8073                 } else {
8074                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8075                                 err: std::ptr::null_mut()
8076                         } }
8077                 }
8078         }
8079 }
8080 #[no_mangle]
8081 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
8082 /// but with all dynamically-allocated buffers duplicated in new buffers.
8083 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
8084 #[repr(C)]
8085 /// The contents of CResult_SignatureNoneZ
8086 pub union CResult_SignatureNoneZPtr {
8087         /// A pointer to the contents in the success state.
8088         /// Reading from this pointer when `result_ok` is not set is undefined.
8089         pub result: *mut crate::c_types::Signature,
8090         /// Note that this value is always NULL, as there are no contents in the Err variant
8091         pub err: *mut std::ffi::c_void,
8092 }
8093 #[repr(C)]
8094 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
8095 /// containing a crate::c_types::Signature on success and a () on failure.
8096 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8097 pub struct CResult_SignatureNoneZ {
8098         /// The contents of this CResult_SignatureNoneZ, accessible via either
8099         /// `err` or `result` depending on the state of `result_ok`.
8100         pub contents: CResult_SignatureNoneZPtr,
8101         /// Whether this CResult_SignatureNoneZ represents a success state.
8102         pub result_ok: bool,
8103 }
8104 #[no_mangle]
8105 /// Creates a new CResult_SignatureNoneZ in the success state.
8106 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
8107         CResult_SignatureNoneZ {
8108                 contents: CResult_SignatureNoneZPtr {
8109                         result: Box::into_raw(Box::new(o)),
8110                 },
8111                 result_ok: true,
8112         }
8113 }
8114 #[no_mangle]
8115 /// Creates a new CResult_SignatureNoneZ in the error state.
8116 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
8117         CResult_SignatureNoneZ {
8118                 contents: CResult_SignatureNoneZPtr {
8119                         err: std::ptr::null_mut(),
8120                 },
8121                 result_ok: false,
8122         }
8123 }
8124 #[no_mangle]
8125 /// Frees any resources used by the CResult_SignatureNoneZ.
8126 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
8127 impl Drop for CResult_SignatureNoneZ {
8128         fn drop(&mut self) {
8129                 if self.result_ok {
8130                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8131                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8132                         }
8133                 } else {
8134                 }
8135         }
8136 }
8137 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
8138         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
8139                 let contents = if o.result_ok {
8140                         let result = unsafe { o.contents.result };
8141                         unsafe { o.contents.result = std::ptr::null_mut() };
8142                         CResult_SignatureNoneZPtr { result }
8143                 } else {
8144                         let _ = unsafe { Box::from_raw(o.contents.err) };
8145                         o.contents.err = std::ptr::null_mut();
8146                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
8147                 };
8148                 Self {
8149                         contents,
8150                         result_ok: o.result_ok,
8151                 }
8152         }
8153 }
8154 impl Clone for CResult_SignatureNoneZ {
8155         fn clone(&self) -> Self {
8156                 if self.result_ok {
8157                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
8158                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
8159                         } }
8160                 } else {
8161                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
8162                                 err: std::ptr::null_mut()
8163                         } }
8164                 }
8165         }
8166 }
8167 #[no_mangle]
8168 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
8169 /// but with all dynamically-allocated buffers duplicated in new buffers.
8170 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
8171 #[repr(C)]
8172 /// The contents of CResult_SignDecodeErrorZ
8173 pub union CResult_SignDecodeErrorZPtr {
8174         /// A pointer to the contents in the success state.
8175         /// Reading from this pointer when `result_ok` is not set is undefined.
8176         pub result: *mut crate::lightning::chain::keysinterface::Sign,
8177         /// A pointer to the contents in the error state.
8178         /// Reading from this pointer when `result_ok` is set is undefined.
8179         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8180 }
8181 #[repr(C)]
8182 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
8183 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
8184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8185 pub struct CResult_SignDecodeErrorZ {
8186         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
8187         /// `err` or `result` depending on the state of `result_ok`.
8188         pub contents: CResult_SignDecodeErrorZPtr,
8189         /// Whether this CResult_SignDecodeErrorZ represents a success state.
8190         pub result_ok: bool,
8191 }
8192 #[no_mangle]
8193 /// Creates a new CResult_SignDecodeErrorZ in the success state.
8194 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
8195         CResult_SignDecodeErrorZ {
8196                 contents: CResult_SignDecodeErrorZPtr {
8197                         result: Box::into_raw(Box::new(o)),
8198                 },
8199                 result_ok: true,
8200         }
8201 }
8202 #[no_mangle]
8203 /// Creates a new CResult_SignDecodeErrorZ in the error state.
8204 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
8205         CResult_SignDecodeErrorZ {
8206                 contents: CResult_SignDecodeErrorZPtr {
8207                         err: Box::into_raw(Box::new(e)),
8208                 },
8209                 result_ok: false,
8210         }
8211 }
8212 #[no_mangle]
8213 /// Frees any resources used by the CResult_SignDecodeErrorZ.
8214 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
8215 impl Drop for CResult_SignDecodeErrorZ {
8216         fn drop(&mut self) {
8217                 if self.result_ok {
8218                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8219                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8220                         }
8221                 } else {
8222                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8223                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8224                         }
8225                 }
8226         }
8227 }
8228 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
8229         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
8230                 let contents = if o.result_ok {
8231                         let result = unsafe { o.contents.result };
8232                         unsafe { o.contents.result = std::ptr::null_mut() };
8233                         CResult_SignDecodeErrorZPtr { result }
8234                 } else {
8235                         let err = unsafe { o.contents.err };
8236                         unsafe { o.contents.err = std::ptr::null_mut(); }
8237                         CResult_SignDecodeErrorZPtr { err }
8238                 };
8239                 Self {
8240                         contents,
8241                         result_ok: o.result_ok,
8242                 }
8243         }
8244 }
8245 impl Clone for CResult_SignDecodeErrorZ {
8246         fn clone(&self) -> Self {
8247                 if self.result_ok {
8248                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
8249                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
8250                         } }
8251                 } else {
8252                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
8253                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8254                         } }
8255                 }
8256         }
8257 }
8258 #[no_mangle]
8259 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
8260 /// but with all dynamically-allocated buffers duplicated in new buffers.
8261 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
8262 #[repr(C)]
8263 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8264 /// This corresponds to std::vector in C++
8265 pub struct CVec_CVec_u8ZZ {
8266         /// The elements in the array.
8267         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8268         pub data: *mut crate::c_types::derived::CVec_u8Z,
8269         /// The number of elements pointed to by `data`.
8270         pub datalen: usize
8271 }
8272 impl CVec_CVec_u8ZZ {
8273         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
8274                 if self.datalen == 0 { return Vec::new(); }
8275                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8276                 self.data = std::ptr::null_mut();
8277                 self.datalen = 0;
8278                 ret
8279         }
8280         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
8281                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8282         }
8283 }
8284 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
8285         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
8286                 let datalen = v.len();
8287                 let data = Box::into_raw(v.into_boxed_slice());
8288                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8289         }
8290 }
8291 #[no_mangle]
8292 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8293 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
8294 impl Drop for CVec_CVec_u8ZZ {
8295         fn drop(&mut self) {
8296                 if self.datalen == 0 { return; }
8297                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8298         }
8299 }
8300 impl Clone for CVec_CVec_u8ZZ {
8301         fn clone(&self) -> Self {
8302                 let mut res = Vec::new();
8303                 if self.datalen == 0 { return Self::from(res); }
8304                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8305                 Self::from(res)
8306         }
8307 }
8308 #[repr(C)]
8309 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
8310 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
8311         /// A pointer to the contents in the success state.
8312         /// Reading from this pointer when `result_ok` is not set is undefined.
8313         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
8314         /// Note that this value is always NULL, as there are no contents in the Err variant
8315         pub err: *mut std::ffi::c_void,
8316 }
8317 #[repr(C)]
8318 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8319 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8321 pub struct CResult_CVec_CVec_u8ZZNoneZ {
8322         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8323         /// `err` or `result` depending on the state of `result_ok`.
8324         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
8325         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8326         pub result_ok: bool,
8327 }
8328 #[no_mangle]
8329 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8330 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
8331         CResult_CVec_CVec_u8ZZNoneZ {
8332                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8333                         result: Box::into_raw(Box::new(o)),
8334                 },
8335                 result_ok: true,
8336         }
8337 }
8338 #[no_mangle]
8339 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8340 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
8341         CResult_CVec_CVec_u8ZZNoneZ {
8342                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8343                         err: std::ptr::null_mut(),
8344                 },
8345                 result_ok: false,
8346         }
8347 }
8348 #[no_mangle]
8349 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8350 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
8351 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
8352         fn drop(&mut self) {
8353                 if self.result_ok {
8354                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8355                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8356                         }
8357                 } else {
8358                 }
8359         }
8360 }
8361 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
8362         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
8363                 let contents = if o.result_ok {
8364                         let result = unsafe { o.contents.result };
8365                         unsafe { o.contents.result = std::ptr::null_mut() };
8366                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
8367                 } else {
8368                         let _ = unsafe { Box::from_raw(o.contents.err) };
8369                         o.contents.err = std::ptr::null_mut();
8370                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
8371                 };
8372                 Self {
8373                         contents,
8374                         result_ok: o.result_ok,
8375                 }
8376         }
8377 }
8378 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
8379         fn clone(&self) -> Self {
8380                 if self.result_ok {
8381                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8382                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
8383                         } }
8384                 } else {
8385                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8386                                 err: std::ptr::null_mut()
8387                         } }
8388                 }
8389         }
8390 }
8391 #[no_mangle]
8392 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8393 /// but with all dynamically-allocated buffers duplicated in new buffers.
8394 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
8395 #[repr(C)]
8396 /// The contents of CResult_InMemorySignerDecodeErrorZ
8397 pub union CResult_InMemorySignerDecodeErrorZPtr {
8398         /// A pointer to the contents in the success state.
8399         /// Reading from this pointer when `result_ok` is not set is undefined.
8400         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
8401         /// A pointer to the contents in the error state.
8402         /// Reading from this pointer when `result_ok` is set is undefined.
8403         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8404 }
8405 #[repr(C)]
8406 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8407 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8408 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8409 pub struct CResult_InMemorySignerDecodeErrorZ {
8410         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8411         /// `err` or `result` depending on the state of `result_ok`.
8412         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
8413         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8414         pub result_ok: bool,
8415 }
8416 #[no_mangle]
8417 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8418 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
8419         CResult_InMemorySignerDecodeErrorZ {
8420                 contents: CResult_InMemorySignerDecodeErrorZPtr {
8421                         result: Box::into_raw(Box::new(o)),
8422                 },
8423                 result_ok: true,
8424         }
8425 }
8426 #[no_mangle]
8427 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8428 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
8429         CResult_InMemorySignerDecodeErrorZ {
8430                 contents: CResult_InMemorySignerDecodeErrorZPtr {
8431                         err: Box::into_raw(Box::new(e)),
8432                 },
8433                 result_ok: false,
8434         }
8435 }
8436 #[no_mangle]
8437 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8438 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
8439 impl Drop for CResult_InMemorySignerDecodeErrorZ {
8440         fn drop(&mut self) {
8441                 if self.result_ok {
8442                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8443                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8444                         }
8445                 } else {
8446                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8447                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8448                         }
8449                 }
8450         }
8451 }
8452 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
8453         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8454                 let contents = if o.result_ok {
8455                         let result = unsafe { o.contents.result };
8456                         unsafe { o.contents.result = std::ptr::null_mut() };
8457                         CResult_InMemorySignerDecodeErrorZPtr { result }
8458                 } else {
8459                         let err = unsafe { o.contents.err };
8460                         unsafe { o.contents.err = std::ptr::null_mut(); }
8461                         CResult_InMemorySignerDecodeErrorZPtr { err }
8462                 };
8463                 Self {
8464                         contents,
8465                         result_ok: o.result_ok,
8466                 }
8467         }
8468 }
8469 impl Clone for CResult_InMemorySignerDecodeErrorZ {
8470         fn clone(&self) -> Self {
8471                 if self.result_ok {
8472                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
8473                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
8474                         } }
8475                 } else {
8476                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
8477                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8478                         } }
8479                 }
8480         }
8481 }
8482 #[no_mangle]
8483 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8484 /// but with all dynamically-allocated buffers duplicated in new buffers.
8485 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
8486 #[repr(C)]
8487 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8488 /// This corresponds to std::vector in C++
8489 pub struct CVec_TxOutZ {
8490         /// The elements in the array.
8491         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8492         pub data: *mut crate::c_types::TxOut,
8493         /// The number of elements pointed to by `data`.
8494         pub datalen: usize
8495 }
8496 impl CVec_TxOutZ {
8497         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
8498                 if self.datalen == 0 { return Vec::new(); }
8499                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8500                 self.data = std::ptr::null_mut();
8501                 self.datalen = 0;
8502                 ret
8503         }
8504         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
8505                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8506         }
8507 }
8508 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
8509         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
8510                 let datalen = v.len();
8511                 let data = Box::into_raw(v.into_boxed_slice());
8512                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8513         }
8514 }
8515 #[no_mangle]
8516 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8517 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
8518 impl Drop for CVec_TxOutZ {
8519         fn drop(&mut self) {
8520                 if self.datalen == 0 { return; }
8521                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8522         }
8523 }
8524 impl Clone for CVec_TxOutZ {
8525         fn clone(&self) -> Self {
8526                 let mut res = Vec::new();
8527                 if self.datalen == 0 { return Self::from(res); }
8528                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8529                 Self::from(res)
8530         }
8531 }
8532 #[repr(C)]
8533 /// The contents of CResult_TransactionNoneZ
8534 pub union CResult_TransactionNoneZPtr {
8535         /// A pointer to the contents in the success state.
8536         /// Reading from this pointer when `result_ok` is not set is undefined.
8537         pub result: *mut crate::c_types::Transaction,
8538         /// Note that this value is always NULL, as there are no contents in the Err variant
8539         pub err: *mut std::ffi::c_void,
8540 }
8541 #[repr(C)]
8542 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
8543 /// containing a crate::c_types::Transaction on success and a () on failure.
8544 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8545 pub struct CResult_TransactionNoneZ {
8546         /// The contents of this CResult_TransactionNoneZ, accessible via either
8547         /// `err` or `result` depending on the state of `result_ok`.
8548         pub contents: CResult_TransactionNoneZPtr,
8549         /// Whether this CResult_TransactionNoneZ represents a success state.
8550         pub result_ok: bool,
8551 }
8552 #[no_mangle]
8553 /// Creates a new CResult_TransactionNoneZ in the success state.
8554 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
8555         CResult_TransactionNoneZ {
8556                 contents: CResult_TransactionNoneZPtr {
8557                         result: Box::into_raw(Box::new(o)),
8558                 },
8559                 result_ok: true,
8560         }
8561 }
8562 #[no_mangle]
8563 /// Creates a new CResult_TransactionNoneZ in the error state.
8564 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
8565         CResult_TransactionNoneZ {
8566                 contents: CResult_TransactionNoneZPtr {
8567                         err: std::ptr::null_mut(),
8568                 },
8569                 result_ok: false,
8570         }
8571 }
8572 #[no_mangle]
8573 /// Frees any resources used by the CResult_TransactionNoneZ.
8574 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
8575 impl Drop for CResult_TransactionNoneZ {
8576         fn drop(&mut self) {
8577                 if self.result_ok {
8578                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8579                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8580                         }
8581                 } else {
8582                 }
8583         }
8584 }
8585 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
8586         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
8587                 let contents = if o.result_ok {
8588                         let result = unsafe { o.contents.result };
8589                         unsafe { o.contents.result = std::ptr::null_mut() };
8590                         CResult_TransactionNoneZPtr { result }
8591                 } else {
8592                         let _ = unsafe { Box::from_raw(o.contents.err) };
8593                         o.contents.err = std::ptr::null_mut();
8594                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
8595                 };
8596                 Self {
8597                         contents,
8598                         result_ok: o.result_ok,
8599                 }
8600         }
8601 }
8602 #[repr(C)]
8603 /// The contents of CResult_NoneErrorZ
8604 pub union CResult_NoneErrorZPtr {
8605         /// Note that this value is always NULL, as there are no contents in the OK variant
8606         pub result: *mut std::ffi::c_void,
8607         /// A pointer to the contents in the error state.
8608         /// Reading from this pointer when `result_ok` is set is undefined.
8609         pub err: *mut crate::c_types::IOError,
8610 }
8611 #[repr(C)]
8612 /// A CResult_NoneErrorZ represents the result of a fallible operation,
8613 /// containing a () on success and a crate::c_types::IOError on failure.
8614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8615 pub struct CResult_NoneErrorZ {
8616         /// The contents of this CResult_NoneErrorZ, accessible via either
8617         /// `err` or `result` depending on the state of `result_ok`.
8618         pub contents: CResult_NoneErrorZPtr,
8619         /// Whether this CResult_NoneErrorZ represents a success state.
8620         pub result_ok: bool,
8621 }
8622 #[no_mangle]
8623 /// Creates a new CResult_NoneErrorZ in the success state.
8624 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
8625         CResult_NoneErrorZ {
8626                 contents: CResult_NoneErrorZPtr {
8627                         result: std::ptr::null_mut(),
8628                 },
8629                 result_ok: true,
8630         }
8631 }
8632 #[no_mangle]
8633 /// Creates a new CResult_NoneErrorZ in the error state.
8634 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
8635         CResult_NoneErrorZ {
8636                 contents: CResult_NoneErrorZPtr {
8637                         err: Box::into_raw(Box::new(e)),
8638                 },
8639                 result_ok: false,
8640         }
8641 }
8642 #[no_mangle]
8643 /// Frees any resources used by the CResult_NoneErrorZ.
8644 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
8645 impl Drop for CResult_NoneErrorZ {
8646         fn drop(&mut self) {
8647                 if self.result_ok {
8648                 } else {
8649                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8650                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8651                         }
8652                 }
8653         }
8654 }
8655 impl From<crate::c_types::CResultTempl<u8, crate::c_types::IOError>> for CResult_NoneErrorZ {
8656         fn from(mut o: crate::c_types::CResultTempl<u8, crate::c_types::IOError>) -> Self {
8657                 let contents = if o.result_ok {
8658                         let _ = unsafe { Box::from_raw(o.contents.result) };
8659                         o.contents.result = std::ptr::null_mut();
8660                         CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
8661                 } else {
8662                         let err = unsafe { o.contents.err };
8663                         unsafe { o.contents.err = std::ptr::null_mut(); }
8664                         CResult_NoneErrorZPtr { err }
8665                 };
8666                 Self {
8667                         contents,
8668                         result_ok: o.result_ok,
8669                 }
8670         }
8671 }
8672 #[repr(C)]
8673 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8674 /// This corresponds to std::vector in C++
8675 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8676         /// The elements in the array.
8677         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8678         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8679         /// The number of elements pointed to by `data`.
8680         pub datalen: usize
8681 }
8682 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8683         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8684                 if self.datalen == 0 { return Vec::new(); }
8685                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8686                 self.data = std::ptr::null_mut();
8687                 self.datalen = 0;
8688                 ret
8689         }
8690         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8691                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8692         }
8693 }
8694 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8695         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8696                 let datalen = v.len();
8697                 let data = Box::into_raw(v.into_boxed_slice());
8698                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8699         }
8700 }
8701 #[no_mangle]
8702 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8703 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8704 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8705         fn drop(&mut self) {
8706                 if self.datalen == 0 { return; }
8707                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8708         }
8709 }
8710 #[repr(C)]
8711 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8712 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8713         /// A pointer to the contents in the success state.
8714         /// Reading from this pointer when `result_ok` is not set is undefined.
8715         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8716         /// A pointer to the contents in the error state.
8717         /// Reading from this pointer when `result_ok` is set is undefined.
8718         pub err: *mut crate::c_types::IOError,
8719 }
8720 #[repr(C)]
8721 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8722 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8724 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8725         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8726         /// `err` or `result` depending on the state of `result_ok`.
8727         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8728         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8729         pub result_ok: bool,
8730 }
8731 #[no_mangle]
8732 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8733 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8734         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8735                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8736                         result: Box::into_raw(Box::new(o)),
8737                 },
8738                 result_ok: true,
8739         }
8740 }
8741 #[no_mangle]
8742 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8743 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8744         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8745                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8746                         err: Box::into_raw(Box::new(e)),
8747                 },
8748                 result_ok: false,
8749         }
8750 }
8751 #[no_mangle]
8752 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8753 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8754 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8755         fn drop(&mut self) {
8756                 if self.result_ok {
8757                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8758                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8759                         }
8760                 } else {
8761                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8762                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8763                         }
8764                 }
8765         }
8766 }
8767 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8768         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8769                 let contents = if o.result_ok {
8770                         let result = unsafe { o.contents.result };
8771                         unsafe { o.contents.result = std::ptr::null_mut() };
8772                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8773                 } else {
8774                         let err = unsafe { o.contents.err };
8775                         unsafe { o.contents.err = std::ptr::null_mut(); }
8776                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8777                 };
8778                 Self {
8779                         contents,
8780                         result_ok: o.result_ok,
8781                 }
8782         }
8783 }
8784 #[repr(C)]
8785 /// The contents of CResult_NoneAPIErrorZ
8786 pub union CResult_NoneAPIErrorZPtr {
8787         /// Note that this value is always NULL, as there are no contents in the OK variant
8788         pub result: *mut std::ffi::c_void,
8789         /// A pointer to the contents in the error state.
8790         /// Reading from this pointer when `result_ok` is set is undefined.
8791         pub err: *mut crate::lightning::util::errors::APIError,
8792 }
8793 #[repr(C)]
8794 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
8795 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
8796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8797 pub struct CResult_NoneAPIErrorZ {
8798         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
8799         /// `err` or `result` depending on the state of `result_ok`.
8800         pub contents: CResult_NoneAPIErrorZPtr,
8801         /// Whether this CResult_NoneAPIErrorZ represents a success state.
8802         pub result_ok: bool,
8803 }
8804 #[no_mangle]
8805 /// Creates a new CResult_NoneAPIErrorZ in the success state.
8806 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
8807         CResult_NoneAPIErrorZ {
8808                 contents: CResult_NoneAPIErrorZPtr {
8809                         result: std::ptr::null_mut(),
8810                 },
8811                 result_ok: true,
8812         }
8813 }
8814 #[no_mangle]
8815 /// Creates a new CResult_NoneAPIErrorZ in the error state.
8816 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
8817         CResult_NoneAPIErrorZ {
8818                 contents: CResult_NoneAPIErrorZPtr {
8819                         err: Box::into_raw(Box::new(e)),
8820                 },
8821                 result_ok: false,
8822         }
8823 }
8824 #[no_mangle]
8825 /// Frees any resources used by the CResult_NoneAPIErrorZ.
8826 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
8827 impl Drop for CResult_NoneAPIErrorZ {
8828         fn drop(&mut self) {
8829                 if self.result_ok {
8830                 } else {
8831                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8832                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8833                         }
8834                 }
8835         }
8836 }
8837 impl From<crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
8838         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>) -> Self {
8839                 let contents = if o.result_ok {
8840                         let _ = unsafe { Box::from_raw(o.contents.result) };
8841                         o.contents.result = std::ptr::null_mut();
8842                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
8843                 } else {
8844                         let err = unsafe { o.contents.err };
8845                         unsafe { o.contents.err = std::ptr::null_mut(); }
8846                         CResult_NoneAPIErrorZPtr { err }
8847                 };
8848                 Self {
8849                         contents,
8850                         result_ok: o.result_ok,
8851                 }
8852         }
8853 }
8854 impl Clone for CResult_NoneAPIErrorZ {
8855         fn clone(&self) -> Self {
8856                 if self.result_ok {
8857                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
8858                                 result: std::ptr::null_mut()
8859                         } }
8860                 } else {
8861                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
8862                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8863                         } }
8864                 }
8865         }
8866 }
8867 #[no_mangle]
8868 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8869 /// but with all dynamically-allocated buffers duplicated in new buffers.
8870 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
8871 #[repr(C)]
8872 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
8873 /// This corresponds to std::vector in C++
8874 pub struct CVec_CResult_NoneAPIErrorZZ {
8875         /// The elements in the array.
8876         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8877         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
8878         /// The number of elements pointed to by `data`.
8879         pub datalen: usize
8880 }
8881 impl CVec_CResult_NoneAPIErrorZZ {
8882         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
8883                 if self.datalen == 0 { return Vec::new(); }
8884                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8885                 self.data = std::ptr::null_mut();
8886                 self.datalen = 0;
8887                 ret
8888         }
8889         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
8890                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8891         }
8892 }
8893 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
8894         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
8895                 let datalen = v.len();
8896                 let data = Box::into_raw(v.into_boxed_slice());
8897                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8898         }
8899 }
8900 #[no_mangle]
8901 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8902 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
8903 impl Drop for CVec_CResult_NoneAPIErrorZZ {
8904         fn drop(&mut self) {
8905                 if self.datalen == 0 { return; }
8906                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8907         }
8908 }
8909 impl Clone for CVec_CResult_NoneAPIErrorZZ {
8910         fn clone(&self) -> Self {
8911                 let mut res = Vec::new();
8912                 if self.datalen == 0 { return Self::from(res); }
8913                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8914                 Self::from(res)
8915         }
8916 }
8917 #[repr(C)]
8918 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
8919 /// This corresponds to std::vector in C++
8920 pub struct CVec_APIErrorZ {
8921         /// The elements in the array.
8922         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8923         pub data: *mut crate::lightning::util::errors::APIError,
8924         /// The number of elements pointed to by `data`.
8925         pub datalen: usize
8926 }
8927 impl CVec_APIErrorZ {
8928         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
8929                 if self.datalen == 0 { return Vec::new(); }
8930                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8931                 self.data = std::ptr::null_mut();
8932                 self.datalen = 0;
8933                 ret
8934         }
8935         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
8936                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8937         }
8938 }
8939 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
8940         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
8941                 let datalen = v.len();
8942                 let data = Box::into_raw(v.into_boxed_slice());
8943                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8944         }
8945 }
8946 #[no_mangle]
8947 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8948 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
8949 impl Drop for CVec_APIErrorZ {
8950         fn drop(&mut self) {
8951                 if self.datalen == 0 { return; }
8952                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8953         }
8954 }
8955 impl Clone for CVec_APIErrorZ {
8956         fn clone(&self) -> Self {
8957                 let mut res = Vec::new();
8958                 if self.datalen == 0 { return Self::from(res); }
8959                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8960                 Self::from(res)
8961         }
8962 }
8963 #[repr(C)]
8964 /// The contents of CResult_NonePaymentSendFailureZ
8965 pub union CResult_NonePaymentSendFailureZPtr {
8966         /// Note that this value is always NULL, as there are no contents in the OK variant
8967         pub result: *mut std::ffi::c_void,
8968         /// A pointer to the contents in the error state.
8969         /// Reading from this pointer when `result_ok` is set is undefined.
8970         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8971 }
8972 #[repr(C)]
8973 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8974 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8976 pub struct CResult_NonePaymentSendFailureZ {
8977         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8978         /// `err` or `result` depending on the state of `result_ok`.
8979         pub contents: CResult_NonePaymentSendFailureZPtr,
8980         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8981         pub result_ok: bool,
8982 }
8983 #[no_mangle]
8984 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8985 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8986         CResult_NonePaymentSendFailureZ {
8987                 contents: CResult_NonePaymentSendFailureZPtr {
8988                         result: std::ptr::null_mut(),
8989                 },
8990                 result_ok: true,
8991         }
8992 }
8993 #[no_mangle]
8994 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8995 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8996         CResult_NonePaymentSendFailureZ {
8997                 contents: CResult_NonePaymentSendFailureZPtr {
8998                         err: Box::into_raw(Box::new(e)),
8999                 },
9000                 result_ok: false,
9001         }
9002 }
9003 #[no_mangle]
9004 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9005 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9006 impl Drop for CResult_NonePaymentSendFailureZ {
9007         fn drop(&mut self) {
9008                 if self.result_ok {
9009                 } else {
9010                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9011                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9012                         }
9013                 }
9014         }
9015 }
9016 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9017         fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
9018                 let contents = if o.result_ok {
9019                         let _ = unsafe { Box::from_raw(o.contents.result) };
9020                         o.contents.result = std::ptr::null_mut();
9021                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
9022                 } else {
9023                         let err = unsafe { o.contents.err };
9024                         unsafe { o.contents.err = std::ptr::null_mut(); }
9025                         CResult_NonePaymentSendFailureZPtr { err }
9026                 };
9027                 Self {
9028                         contents,
9029                         result_ok: o.result_ok,
9030                 }
9031         }
9032 }
9033 impl Clone for CResult_NonePaymentSendFailureZ {
9034         fn clone(&self) -> Self {
9035                 if self.result_ok {
9036                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9037                                 result: std::ptr::null_mut()
9038                         } }
9039                 } else {
9040                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9041                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9042                         } }
9043                 }
9044         }
9045 }
9046 #[no_mangle]
9047 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9048 /// but with all dynamically-allocated buffers duplicated in new buffers.
9049 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
9050 #[repr(C)]
9051 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9052 /// This corresponds to std::vector in C++
9053 pub struct CVec_ChannelMonitorZ {
9054         /// The elements in the array.
9055         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9056         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9057         /// The number of elements pointed to by `data`.
9058         pub datalen: usize
9059 }
9060 impl CVec_ChannelMonitorZ {
9061         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9062                 if self.datalen == 0 { return Vec::new(); }
9063                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9064                 self.data = std::ptr::null_mut();
9065                 self.datalen = 0;
9066                 ret
9067         }
9068         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9069                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9070         }
9071 }
9072 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9073         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9074                 let datalen = v.len();
9075                 let data = Box::into_raw(v.into_boxed_slice());
9076                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9077         }
9078 }
9079 #[no_mangle]
9080 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9081 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9082 impl Drop for CVec_ChannelMonitorZ {
9083         fn drop(&mut self) {
9084                 if self.datalen == 0 { return; }
9085                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9086         }
9087 }
9088 #[repr(C)]
9089 /// A tuple of 2 elements. See the individual fields for the types contained.
9090 pub struct C2Tuple_BlockHashChannelManagerZ {
9091         /// The element at position 0
9092         pub a: crate::c_types::ThirtyTwoBytes,
9093         /// The element at position 1
9094         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9095 }
9096 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9097         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9098                 Self {
9099                         a: tup.0,
9100                         b: tup.1,
9101                 }
9102         }
9103 }
9104 impl C2Tuple_BlockHashChannelManagerZ {
9105         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9106                 (self.a, self.b)
9107         }
9108 }
9109 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9110 #[no_mangle]
9111 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9112         C2Tuple_BlockHashChannelManagerZ { a, b, }
9113 }
9114
9115 #[no_mangle]
9116 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9117 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9118 #[repr(C)]
9119 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9120 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9121         /// A pointer to the contents in the success state.
9122         /// Reading from this pointer when `result_ok` is not set is undefined.
9123         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9124         /// A pointer to the contents in the error state.
9125         /// Reading from this pointer when `result_ok` is set is undefined.
9126         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9127 }
9128 #[repr(C)]
9129 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9130 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9132 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9133         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9134         /// `err` or `result` depending on the state of `result_ok`.
9135         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9136         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9137         pub result_ok: bool,
9138 }
9139 #[no_mangle]
9140 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9141 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9142         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9143                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9144                         result: Box::into_raw(Box::new(o)),
9145                 },
9146                 result_ok: true,
9147         }
9148 }
9149 #[no_mangle]
9150 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9151 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9152         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9153                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9154                         err: Box::into_raw(Box::new(e)),
9155                 },
9156                 result_ok: false,
9157         }
9158 }
9159 #[no_mangle]
9160 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9161 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9162 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9163         fn drop(&mut self) {
9164                 if self.result_ok {
9165                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9166                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9167                         }
9168                 } else {
9169                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9170                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9171                         }
9172                 }
9173         }
9174 }
9175 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9176         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9177                 let contents = if o.result_ok {
9178                         let result = unsafe { o.contents.result };
9179                         unsafe { o.contents.result = std::ptr::null_mut() };
9180                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9181                 } else {
9182                         let err = unsafe { o.contents.err };
9183                         unsafe { o.contents.err = std::ptr::null_mut(); }
9184                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9185                 };
9186                 Self {
9187                         contents,
9188                         result_ok: o.result_ok,
9189                 }
9190         }
9191 }