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