Initial checkin with no changes from current RL git head
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 pub union CResult_SecretKeyErrorZPtr {
3         pub result: *mut crate::c_types::SecretKey,
4         pub err: *mut crate::c_types::Secp256k1Error,
5 }
6 #[repr(C)]
7 pub struct CResult_SecretKeyErrorZ {
8         pub contents: CResult_SecretKeyErrorZPtr,
9         pub result_ok: bool,
10 }
11 #[no_mangle]
12 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
13         CResult_SecretKeyErrorZ {
14                 contents: CResult_SecretKeyErrorZPtr {
15                         result: Box::into_raw(Box::new(o)),
16                 },
17                 result_ok: true,
18         }
19 }
20 #[no_mangle]
21 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
22         CResult_SecretKeyErrorZ {
23                 contents: CResult_SecretKeyErrorZPtr {
24                         err: Box::into_raw(Box::new(e)),
25                 },
26                 result_ok: false,
27         }
28 }
29 #[no_mangle]
30 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
31 impl Drop for CResult_SecretKeyErrorZ {
32         fn drop(&mut self) {
33                 if self.result_ok {
34                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
35                                 let _ = unsafe { Box::from_raw(self.contents.result) };
36                         }
37                 } else {
38                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
39                                 let _ = unsafe { Box::from_raw(self.contents.err) };
40                         }
41                 }
42         }
43 }
44 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
45         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
46                 let contents = if o.result_ok {
47                         let result = unsafe { o.contents.result };
48                         unsafe { o.contents.result = std::ptr::null_mut() };
49                         CResult_SecretKeyErrorZPtr { result }
50                 } else {
51                         let err = unsafe { o.contents.err };
52                         unsafe { o.contents.err = std::ptr::null_mut(); }
53                         CResult_SecretKeyErrorZPtr { err }
54                 };
55                 Self {
56                         contents,
57                         result_ok: o.result_ok,
58                 }
59         }
60 }
61 #[repr(C)]
62 pub union CResult_PublicKeyErrorZPtr {
63         pub result: *mut crate::c_types::PublicKey,
64         pub err: *mut crate::c_types::Secp256k1Error,
65 }
66 #[repr(C)]
67 pub struct CResult_PublicKeyErrorZ {
68         pub contents: CResult_PublicKeyErrorZPtr,
69         pub result_ok: bool,
70 }
71 #[no_mangle]
72 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
73         CResult_PublicKeyErrorZ {
74                 contents: CResult_PublicKeyErrorZPtr {
75                         result: Box::into_raw(Box::new(o)),
76                 },
77                 result_ok: true,
78         }
79 }
80 #[no_mangle]
81 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
82         CResult_PublicKeyErrorZ {
83                 contents: CResult_PublicKeyErrorZPtr {
84                         err: Box::into_raw(Box::new(e)),
85                 },
86                 result_ok: false,
87         }
88 }
89 #[no_mangle]
90 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
91 impl Drop for CResult_PublicKeyErrorZ {
92         fn drop(&mut self) {
93                 if self.result_ok {
94                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
95                                 let _ = unsafe { Box::from_raw(self.contents.result) };
96                         }
97                 } else {
98                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
99                                 let _ = unsafe { Box::from_raw(self.contents.err) };
100                         }
101                 }
102         }
103 }
104 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
105         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
106                 let contents = if o.result_ok {
107                         let result = unsafe { o.contents.result };
108                         unsafe { o.contents.result = std::ptr::null_mut() };
109                         CResult_PublicKeyErrorZPtr { result }
110                 } else {
111                         let err = unsafe { o.contents.err };
112                         unsafe { o.contents.err = std::ptr::null_mut(); }
113                         CResult_PublicKeyErrorZPtr { err }
114                 };
115                 Self {
116                         contents,
117                         result_ok: o.result_ok,
118                 }
119         }
120 }
121 #[repr(C)]
122 pub union CResult_TxCreationKeysDecodeErrorZPtr {
123         pub result: *mut crate::ln::chan_utils::TxCreationKeys,
124         pub err: *mut crate::ln::msgs::DecodeError,
125 }
126 #[repr(C)]
127 pub struct CResult_TxCreationKeysDecodeErrorZ {
128         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
129         pub result_ok: bool,
130 }
131 #[no_mangle]
132 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
133         CResult_TxCreationKeysDecodeErrorZ {
134                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
135                         result: Box::into_raw(Box::new(o)),
136                 },
137                 result_ok: true,
138         }
139 }
140 #[no_mangle]
141 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
142         CResult_TxCreationKeysDecodeErrorZ {
143                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
144                         err: Box::into_raw(Box::new(e)),
145                 },
146                 result_ok: false,
147         }
148 }
149 #[no_mangle]
150 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
151 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
152         fn drop(&mut self) {
153                 if self.result_ok {
154                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.result) };
156                         }
157                 } else {
158                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
159                                 let _ = unsafe { Box::from_raw(self.contents.err) };
160                         }
161                 }
162         }
163 }
164 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
165         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::ln::msgs::DecodeError>) -> Self {
166                 let contents = if o.result_ok {
167                         let result = unsafe { o.contents.result };
168                         unsafe { o.contents.result = std::ptr::null_mut() };
169                         CResult_TxCreationKeysDecodeErrorZPtr { result }
170                 } else {
171                         let err = unsafe { o.contents.err };
172                         unsafe { o.contents.err = std::ptr::null_mut(); }
173                         CResult_TxCreationKeysDecodeErrorZPtr { err }
174                 };
175                 Self {
176                         contents,
177                         result_ok: o.result_ok,
178                 }
179         }
180 }
181 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
182         fn clone(&self) -> Self {
183                 if self.result_ok {
184                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
185                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
186                         } }
187                 } else {
188                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
189                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
190                         } }
191                 }
192         }
193 }
194 #[no_mangle]
195 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
196 #[repr(C)]
197 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
198         pub result: *mut crate::ln::chan_utils::ChannelPublicKeys,
199         pub err: *mut crate::ln::msgs::DecodeError,
200 }
201 #[repr(C)]
202 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
203         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
204         pub result_ok: bool,
205 }
206 #[no_mangle]
207 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
208         CResult_ChannelPublicKeysDecodeErrorZ {
209                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
210                         result: Box::into_raw(Box::new(o)),
211                 },
212                 result_ok: true,
213         }
214 }
215 #[no_mangle]
216 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
217         CResult_ChannelPublicKeysDecodeErrorZ {
218                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
219                         err: Box::into_raw(Box::new(e)),
220                 },
221                 result_ok: false,
222         }
223 }
224 #[no_mangle]
225 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
226 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
227         fn drop(&mut self) {
228                 if self.result_ok {
229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
231                         }
232                 } else {
233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
235                         }
236                 }
237         }
238 }
239 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelPublicKeys, crate::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
240         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelPublicKeys, crate::ln::msgs::DecodeError>) -> Self {
241                 let contents = if o.result_ok {
242                         let result = unsafe { o.contents.result };
243                         unsafe { o.contents.result = std::ptr::null_mut() };
244                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
245                 } else {
246                         let err = unsafe { o.contents.err };
247                         unsafe { o.contents.err = std::ptr::null_mut(); }
248                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
249                 };
250                 Self {
251                         contents,
252                         result_ok: o.result_ok,
253                 }
254         }
255 }
256 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
257         fn clone(&self) -> Self {
258                 if self.result_ok {
259                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
260                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
261                         } }
262                 } else {
263                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
264                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
265                         } }
266                 }
267         }
268 }
269 #[no_mangle]
270 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
271 #[repr(C)]
272 pub union CResult_TxCreationKeysErrorZPtr {
273         pub result: *mut crate::ln::chan_utils::TxCreationKeys,
274         pub err: *mut crate::c_types::Secp256k1Error,
275 }
276 #[repr(C)]
277 pub struct CResult_TxCreationKeysErrorZ {
278         pub contents: CResult_TxCreationKeysErrorZPtr,
279         pub result_ok: bool,
280 }
281 #[no_mangle]
282 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
283         CResult_TxCreationKeysErrorZ {
284                 contents: CResult_TxCreationKeysErrorZPtr {
285                         result: Box::into_raw(Box::new(o)),
286                 },
287                 result_ok: true,
288         }
289 }
290 #[no_mangle]
291 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
292         CResult_TxCreationKeysErrorZ {
293                 contents: CResult_TxCreationKeysErrorZPtr {
294                         err: Box::into_raw(Box::new(e)),
295                 },
296                 result_ok: false,
297         }
298 }
299 #[no_mangle]
300 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
301 impl Drop for CResult_TxCreationKeysErrorZ {
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::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
315         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, 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_TxCreationKeysErrorZPtr { result }
320                 } else {
321                         let err = unsafe { o.contents.err };
322                         unsafe { o.contents.err = std::ptr::null_mut(); }
323                         CResult_TxCreationKeysErrorZPtr { err }
324                 };
325                 Self {
326                         contents,
327                         result_ok: o.result_ok,
328                 }
329         }
330 }
331 #[repr(C)]
332 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
333         pub result: *mut crate::ln::chan_utils::HTLCOutputInCommitment,
334         pub err: *mut crate::ln::msgs::DecodeError,
335 }
336 #[repr(C)]
337 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
338         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
339         pub result_ok: bool,
340 }
341 #[no_mangle]
342 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
343         CResult_HTLCOutputInCommitmentDecodeErrorZ {
344                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
345                         result: Box::into_raw(Box::new(o)),
346                 },
347                 result_ok: true,
348         }
349 }
350 #[no_mangle]
351 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
352         CResult_HTLCOutputInCommitmentDecodeErrorZ {
353                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
354                         err: Box::into_raw(Box::new(e)),
355                 },
356                 result_ok: false,
357         }
358 }
359 #[no_mangle]
360 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
361 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
362         fn drop(&mut self) {
363                 if self.result_ok {
364                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
365                                 let _ = unsafe { Box::from_raw(self.contents.result) };
366                         }
367                 } else {
368                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
369                                 let _ = unsafe { Box::from_raw(self.contents.err) };
370                         }
371                 }
372         }
373 }
374 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::HTLCOutputInCommitment, crate::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
375         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::HTLCOutputInCommitment, crate::ln::msgs::DecodeError>) -> Self {
376                 let contents = if o.result_ok {
377                         let result = unsafe { o.contents.result };
378                         unsafe { o.contents.result = std::ptr::null_mut() };
379                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
380                 } else {
381                         let err = unsafe { o.contents.err };
382                         unsafe { o.contents.err = std::ptr::null_mut(); }
383                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
384                 };
385                 Self {
386                         contents,
387                         result_ok: o.result_ok,
388                 }
389         }
390 }
391 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
392         fn clone(&self) -> Self {
393                 if self.result_ok {
394                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
395                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
396                         } }
397                 } else {
398                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
399                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
400                         } }
401                 }
402         }
403 }
404 #[no_mangle]
405 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
406 #[repr(C)]
407 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
408         pub result: *mut crate::ln::chan_utils::CounterpartyChannelTransactionParameters,
409         pub err: *mut crate::ln::msgs::DecodeError,
410 }
411 #[repr(C)]
412 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
413         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
414         pub result_ok: bool,
415 }
416 #[no_mangle]
417 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
418         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
419                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
420                         result: Box::into_raw(Box::new(o)),
421                 },
422                 result_ok: true,
423         }
424 }
425 #[no_mangle]
426 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
427         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
428                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
429                         err: Box::into_raw(Box::new(e)),
430                 },
431                 result_ok: false,
432         }
433 }
434 #[no_mangle]
435 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
436 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
437         fn drop(&mut self) {
438                 if self.result_ok {
439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
441                         }
442                 } else {
443                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
444                                 let _ = unsafe { Box::from_raw(self.contents.err) };
445                         }
446                 }
447         }
448 }
449 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
450         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::ln::msgs::DecodeError>) -> Self {
451                 let contents = if o.result_ok {
452                         let result = unsafe { o.contents.result };
453                         unsafe { o.contents.result = std::ptr::null_mut() };
454                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
455                 } else {
456                         let err = unsafe { o.contents.err };
457                         unsafe { o.contents.err = std::ptr::null_mut(); }
458                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
459                 };
460                 Self {
461                         contents,
462                         result_ok: o.result_ok,
463                 }
464         }
465 }
466 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
467         fn clone(&self) -> Self {
468                 if self.result_ok {
469                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
470                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
471                         } }
472                 } else {
473                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
474                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
475                         } }
476                 }
477         }
478 }
479 #[no_mangle]
480 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
481 #[repr(C)]
482 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
483         pub result: *mut crate::ln::chan_utils::ChannelTransactionParameters,
484         pub err: *mut crate::ln::msgs::DecodeError,
485 }
486 #[repr(C)]
487 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
488         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
489         pub result_ok: bool,
490 }
491 #[no_mangle]
492 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
493         CResult_ChannelTransactionParametersDecodeErrorZ {
494                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
495                         result: Box::into_raw(Box::new(o)),
496                 },
497                 result_ok: true,
498         }
499 }
500 #[no_mangle]
501 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
502         CResult_ChannelTransactionParametersDecodeErrorZ {
503                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
504                         err: Box::into_raw(Box::new(e)),
505                 },
506                 result_ok: false,
507         }
508 }
509 #[no_mangle]
510 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
511 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
512         fn drop(&mut self) {
513                 if self.result_ok {
514                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
515                                 let _ = unsafe { Box::from_raw(self.contents.result) };
516                         }
517                 } else {
518                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
519                                 let _ = unsafe { Box::from_raw(self.contents.err) };
520                         }
521                 }
522         }
523 }
524 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelTransactionParameters, crate::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
525         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelTransactionParameters, crate::ln::msgs::DecodeError>) -> Self {
526                 let contents = if o.result_ok {
527                         let result = unsafe { o.contents.result };
528                         unsafe { o.contents.result = std::ptr::null_mut() };
529                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
530                 } else {
531                         let err = unsafe { o.contents.err };
532                         unsafe { o.contents.err = std::ptr::null_mut(); }
533                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
534                 };
535                 Self {
536                         contents,
537                         result_ok: o.result_ok,
538                 }
539         }
540 }
541 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
542         fn clone(&self) -> Self {
543                 if self.result_ok {
544                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
545                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
546                         } }
547                 } else {
548                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
549                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
550                         } }
551                 }
552         }
553 }
554 #[no_mangle]
555 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
556 #[repr(C)]
557 pub struct CVec_SignatureZ {
558         pub data: *mut crate::c_types::Signature,
559         pub datalen: usize
560 }
561 impl CVec_SignatureZ {
562         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
563                 if self.datalen == 0 { return Vec::new(); }
564                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
565                 self.data = std::ptr::null_mut();
566                 self.datalen = 0;
567                 ret
568         }
569         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
570                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
571         }
572 }
573 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
574         fn from(v: Vec<crate::c_types::Signature>) -> Self {
575                 let datalen = v.len();
576                 let data = Box::into_raw(v.into_boxed_slice());
577                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
578         }
579 }
580 #[no_mangle]
581 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
582 impl Drop for CVec_SignatureZ {
583         fn drop(&mut self) {
584                 if self.datalen == 0 { return; }
585                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
586         }
587 }
588 impl Clone for CVec_SignatureZ {
589         fn clone(&self) -> Self {
590                 let mut res = Vec::new();
591                 if self.datalen == 0 { return Self::from(res); }
592                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
593                 Self::from(res)
594         }
595 }
596 #[repr(C)]
597 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
598         pub result: *mut crate::ln::chan_utils::HolderCommitmentTransaction,
599         pub err: *mut crate::ln::msgs::DecodeError,
600 }
601 #[repr(C)]
602 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
603         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
604         pub result_ok: bool,
605 }
606 #[no_mangle]
607 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
608         CResult_HolderCommitmentTransactionDecodeErrorZ {
609                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
610                         result: Box::into_raw(Box::new(o)),
611                 },
612                 result_ok: true,
613         }
614 }
615 #[no_mangle]
616 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
617         CResult_HolderCommitmentTransactionDecodeErrorZ {
618                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
619                         err: Box::into_raw(Box::new(e)),
620                 },
621                 result_ok: false,
622         }
623 }
624 #[no_mangle]
625 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
626 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
627         fn drop(&mut self) {
628                 if self.result_ok {
629                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
630                                 let _ = unsafe { Box::from_raw(self.contents.result) };
631                         }
632                 } else {
633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
635                         }
636                 }
637         }
638 }
639 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::HolderCommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
640         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::HolderCommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
641                 let contents = if o.result_ok {
642                         let result = unsafe { o.contents.result };
643                         unsafe { o.contents.result = std::ptr::null_mut() };
644                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
645                 } else {
646                         let err = unsafe { o.contents.err };
647                         unsafe { o.contents.err = std::ptr::null_mut(); }
648                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
649                 };
650                 Self {
651                         contents,
652                         result_ok: o.result_ok,
653                 }
654         }
655 }
656 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
657         fn clone(&self) -> Self {
658                 if self.result_ok {
659                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
660                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
661                         } }
662                 } else {
663                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
664                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
665                         } }
666                 }
667         }
668 }
669 #[no_mangle]
670 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
671 #[repr(C)]
672 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
673         pub result: *mut crate::ln::chan_utils::BuiltCommitmentTransaction,
674         pub err: *mut crate::ln::msgs::DecodeError,
675 }
676 #[repr(C)]
677 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
678         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
679         pub result_ok: bool,
680 }
681 #[no_mangle]
682 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
683         CResult_BuiltCommitmentTransactionDecodeErrorZ {
684                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
685                         result: Box::into_raw(Box::new(o)),
686                 },
687                 result_ok: true,
688         }
689 }
690 #[no_mangle]
691 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
692         CResult_BuiltCommitmentTransactionDecodeErrorZ {
693                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
694                         err: Box::into_raw(Box::new(e)),
695                 },
696                 result_ok: false,
697         }
698 }
699 #[no_mangle]
700 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
701 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
702         fn drop(&mut self) {
703                 if self.result_ok {
704                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
705                                 let _ = unsafe { Box::from_raw(self.contents.result) };
706                         }
707                 } else {
708                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
709                                 let _ = unsafe { Box::from_raw(self.contents.err) };
710                         }
711                 }
712         }
713 }
714 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::BuiltCommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
715         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::BuiltCommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
716                 let contents = if o.result_ok {
717                         let result = unsafe { o.contents.result };
718                         unsafe { o.contents.result = std::ptr::null_mut() };
719                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
720                 } else {
721                         let err = unsafe { o.contents.err };
722                         unsafe { o.contents.err = std::ptr::null_mut(); }
723                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
724                 };
725                 Self {
726                         contents,
727                         result_ok: o.result_ok,
728                 }
729         }
730 }
731 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
732         fn clone(&self) -> Self {
733                 if self.result_ok {
734                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
735                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
736                         } }
737                 } else {
738                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
739                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
740                         } }
741                 }
742         }
743 }
744 #[no_mangle]
745 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
746 #[repr(C)]
747 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
748         pub result: *mut crate::ln::chan_utils::CommitmentTransaction,
749         pub err: *mut crate::ln::msgs::DecodeError,
750 }
751 #[repr(C)]
752 pub struct CResult_CommitmentTransactionDecodeErrorZ {
753         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
754         pub result_ok: bool,
755 }
756 #[no_mangle]
757 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
758         CResult_CommitmentTransactionDecodeErrorZ {
759                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
760                         result: Box::into_raw(Box::new(o)),
761                 },
762                 result_ok: true,
763         }
764 }
765 #[no_mangle]
766 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
767         CResult_CommitmentTransactionDecodeErrorZ {
768                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
769                         err: Box::into_raw(Box::new(e)),
770                 },
771                 result_ok: false,
772         }
773 }
774 #[no_mangle]
775 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
776 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
777         fn drop(&mut self) {
778                 if self.result_ok {
779                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
780                                 let _ = unsafe { Box::from_raw(self.contents.result) };
781                         }
782                 } else {
783                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
784                                 let _ = unsafe { Box::from_raw(self.contents.err) };
785                         }
786                 }
787         }
788 }
789 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::CommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
790         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::CommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
791                 let contents = if o.result_ok {
792                         let result = unsafe { o.contents.result };
793                         unsafe { o.contents.result = std::ptr::null_mut() };
794                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
795                 } else {
796                         let err = unsafe { o.contents.err };
797                         unsafe { o.contents.err = std::ptr::null_mut(); }
798                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
799                 };
800                 Self {
801                         contents,
802                         result_ok: o.result_ok,
803                 }
804         }
805 }
806 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
807         fn clone(&self) -> Self {
808                 if self.result_ok {
809                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
810                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
811                         } }
812                 } else {
813                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
814                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
815                         } }
816                 }
817         }
818 }
819 #[no_mangle]
820 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
821 #[repr(C)]
822 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
823         pub result: *mut crate::ln::chan_utils::TrustedCommitmentTransaction,
824         /// Note that this value is always NULL, as there are no contents in the Err variant
825         pub err: *mut std::ffi::c_void,
826 }
827 #[repr(C)]
828 pub struct CResult_TrustedCommitmentTransactionNoneZ {
829         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
830         pub result_ok: bool,
831 }
832 #[no_mangle]
833 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
834         CResult_TrustedCommitmentTransactionNoneZ {
835                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
836                         result: Box::into_raw(Box::new(o)),
837                 },
838                 result_ok: true,
839         }
840 }
841 #[no_mangle]
842 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
843         CResult_TrustedCommitmentTransactionNoneZ {
844                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
845                         err: std::ptr::null_mut(),
846                 },
847                 result_ok: false,
848         }
849 }
850 #[no_mangle]
851 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
852 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
853         fn drop(&mut self) {
854                 if self.result_ok {
855                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
856                                 let _ = unsafe { Box::from_raw(self.contents.result) };
857                         }
858                 } else {
859                 }
860         }
861 }
862 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
863         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> Self {
864                 let contents = if o.result_ok {
865                         let result = unsafe { o.contents.result };
866                         unsafe { o.contents.result = std::ptr::null_mut() };
867                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
868                 } else {
869                         let _ = unsafe { Box::from_raw(o.contents.err) };
870                         o.contents.err = std::ptr::null_mut();
871                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
872                 };
873                 Self {
874                         contents,
875                         result_ok: o.result_ok,
876                 }
877         }
878 }
879 #[repr(C)]
880 pub union CResult_CVec_SignatureZNoneZPtr {
881         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
882         /// Note that this value is always NULL, as there are no contents in the Err variant
883         pub err: *mut std::ffi::c_void,
884 }
885 #[repr(C)]
886 pub struct CResult_CVec_SignatureZNoneZ {
887         pub contents: CResult_CVec_SignatureZNoneZPtr,
888         pub result_ok: bool,
889 }
890 #[no_mangle]
891 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
892         CResult_CVec_SignatureZNoneZ {
893                 contents: CResult_CVec_SignatureZNoneZPtr {
894                         result: Box::into_raw(Box::new(o)),
895                 },
896                 result_ok: true,
897         }
898 }
899 #[no_mangle]
900 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
901         CResult_CVec_SignatureZNoneZ {
902                 contents: CResult_CVec_SignatureZNoneZPtr {
903                         err: std::ptr::null_mut(),
904                 },
905                 result_ok: false,
906         }
907 }
908 #[no_mangle]
909 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
910 impl Drop for CResult_CVec_SignatureZNoneZ {
911         fn drop(&mut self) {
912                 if self.result_ok {
913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
915                         }
916                 } else {
917                 }
918         }
919 }
920 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>> for CResult_CVec_SignatureZNoneZ {
921         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> Self {
922                 let contents = if o.result_ok {
923                         let result = unsafe { o.contents.result };
924                         unsafe { o.contents.result = std::ptr::null_mut() };
925                         CResult_CVec_SignatureZNoneZPtr { result }
926                 } else {
927                         let _ = unsafe { Box::from_raw(o.contents.err) };
928                         o.contents.err = std::ptr::null_mut();
929                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
930                 };
931                 Self {
932                         contents,
933                         result_ok: o.result_ok,
934                 }
935         }
936 }
937 impl Clone for CResult_CVec_SignatureZNoneZ {
938         fn clone(&self) -> Self {
939                 if self.result_ok {
940                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
941                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
942                         } }
943                 } else {
944                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
945                                 err: std::ptr::null_mut()
946                         } }
947                 }
948         }
949 }
950 #[no_mangle]
951 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
952 #[repr(C)]
953 pub struct CVec_MessageSendEventZ {
954         pub data: *mut crate::util::events::MessageSendEvent,
955         pub datalen: usize
956 }
957 impl CVec_MessageSendEventZ {
958         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
959                 if self.datalen == 0 { return Vec::new(); }
960                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
961                 self.data = std::ptr::null_mut();
962                 self.datalen = 0;
963                 ret
964         }
965         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::MessageSendEvent] {
966                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
967         }
968 }
969 impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
970         fn from(v: Vec<crate::util::events::MessageSendEvent>) -> Self {
971                 let datalen = v.len();
972                 let data = Box::into_raw(v.into_boxed_slice());
973                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
974         }
975 }
976 #[no_mangle]
977 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
978 impl Drop for CVec_MessageSendEventZ {
979         fn drop(&mut self) {
980                 if self.datalen == 0 { return; }
981                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
982         }
983 }
984 impl Clone for CVec_MessageSendEventZ {
985         fn clone(&self) -> Self {
986                 let mut res = Vec::new();
987                 if self.datalen == 0 { return Self::from(res); }
988                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
989                 Self::from(res)
990         }
991 }
992 #[repr(C)]
993 pub union CResult_boolLightningErrorZPtr {
994         pub result: *mut bool,
995         pub err: *mut crate::ln::msgs::LightningError,
996 }
997 #[repr(C)]
998 pub struct CResult_boolLightningErrorZ {
999         pub contents: CResult_boolLightningErrorZPtr,
1000         pub result_ok: bool,
1001 }
1002 #[no_mangle]
1003 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1004         CResult_boolLightningErrorZ {
1005                 contents: CResult_boolLightningErrorZPtr {
1006                         result: Box::into_raw(Box::new(o)),
1007                 },
1008                 result_ok: true,
1009         }
1010 }
1011 #[no_mangle]
1012 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1013         CResult_boolLightningErrorZ {
1014                 contents: CResult_boolLightningErrorZPtr {
1015                         err: Box::into_raw(Box::new(e)),
1016                 },
1017                 result_ok: false,
1018         }
1019 }
1020 #[no_mangle]
1021 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1022 impl Drop for CResult_boolLightningErrorZ {
1023         fn drop(&mut self) {
1024                 if self.result_ok {
1025                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1026                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1027                         }
1028                 } else {
1029                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1030                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1031                         }
1032                 }
1033         }
1034 }
1035 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
1036         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
1037                 let contents = if o.result_ok {
1038                         let result = unsafe { o.contents.result };
1039                         unsafe { o.contents.result = std::ptr::null_mut() };
1040                         CResult_boolLightningErrorZPtr { result }
1041                 } else {
1042                         let err = unsafe { o.contents.err };
1043                         unsafe { o.contents.err = std::ptr::null_mut(); }
1044                         CResult_boolLightningErrorZPtr { err }
1045                 };
1046                 Self {
1047                         contents,
1048                         result_ok: o.result_ok,
1049                 }
1050         }
1051 }
1052 impl Clone for CResult_boolLightningErrorZ {
1053         fn clone(&self) -> Self {
1054                 if self.result_ok {
1055                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
1056                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1057                         } }
1058                 } else {
1059                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
1060                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1061                         } }
1062                 }
1063         }
1064 }
1065 #[no_mangle]
1066 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
1067 #[repr(C)]
1068 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1069         pub a: crate::ln::msgs::ChannelAnnouncement,
1070         pub b: crate::ln::msgs::ChannelUpdate,
1071         pub c: crate::ln::msgs::ChannelUpdate,
1072 }
1073 impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1074         fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
1075                 Self {
1076                         a: tup.0,
1077                         b: tup.1,
1078                         c: tup.2,
1079                 }
1080         }
1081 }
1082 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1083         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
1084                 (self.a, self.b, self.c)
1085         }
1086 }
1087 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1088         fn clone(&self) -> Self {
1089                 Self {
1090                         a: self.a.clone(),
1091                         b: self.b.clone(),
1092                         c: self.c.clone(),
1093                 }
1094         }
1095 }
1096 #[no_mangle]
1097 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
1098 #[no_mangle]
1099 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1100         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
1101 }
1102
1103 #[no_mangle]
1104 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
1105 #[repr(C)]
1106 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1107         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
1108         pub datalen: usize
1109 }
1110 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1111         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
1112                 if self.datalen == 0 { return Vec::new(); }
1113                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1114                 self.data = std::ptr::null_mut();
1115                 self.datalen = 0;
1116                 ret
1117         }
1118         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
1119                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1120         }
1121 }
1122 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1123         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
1124                 let datalen = v.len();
1125                 let data = Box::into_raw(v.into_boxed_slice());
1126                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1127         }
1128 }
1129 #[no_mangle]
1130 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
1131 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1132         fn drop(&mut self) {
1133                 if self.datalen == 0 { return; }
1134                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1135         }
1136 }
1137 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1138         fn clone(&self) -> Self {
1139                 let mut res = Vec::new();
1140                 if self.datalen == 0 { return Self::from(res); }
1141                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1142                 Self::from(res)
1143         }
1144 }
1145 #[repr(C)]
1146 pub struct CVec_NodeAnnouncementZ {
1147         pub data: *mut crate::ln::msgs::NodeAnnouncement,
1148         pub datalen: usize
1149 }
1150 impl CVec_NodeAnnouncementZ {
1151         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
1152                 if self.datalen == 0 { return Vec::new(); }
1153                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1154                 self.data = std::ptr::null_mut();
1155                 self.datalen = 0;
1156                 ret
1157         }
1158         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
1159                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1160         }
1161 }
1162 impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
1163         fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
1164                 let datalen = v.len();
1165                 let data = Box::into_raw(v.into_boxed_slice());
1166                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1167         }
1168 }
1169 #[no_mangle]
1170 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
1171 impl Drop for CVec_NodeAnnouncementZ {
1172         fn drop(&mut self) {
1173                 if self.datalen == 0 { return; }
1174                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1175         }
1176 }
1177 impl Clone for CVec_NodeAnnouncementZ {
1178         fn clone(&self) -> Self {
1179                 let mut res = Vec::new();
1180                 if self.datalen == 0 { return Self::from(res); }
1181                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1182                 Self::from(res)
1183         }
1184 }
1185 #[repr(C)]
1186 pub union CResult_NoneLightningErrorZPtr {
1187         /// Note that this value is always NULL, as there are no contents in the OK variant
1188         pub result: *mut std::ffi::c_void,
1189         pub err: *mut crate::ln::msgs::LightningError,
1190 }
1191 #[repr(C)]
1192 pub struct CResult_NoneLightningErrorZ {
1193         pub contents: CResult_NoneLightningErrorZPtr,
1194         pub result_ok: bool,
1195 }
1196 #[no_mangle]
1197 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
1198         CResult_NoneLightningErrorZ {
1199                 contents: CResult_NoneLightningErrorZPtr {
1200                         result: std::ptr::null_mut(),
1201                 },
1202                 result_ok: true,
1203         }
1204 }
1205 #[no_mangle]
1206 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
1207         CResult_NoneLightningErrorZ {
1208                 contents: CResult_NoneLightningErrorZPtr {
1209                         err: Box::into_raw(Box::new(e)),
1210                 },
1211                 result_ok: false,
1212         }
1213 }
1214 #[no_mangle]
1215 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
1216 impl Drop for CResult_NoneLightningErrorZ {
1217         fn drop(&mut self) {
1218                 if self.result_ok {
1219                 } else {
1220                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1221                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1222                         }
1223                 }
1224         }
1225 }
1226 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
1227         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
1228                 let contents = if o.result_ok {
1229                         let _ = unsafe { Box::from_raw(o.contents.result) };
1230                         o.contents.result = std::ptr::null_mut();
1231                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
1232                 } else {
1233                         let err = unsafe { o.contents.err };
1234                         unsafe { o.contents.err = std::ptr::null_mut(); }
1235                         CResult_NoneLightningErrorZPtr { err }
1236                 };
1237                 Self {
1238                         contents,
1239                         result_ok: o.result_ok,
1240                 }
1241         }
1242 }
1243 impl Clone for CResult_NoneLightningErrorZ {
1244         fn clone(&self) -> Self {
1245                 if self.result_ok {
1246                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
1247                                 result: std::ptr::null_mut()
1248                         } }
1249                 } else {
1250                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
1251                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1252                         } }
1253                 }
1254         }
1255 }
1256 #[no_mangle]
1257 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
1258 #[repr(C)]
1259 pub struct CVec_PublicKeyZ {
1260         pub data: *mut crate::c_types::PublicKey,
1261         pub datalen: usize
1262 }
1263 impl CVec_PublicKeyZ {
1264         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
1265                 if self.datalen == 0 { return Vec::new(); }
1266                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1267                 self.data = std::ptr::null_mut();
1268                 self.datalen = 0;
1269                 ret
1270         }
1271         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
1272                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1273         }
1274 }
1275 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
1276         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
1277                 let datalen = v.len();
1278                 let data = Box::into_raw(v.into_boxed_slice());
1279                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1280         }
1281 }
1282 #[no_mangle]
1283 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
1284 impl Drop for CVec_PublicKeyZ {
1285         fn drop(&mut self) {
1286                 if self.datalen == 0 { return; }
1287                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1288         }
1289 }
1290 #[repr(C)]
1291 pub struct CVec_u8Z {
1292         pub data: *mut u8,
1293         pub datalen: usize
1294 }
1295 impl CVec_u8Z {
1296         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
1297                 if self.datalen == 0 { return Vec::new(); }
1298                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1299                 self.data = std::ptr::null_mut();
1300                 self.datalen = 0;
1301                 ret
1302         }
1303         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
1304                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1305         }
1306 }
1307 impl From<Vec<u8>> for CVec_u8Z {
1308         fn from(v: Vec<u8>) -> Self {
1309                 let datalen = v.len();
1310                 let data = Box::into_raw(v.into_boxed_slice());
1311                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1312         }
1313 }
1314 #[no_mangle]
1315 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1316 impl Drop for CVec_u8Z {
1317         fn drop(&mut self) {
1318                 if self.datalen == 0 { return; }
1319                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1320         }
1321 }
1322 impl Clone for CVec_u8Z {
1323         fn clone(&self) -> Self {
1324                 let mut res = Vec::new();
1325                 if self.datalen == 0 { return Self::from(res); }
1326                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1327                 Self::from(res)
1328         }
1329 }
1330 #[repr(C)]
1331 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
1332         pub result: *mut crate::c_types::derived::CVec_u8Z,
1333         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1334 }
1335 #[repr(C)]
1336 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
1337         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
1338         pub result_ok: bool,
1339 }
1340 #[no_mangle]
1341 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
1342         CResult_CVec_u8ZPeerHandleErrorZ {
1343                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1344                         result: Box::into_raw(Box::new(o)),
1345                 },
1346                 result_ok: true,
1347         }
1348 }
1349 #[no_mangle]
1350 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
1351         CResult_CVec_u8ZPeerHandleErrorZ {
1352                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1353                         err: Box::into_raw(Box::new(e)),
1354                 },
1355                 result_ok: false,
1356         }
1357 }
1358 #[no_mangle]
1359 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
1360 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
1361         fn drop(&mut self) {
1362                 if self.result_ok {
1363                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1364                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1365                         }
1366                 } else {
1367                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1368                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1369                         }
1370                 }
1371         }
1372 }
1373 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
1374         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
1375                 let contents = if o.result_ok {
1376                         let result = unsafe { o.contents.result };
1377                         unsafe { o.contents.result = std::ptr::null_mut() };
1378                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
1379                 } else {
1380                         let err = unsafe { o.contents.err };
1381                         unsafe { o.contents.err = std::ptr::null_mut(); }
1382                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
1383                 };
1384                 Self {
1385                         contents,
1386                         result_ok: o.result_ok,
1387                 }
1388         }
1389 }
1390 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
1391         fn clone(&self) -> Self {
1392                 if self.result_ok {
1393                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1394                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
1395                         } }
1396                 } else {
1397                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1398                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1399                         } }
1400                 }
1401         }
1402 }
1403 #[no_mangle]
1404 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
1405 #[repr(C)]
1406 pub union CResult_NonePeerHandleErrorZPtr {
1407         /// Note that this value is always NULL, as there are no contents in the OK variant
1408         pub result: *mut std::ffi::c_void,
1409         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1410 }
1411 #[repr(C)]
1412 pub struct CResult_NonePeerHandleErrorZ {
1413         pub contents: CResult_NonePeerHandleErrorZPtr,
1414         pub result_ok: bool,
1415 }
1416 #[no_mangle]
1417 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
1418         CResult_NonePeerHandleErrorZ {
1419                 contents: CResult_NonePeerHandleErrorZPtr {
1420                         result: std::ptr::null_mut(),
1421                 },
1422                 result_ok: true,
1423         }
1424 }
1425 #[no_mangle]
1426 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
1427         CResult_NonePeerHandleErrorZ {
1428                 contents: CResult_NonePeerHandleErrorZPtr {
1429                         err: Box::into_raw(Box::new(e)),
1430                 },
1431                 result_ok: false,
1432         }
1433 }
1434 #[no_mangle]
1435 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
1436 impl Drop for CResult_NonePeerHandleErrorZ {
1437         fn drop(&mut self) {
1438                 if self.result_ok {
1439                 } else {
1440                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1441                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1442                         }
1443                 }
1444         }
1445 }
1446 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
1447         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
1448                 let contents = if o.result_ok {
1449                         let _ = unsafe { Box::from_raw(o.contents.result) };
1450                         o.contents.result = std::ptr::null_mut();
1451                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
1452                 } else {
1453                         let err = unsafe { o.contents.err };
1454                         unsafe { o.contents.err = std::ptr::null_mut(); }
1455                         CResult_NonePeerHandleErrorZPtr { err }
1456                 };
1457                 Self {
1458                         contents,
1459                         result_ok: o.result_ok,
1460                 }
1461         }
1462 }
1463 impl Clone for CResult_NonePeerHandleErrorZ {
1464         fn clone(&self) -> Self {
1465                 if self.result_ok {
1466                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
1467                                 result: std::ptr::null_mut()
1468                         } }
1469                 } else {
1470                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
1471                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1472                         } }
1473                 }
1474         }
1475 }
1476 #[no_mangle]
1477 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
1478 #[repr(C)]
1479 pub union CResult_boolPeerHandleErrorZPtr {
1480         pub result: *mut bool,
1481         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1482 }
1483 #[repr(C)]
1484 pub struct CResult_boolPeerHandleErrorZ {
1485         pub contents: CResult_boolPeerHandleErrorZPtr,
1486         pub result_ok: bool,
1487 }
1488 #[no_mangle]
1489 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
1490         CResult_boolPeerHandleErrorZ {
1491                 contents: CResult_boolPeerHandleErrorZPtr {
1492                         result: Box::into_raw(Box::new(o)),
1493                 },
1494                 result_ok: true,
1495         }
1496 }
1497 #[no_mangle]
1498 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
1499         CResult_boolPeerHandleErrorZ {
1500                 contents: CResult_boolPeerHandleErrorZPtr {
1501                         err: Box::into_raw(Box::new(e)),
1502                 },
1503                 result_ok: false,
1504         }
1505 }
1506 #[no_mangle]
1507 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
1508 impl Drop for CResult_boolPeerHandleErrorZ {
1509         fn drop(&mut self) {
1510                 if self.result_ok {
1511                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1512                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1513                         }
1514                 } else {
1515                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1516                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1517                         }
1518                 }
1519         }
1520 }
1521 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
1522         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
1523                 let contents = if o.result_ok {
1524                         let result = unsafe { o.contents.result };
1525                         unsafe { o.contents.result = std::ptr::null_mut() };
1526                         CResult_boolPeerHandleErrorZPtr { result }
1527                 } else {
1528                         let err = unsafe { o.contents.err };
1529                         unsafe { o.contents.err = std::ptr::null_mut(); }
1530                         CResult_boolPeerHandleErrorZPtr { err }
1531                 };
1532                 Self {
1533                         contents,
1534                         result_ok: o.result_ok,
1535                 }
1536         }
1537 }
1538 impl Clone for CResult_boolPeerHandleErrorZ {
1539         fn clone(&self) -> Self {
1540                 if self.result_ok {
1541                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
1542                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1543                         } }
1544                 } else {
1545                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
1546                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1547                         } }
1548                 }
1549         }
1550 }
1551 #[no_mangle]
1552 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
1553 #[repr(C)]
1554 pub union CResult_InitFeaturesDecodeErrorZPtr {
1555         pub result: *mut crate::ln::features::InitFeatures,
1556         pub err: *mut crate::ln::msgs::DecodeError,
1557 }
1558 #[repr(C)]
1559 pub struct CResult_InitFeaturesDecodeErrorZ {
1560         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
1561         pub result_ok: bool,
1562 }
1563 #[no_mangle]
1564 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
1565         CResult_InitFeaturesDecodeErrorZ {
1566                 contents: CResult_InitFeaturesDecodeErrorZPtr {
1567                         result: Box::into_raw(Box::new(o)),
1568                 },
1569                 result_ok: true,
1570         }
1571 }
1572 #[no_mangle]
1573 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
1574         CResult_InitFeaturesDecodeErrorZ {
1575                 contents: CResult_InitFeaturesDecodeErrorZPtr {
1576                         err: Box::into_raw(Box::new(e)),
1577                 },
1578                 result_ok: false,
1579         }
1580 }
1581 #[no_mangle]
1582 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
1583 impl Drop for CResult_InitFeaturesDecodeErrorZ {
1584         fn drop(&mut self) {
1585                 if self.result_ok {
1586                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1587                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1588                         }
1589                 } else {
1590                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1591                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1592                         }
1593                 }
1594         }
1595 }
1596 impl From<crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
1597         fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>) -> Self {
1598                 let contents = if o.result_ok {
1599                         let result = unsafe { o.contents.result };
1600                         unsafe { o.contents.result = std::ptr::null_mut() };
1601                         CResult_InitFeaturesDecodeErrorZPtr { result }
1602                 } else {
1603                         let err = unsafe { o.contents.err };
1604                         unsafe { o.contents.err = std::ptr::null_mut(); }
1605                         CResult_InitFeaturesDecodeErrorZPtr { err }
1606                 };
1607                 Self {
1608                         contents,
1609                         result_ok: o.result_ok,
1610                 }
1611         }
1612 }
1613 #[repr(C)]
1614 pub union CResult_NodeFeaturesDecodeErrorZPtr {
1615         pub result: *mut crate::ln::features::NodeFeatures,
1616         pub err: *mut crate::ln::msgs::DecodeError,
1617 }
1618 #[repr(C)]
1619 pub struct CResult_NodeFeaturesDecodeErrorZ {
1620         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
1621         pub result_ok: bool,
1622 }
1623 #[no_mangle]
1624 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
1625         CResult_NodeFeaturesDecodeErrorZ {
1626                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
1627                         result: Box::into_raw(Box::new(o)),
1628                 },
1629                 result_ok: true,
1630         }
1631 }
1632 #[no_mangle]
1633 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
1634         CResult_NodeFeaturesDecodeErrorZ {
1635                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
1636                         err: Box::into_raw(Box::new(e)),
1637                 },
1638                 result_ok: false,
1639         }
1640 }
1641 #[no_mangle]
1642 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
1643 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
1644         fn drop(&mut self) {
1645                 if self.result_ok {
1646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1648                         }
1649                 } else {
1650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1652                         }
1653                 }
1654         }
1655 }
1656 impl From<crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
1657         fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>) -> Self {
1658                 let contents = if o.result_ok {
1659                         let result = unsafe { o.contents.result };
1660                         unsafe { o.contents.result = std::ptr::null_mut() };
1661                         CResult_NodeFeaturesDecodeErrorZPtr { result }
1662                 } else {
1663                         let err = unsafe { o.contents.err };
1664                         unsafe { o.contents.err = std::ptr::null_mut(); }
1665                         CResult_NodeFeaturesDecodeErrorZPtr { err }
1666                 };
1667                 Self {
1668                         contents,
1669                         result_ok: o.result_ok,
1670                 }
1671         }
1672 }
1673 #[repr(C)]
1674 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
1675         pub result: *mut crate::ln::features::ChannelFeatures,
1676         pub err: *mut crate::ln::msgs::DecodeError,
1677 }
1678 #[repr(C)]
1679 pub struct CResult_ChannelFeaturesDecodeErrorZ {
1680         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
1681         pub result_ok: bool,
1682 }
1683 #[no_mangle]
1684 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
1685         CResult_ChannelFeaturesDecodeErrorZ {
1686                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
1687                         result: Box::into_raw(Box::new(o)),
1688                 },
1689                 result_ok: true,
1690         }
1691 }
1692 #[no_mangle]
1693 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
1694         CResult_ChannelFeaturesDecodeErrorZ {
1695                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
1696                         err: Box::into_raw(Box::new(e)),
1697                 },
1698                 result_ok: false,
1699         }
1700 }
1701 #[no_mangle]
1702 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
1703 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
1704         fn drop(&mut self) {
1705                 if self.result_ok {
1706                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1707                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1708                         }
1709                 } else {
1710                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1711                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1712                         }
1713                 }
1714         }
1715 }
1716 impl From<crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
1717         fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>) -> Self {
1718                 let contents = if o.result_ok {
1719                         let result = unsafe { o.contents.result };
1720                         unsafe { o.contents.result = std::ptr::null_mut() };
1721                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
1722                 } else {
1723                         let err = unsafe { o.contents.err };
1724                         unsafe { o.contents.err = std::ptr::null_mut(); }
1725                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
1726                 };
1727                 Self {
1728                         contents,
1729                         result_ok: o.result_ok,
1730                 }
1731         }
1732 }
1733 #[repr(C)]
1734 pub union CResult_ChannelConfigDecodeErrorZPtr {
1735         pub result: *mut crate::util::config::ChannelConfig,
1736         pub err: *mut crate::ln::msgs::DecodeError,
1737 }
1738 #[repr(C)]
1739 pub struct CResult_ChannelConfigDecodeErrorZ {
1740         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
1741         pub result_ok: bool,
1742 }
1743 #[no_mangle]
1744 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
1745         CResult_ChannelConfigDecodeErrorZ {
1746                 contents: CResult_ChannelConfigDecodeErrorZPtr {
1747                         result: Box::into_raw(Box::new(o)),
1748                 },
1749                 result_ok: true,
1750         }
1751 }
1752 #[no_mangle]
1753 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
1754         CResult_ChannelConfigDecodeErrorZ {
1755                 contents: CResult_ChannelConfigDecodeErrorZPtr {
1756                         err: Box::into_raw(Box::new(e)),
1757                 },
1758                 result_ok: false,
1759         }
1760 }
1761 #[no_mangle]
1762 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
1763 impl Drop for CResult_ChannelConfigDecodeErrorZ {
1764         fn drop(&mut self) {
1765                 if self.result_ok {
1766                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1767                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1768                         }
1769                 } else {
1770                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1771                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1772                         }
1773                 }
1774         }
1775 }
1776 impl From<crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
1777         fn from(mut o: crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>) -> Self {
1778                 let contents = if o.result_ok {
1779                         let result = unsafe { o.contents.result };
1780                         unsafe { o.contents.result = std::ptr::null_mut() };
1781                         CResult_ChannelConfigDecodeErrorZPtr { result }
1782                 } else {
1783                         let err = unsafe { o.contents.err };
1784                         unsafe { o.contents.err = std::ptr::null_mut(); }
1785                         CResult_ChannelConfigDecodeErrorZPtr { err }
1786                 };
1787                 Self {
1788                         contents,
1789                         result_ok: o.result_ok,
1790                 }
1791         }
1792 }
1793 impl Clone for CResult_ChannelConfigDecodeErrorZ {
1794         fn clone(&self) -> Self {
1795                 if self.result_ok {
1796                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
1797                                 result: Box::into_raw(Box::new(<crate::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
1798                         } }
1799                 } else {
1800                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
1801                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1802                         } }
1803                 }
1804         }
1805 }
1806 #[no_mangle]
1807 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
1808 #[repr(C)]
1809 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
1810         pub result: *mut crate::routing::network_graph::DirectionalChannelInfo,
1811         pub err: *mut crate::ln::msgs::DecodeError,
1812 }
1813 #[repr(C)]
1814 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
1815         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
1816         pub result_ok: bool,
1817 }
1818 #[no_mangle]
1819 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
1820         CResult_DirectionalChannelInfoDecodeErrorZ {
1821                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1822                         result: Box::into_raw(Box::new(o)),
1823                 },
1824                 result_ok: true,
1825         }
1826 }
1827 #[no_mangle]
1828 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
1829         CResult_DirectionalChannelInfoDecodeErrorZ {
1830                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1831                         err: Box::into_raw(Box::new(e)),
1832                 },
1833                 result_ok: false,
1834         }
1835 }
1836 #[no_mangle]
1837 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
1838 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
1839         fn drop(&mut self) {
1840                 if self.result_ok {
1841                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1842                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1843                         }
1844                 } else {
1845                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1846                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1847                         }
1848                 }
1849         }
1850 }
1851 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
1852         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
1853                 let contents = if o.result_ok {
1854                         let result = unsafe { o.contents.result };
1855                         unsafe { o.contents.result = std::ptr::null_mut() };
1856                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
1857                 } else {
1858                         let err = unsafe { o.contents.err };
1859                         unsafe { o.contents.err = std::ptr::null_mut(); }
1860                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
1861                 };
1862                 Self {
1863                         contents,
1864                         result_ok: o.result_ok,
1865                 }
1866         }
1867 }
1868 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
1869         fn clone(&self) -> Self {
1870                 if self.result_ok {
1871                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1872                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
1873                         } }
1874                 } else {
1875                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1876                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1877                         } }
1878                 }
1879         }
1880 }
1881 #[no_mangle]
1882 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
1883 #[repr(C)]
1884 pub union CResult_ChannelInfoDecodeErrorZPtr {
1885         pub result: *mut crate::routing::network_graph::ChannelInfo,
1886         pub err: *mut crate::ln::msgs::DecodeError,
1887 }
1888 #[repr(C)]
1889 pub struct CResult_ChannelInfoDecodeErrorZ {
1890         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
1891         pub result_ok: bool,
1892 }
1893 #[no_mangle]
1894 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
1895         CResult_ChannelInfoDecodeErrorZ {
1896                 contents: CResult_ChannelInfoDecodeErrorZPtr {
1897                         result: Box::into_raw(Box::new(o)),
1898                 },
1899                 result_ok: true,
1900         }
1901 }
1902 #[no_mangle]
1903 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
1904         CResult_ChannelInfoDecodeErrorZ {
1905                 contents: CResult_ChannelInfoDecodeErrorZPtr {
1906                         err: Box::into_raw(Box::new(e)),
1907                 },
1908                 result_ok: false,
1909         }
1910 }
1911 #[no_mangle]
1912 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
1913 impl Drop for CResult_ChannelInfoDecodeErrorZ {
1914         fn drop(&mut self) {
1915                 if self.result_ok {
1916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1918                         }
1919                 } else {
1920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1922                         }
1923                 }
1924         }
1925 }
1926 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
1927         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
1928                 let contents = if o.result_ok {
1929                         let result = unsafe { o.contents.result };
1930                         unsafe { o.contents.result = std::ptr::null_mut() };
1931                         CResult_ChannelInfoDecodeErrorZPtr { result }
1932                 } else {
1933                         let err = unsafe { o.contents.err };
1934                         unsafe { o.contents.err = std::ptr::null_mut(); }
1935                         CResult_ChannelInfoDecodeErrorZPtr { err }
1936                 };
1937                 Self {
1938                         contents,
1939                         result_ok: o.result_ok,
1940                 }
1941         }
1942 }
1943 impl Clone for CResult_ChannelInfoDecodeErrorZ {
1944         fn clone(&self) -> Self {
1945                 if self.result_ok {
1946                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
1947                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
1948                         } }
1949                 } else {
1950                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
1951                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1952                         } }
1953                 }
1954         }
1955 }
1956 #[no_mangle]
1957 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
1958 #[repr(C)]
1959 pub union CResult_RoutingFeesDecodeErrorZPtr {
1960         pub result: *mut crate::routing::network_graph::RoutingFees,
1961         pub err: *mut crate::ln::msgs::DecodeError,
1962 }
1963 #[repr(C)]
1964 pub struct CResult_RoutingFeesDecodeErrorZ {
1965         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
1966         pub result_ok: bool,
1967 }
1968 #[no_mangle]
1969 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
1970         CResult_RoutingFeesDecodeErrorZ {
1971                 contents: CResult_RoutingFeesDecodeErrorZPtr {
1972                         result: Box::into_raw(Box::new(o)),
1973                 },
1974                 result_ok: true,
1975         }
1976 }
1977 #[no_mangle]
1978 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
1979         CResult_RoutingFeesDecodeErrorZ {
1980                 contents: CResult_RoutingFeesDecodeErrorZPtr {
1981                         err: Box::into_raw(Box::new(e)),
1982                 },
1983                 result_ok: false,
1984         }
1985 }
1986 #[no_mangle]
1987 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
1988 impl Drop for CResult_RoutingFeesDecodeErrorZ {
1989         fn drop(&mut self) {
1990                 if self.result_ok {
1991                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1992                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1993                         }
1994                 } else {
1995                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1996                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1997                         }
1998                 }
1999         }
2000 }
2001 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
2002         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
2003                 let contents = if o.result_ok {
2004                         let result = unsafe { o.contents.result };
2005                         unsafe { o.contents.result = std::ptr::null_mut() };
2006                         CResult_RoutingFeesDecodeErrorZPtr { result }
2007                 } else {
2008                         let err = unsafe { o.contents.err };
2009                         unsafe { o.contents.err = std::ptr::null_mut(); }
2010                         CResult_RoutingFeesDecodeErrorZPtr { err }
2011                 };
2012                 Self {
2013                         contents,
2014                         result_ok: o.result_ok,
2015                 }
2016         }
2017 }
2018 impl Clone for CResult_RoutingFeesDecodeErrorZ {
2019         fn clone(&self) -> Self {
2020                 if self.result_ok {
2021                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
2022                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
2023                         } }
2024                 } else {
2025                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
2026                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2027                         } }
2028                 }
2029         }
2030 }
2031 #[no_mangle]
2032 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
2033 #[repr(C)]
2034 pub struct CVec_NetAddressZ {
2035         pub data: *mut crate::ln::msgs::NetAddress,
2036         pub datalen: usize
2037 }
2038 impl CVec_NetAddressZ {
2039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NetAddress> {
2040                 if self.datalen == 0 { return Vec::new(); }
2041                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2042                 self.data = std::ptr::null_mut();
2043                 self.datalen = 0;
2044                 ret
2045         }
2046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NetAddress] {
2047                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2048         }
2049 }
2050 impl From<Vec<crate::ln::msgs::NetAddress>> for CVec_NetAddressZ {
2051         fn from(v: Vec<crate::ln::msgs::NetAddress>) -> Self {
2052                 let datalen = v.len();
2053                 let data = Box::into_raw(v.into_boxed_slice());
2054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2055         }
2056 }
2057 #[no_mangle]
2058 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
2059 impl Drop for CVec_NetAddressZ {
2060         fn drop(&mut self) {
2061                 if self.datalen == 0 { return; }
2062                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2063         }
2064 }
2065 impl Clone for CVec_NetAddressZ {
2066         fn clone(&self) -> Self {
2067                 let mut res = Vec::new();
2068                 if self.datalen == 0 { return Self::from(res); }
2069                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2070                 Self::from(res)
2071         }
2072 }
2073 #[repr(C)]
2074 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2075         pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
2076         pub err: *mut crate::ln::msgs::DecodeError,
2077 }
2078 #[repr(C)]
2079 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
2080         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
2081         pub result_ok: bool,
2082 }
2083 #[no_mangle]
2084 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2085         CResult_NodeAnnouncementInfoDecodeErrorZ {
2086                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2087                         result: Box::into_raw(Box::new(o)),
2088                 },
2089                 result_ok: true,
2090         }
2091 }
2092 #[no_mangle]
2093 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2094         CResult_NodeAnnouncementInfoDecodeErrorZ {
2095                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2096                         err: Box::into_raw(Box::new(e)),
2097                 },
2098                 result_ok: false,
2099         }
2100 }
2101 #[no_mangle]
2102 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
2103 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
2104         fn drop(&mut self) {
2105                 if self.result_ok {
2106                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2107                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2108                         }
2109                 } else {
2110                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2111                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2112                         }
2113                 }
2114         }
2115 }
2116 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
2117         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
2118                 let contents = if o.result_ok {
2119                         let result = unsafe { o.contents.result };
2120                         unsafe { o.contents.result = std::ptr::null_mut() };
2121                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
2122                 } else {
2123                         let err = unsafe { o.contents.err };
2124                         unsafe { o.contents.err = std::ptr::null_mut(); }
2125                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
2126                 };
2127                 Self {
2128                         contents,
2129                         result_ok: o.result_ok,
2130                 }
2131         }
2132 }
2133 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
2134         fn clone(&self) -> Self {
2135                 if self.result_ok {
2136                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2137                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
2138                         } }
2139                 } else {
2140                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2141                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2142                         } }
2143                 }
2144         }
2145 }
2146 #[no_mangle]
2147 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
2148 #[repr(C)]
2149 pub struct CVec_u64Z {
2150         pub data: *mut u64,
2151         pub datalen: usize
2152 }
2153 impl CVec_u64Z {
2154         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2155                 if self.datalen == 0 { return Vec::new(); }
2156                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2157                 self.data = std::ptr::null_mut();
2158                 self.datalen = 0;
2159                 ret
2160         }
2161         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2162                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2163         }
2164 }
2165 impl From<Vec<u64>> for CVec_u64Z {
2166         fn from(v: Vec<u64>) -> Self {
2167                 let datalen = v.len();
2168                 let data = Box::into_raw(v.into_boxed_slice());
2169                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2170         }
2171 }
2172 #[no_mangle]
2173 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2174 impl Drop for CVec_u64Z {
2175         fn drop(&mut self) {
2176                 if self.datalen == 0 { return; }
2177                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2178         }
2179 }
2180 impl Clone for CVec_u64Z {
2181         fn clone(&self) -> Self {
2182                 let mut res = Vec::new();
2183                 if self.datalen == 0 { return Self::from(res); }
2184                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2185                 Self::from(res)
2186         }
2187 }
2188 #[repr(C)]
2189 pub union CResult_NodeInfoDecodeErrorZPtr {
2190         pub result: *mut crate::routing::network_graph::NodeInfo,
2191         pub err: *mut crate::ln::msgs::DecodeError,
2192 }
2193 #[repr(C)]
2194 pub struct CResult_NodeInfoDecodeErrorZ {
2195         pub contents: CResult_NodeInfoDecodeErrorZPtr,
2196         pub result_ok: bool,
2197 }
2198 #[no_mangle]
2199 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
2200         CResult_NodeInfoDecodeErrorZ {
2201                 contents: CResult_NodeInfoDecodeErrorZPtr {
2202                         result: Box::into_raw(Box::new(o)),
2203                 },
2204                 result_ok: true,
2205         }
2206 }
2207 #[no_mangle]
2208 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
2209         CResult_NodeInfoDecodeErrorZ {
2210                 contents: CResult_NodeInfoDecodeErrorZPtr {
2211                         err: Box::into_raw(Box::new(e)),
2212                 },
2213                 result_ok: false,
2214         }
2215 }
2216 #[no_mangle]
2217 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
2218 impl Drop for CResult_NodeInfoDecodeErrorZ {
2219         fn drop(&mut self) {
2220                 if self.result_ok {
2221                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2222                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2223                         }
2224                 } else {
2225                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2226                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2227                         }
2228                 }
2229         }
2230 }
2231 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
2232         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
2233                 let contents = if o.result_ok {
2234                         let result = unsafe { o.contents.result };
2235                         unsafe { o.contents.result = std::ptr::null_mut() };
2236                         CResult_NodeInfoDecodeErrorZPtr { result }
2237                 } else {
2238                         let err = unsafe { o.contents.err };
2239                         unsafe { o.contents.err = std::ptr::null_mut(); }
2240                         CResult_NodeInfoDecodeErrorZPtr { err }
2241                 };
2242                 Self {
2243                         contents,
2244                         result_ok: o.result_ok,
2245                 }
2246         }
2247 }
2248 impl Clone for CResult_NodeInfoDecodeErrorZ {
2249         fn clone(&self) -> Self {
2250                 if self.result_ok {
2251                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
2252                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
2253                         } }
2254                 } else {
2255                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
2256                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2257                         } }
2258                 }
2259         }
2260 }
2261 #[no_mangle]
2262 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
2263 #[repr(C)]
2264 pub union CResult_NetworkGraphDecodeErrorZPtr {
2265         pub result: *mut crate::routing::network_graph::NetworkGraph,
2266         pub err: *mut crate::ln::msgs::DecodeError,
2267 }
2268 #[repr(C)]
2269 pub struct CResult_NetworkGraphDecodeErrorZ {
2270         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
2271         pub result_ok: bool,
2272 }
2273 #[no_mangle]
2274 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
2275         CResult_NetworkGraphDecodeErrorZ {
2276                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2277                         result: Box::into_raw(Box::new(o)),
2278                 },
2279                 result_ok: true,
2280         }
2281 }
2282 #[no_mangle]
2283 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
2284         CResult_NetworkGraphDecodeErrorZ {
2285                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2286                         err: Box::into_raw(Box::new(e)),
2287                 },
2288                 result_ok: false,
2289         }
2290 }
2291 #[no_mangle]
2292 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
2293 impl Drop for CResult_NetworkGraphDecodeErrorZ {
2294         fn drop(&mut self) {
2295                 if self.result_ok {
2296                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2297                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2298                         }
2299                 } else {
2300                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2301                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2302                         }
2303                 }
2304         }
2305 }
2306 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
2307         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
2308                 let contents = if o.result_ok {
2309                         let result = unsafe { o.contents.result };
2310                         unsafe { o.contents.result = std::ptr::null_mut() };
2311                         CResult_NetworkGraphDecodeErrorZPtr { result }
2312                 } else {
2313                         let err = unsafe { o.contents.err };
2314                         unsafe { o.contents.err = std::ptr::null_mut(); }
2315                         CResult_NetworkGraphDecodeErrorZPtr { err }
2316                 };
2317                 Self {
2318                         contents,
2319                         result_ok: o.result_ok,
2320                 }
2321         }
2322 }
2323 impl Clone for CResult_NetworkGraphDecodeErrorZ {
2324         fn clone(&self) -> Self {
2325                 if self.result_ok {
2326                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
2327                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
2328                         } }
2329                 } else {
2330                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
2331                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2332                         } }
2333                 }
2334         }
2335 }
2336 #[no_mangle]
2337 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
2338 #[repr(C)]
2339 pub struct C2Tuple_usizeTransactionZ {
2340         pub a: usize,
2341         pub b: crate::c_types::Transaction,
2342 }
2343 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2344         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2345                 Self {
2346                         a: tup.0,
2347                         b: tup.1,
2348                 }
2349         }
2350 }
2351 impl C2Tuple_usizeTransactionZ {
2352         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2353                 (self.a, self.b)
2354         }
2355 }
2356 #[no_mangle]
2357 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2358         C2Tuple_usizeTransactionZ { a, b, }
2359 }
2360
2361 #[no_mangle]
2362 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2363 #[repr(C)]
2364 pub struct CVec_C2Tuple_usizeTransactionZZ {
2365         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2366         pub datalen: usize
2367 }
2368 impl CVec_C2Tuple_usizeTransactionZZ {
2369         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2370                 if self.datalen == 0 { return Vec::new(); }
2371                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2372                 self.data = std::ptr::null_mut();
2373                 self.datalen = 0;
2374                 ret
2375         }
2376         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2377                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2378         }
2379 }
2380 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2381         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2382                 let datalen = v.len();
2383                 let data = Box::into_raw(v.into_boxed_slice());
2384                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2385         }
2386 }
2387 #[no_mangle]
2388 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2389 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2390         fn drop(&mut self) {
2391                 if self.datalen == 0 { return; }
2392                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2393         }
2394 }
2395 #[repr(C)]
2396 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2397         /// Note that this value is always NULL, as there are no contents in the OK variant
2398         pub result: *mut std::ffi::c_void,
2399         pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
2400 }
2401 #[repr(C)]
2402 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2403         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2404         pub result_ok: bool,
2405 }
2406 #[no_mangle]
2407 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2408         CResult_NoneChannelMonitorUpdateErrZ {
2409                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2410                         result: std::ptr::null_mut(),
2411                 },
2412                 result_ok: true,
2413         }
2414 }
2415 #[no_mangle]
2416 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2417         CResult_NoneChannelMonitorUpdateErrZ {
2418                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2419                         err: Box::into_raw(Box::new(e)),
2420                 },
2421                 result_ok: false,
2422         }
2423 }
2424 #[no_mangle]
2425 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2426 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2427         fn drop(&mut self) {
2428                 if self.result_ok {
2429                 } else {
2430                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2431                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2432                         }
2433                 }
2434         }
2435 }
2436 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2437         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2438                 let contents = if o.result_ok {
2439                         let _ = unsafe { Box::from_raw(o.contents.result) };
2440                         o.contents.result = std::ptr::null_mut();
2441                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2442                 } else {
2443                         let err = unsafe { o.contents.err };
2444                         unsafe { o.contents.err = std::ptr::null_mut(); }
2445                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2446                 };
2447                 Self {
2448                         contents,
2449                         result_ok: o.result_ok,
2450                 }
2451         }
2452 }
2453 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2454         fn clone(&self) -> Self {
2455                 if self.result_ok {
2456                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2457                                 result: std::ptr::null_mut()
2458                         } }
2459                 } else {
2460                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2461                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2462                         } }
2463                 }
2464         }
2465 }
2466 #[no_mangle]
2467 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2468 #[repr(C)]
2469 pub struct CVec_MonitorEventZ {
2470         pub data: *mut crate::chain::channelmonitor::MonitorEvent,
2471         pub datalen: usize
2472 }
2473 impl CVec_MonitorEventZ {
2474         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
2475                 if self.datalen == 0 { return Vec::new(); }
2476                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2477                 self.data = std::ptr::null_mut();
2478                 self.datalen = 0;
2479                 ret
2480         }
2481         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
2482                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2483         }
2484 }
2485 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2486         fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
2487                 let datalen = v.len();
2488                 let data = Box::into_raw(v.into_boxed_slice());
2489                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2490         }
2491 }
2492 #[no_mangle]
2493 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2494 impl Drop for CVec_MonitorEventZ {
2495         fn drop(&mut self) {
2496                 if self.datalen == 0 { return; }
2497                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2498         }
2499 }
2500 impl Clone for CVec_MonitorEventZ {
2501         fn clone(&self) -> Self {
2502                 let mut res = Vec::new();
2503                 if self.datalen == 0 { return Self::from(res); }
2504                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2505                 Self::from(res)
2506         }
2507 }
2508 #[repr(C)]
2509 pub struct CVec_EventZ {
2510         pub data: *mut crate::util::events::Event,
2511         pub datalen: usize
2512 }
2513 impl CVec_EventZ {
2514         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
2515                 if self.datalen == 0 { return Vec::new(); }
2516                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2517                 self.data = std::ptr::null_mut();
2518                 self.datalen = 0;
2519                 ret
2520         }
2521         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
2522                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2523         }
2524 }
2525 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
2526         fn from(v: Vec<crate::util::events::Event>) -> Self {
2527                 let datalen = v.len();
2528                 let data = Box::into_raw(v.into_boxed_slice());
2529                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2530         }
2531 }
2532 #[no_mangle]
2533 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
2534 impl Drop for CVec_EventZ {
2535         fn drop(&mut self) {
2536                 if self.datalen == 0 { return; }
2537                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2538         }
2539 }
2540 impl Clone for CVec_EventZ {
2541         fn clone(&self) -> Self {
2542                 let mut res = Vec::new();
2543                 if self.datalen == 0 { return Self::from(res); }
2544                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2545                 Self::from(res)
2546         }
2547 }
2548 #[repr(C)]
2549 pub union CResult_OutPointDecodeErrorZPtr {
2550         pub result: *mut crate::chain::transaction::OutPoint,
2551         pub err: *mut crate::ln::msgs::DecodeError,
2552 }
2553 #[repr(C)]
2554 pub struct CResult_OutPointDecodeErrorZ {
2555         pub contents: CResult_OutPointDecodeErrorZPtr,
2556         pub result_ok: bool,
2557 }
2558 #[no_mangle]
2559 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
2560         CResult_OutPointDecodeErrorZ {
2561                 contents: CResult_OutPointDecodeErrorZPtr {
2562                         result: Box::into_raw(Box::new(o)),
2563                 },
2564                 result_ok: true,
2565         }
2566 }
2567 #[no_mangle]
2568 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
2569         CResult_OutPointDecodeErrorZ {
2570                 contents: CResult_OutPointDecodeErrorZPtr {
2571                         err: Box::into_raw(Box::new(e)),
2572                 },
2573                 result_ok: false,
2574         }
2575 }
2576 #[no_mangle]
2577 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
2578 impl Drop for CResult_OutPointDecodeErrorZ {
2579         fn drop(&mut self) {
2580                 if self.result_ok {
2581                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2582                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2583                         }
2584                 } else {
2585                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2586                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2587                         }
2588                 }
2589         }
2590 }
2591 impl From<crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
2592         fn from(mut o: crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>) -> Self {
2593                 let contents = if o.result_ok {
2594                         let result = unsafe { o.contents.result };
2595                         unsafe { o.contents.result = std::ptr::null_mut() };
2596                         CResult_OutPointDecodeErrorZPtr { result }
2597                 } else {
2598                         let err = unsafe { o.contents.err };
2599                         unsafe { o.contents.err = std::ptr::null_mut(); }
2600                         CResult_OutPointDecodeErrorZPtr { err }
2601                 };
2602                 Self {
2603                         contents,
2604                         result_ok: o.result_ok,
2605                 }
2606         }
2607 }
2608 impl Clone for CResult_OutPointDecodeErrorZ {
2609         fn clone(&self) -> Self {
2610                 if self.result_ok {
2611                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
2612                                 result: Box::into_raw(Box::new(<crate::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
2613                         } }
2614                 } else {
2615                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
2616                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2617                         } }
2618                 }
2619         }
2620 }
2621 #[no_mangle]
2622 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
2623 #[repr(C)]
2624 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2625         pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
2626         pub err: *mut crate::ln::msgs::DecodeError,
2627 }
2628 #[repr(C)]
2629 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
2630         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
2631         pub result_ok: bool,
2632 }
2633 #[no_mangle]
2634 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2635         CResult_ChannelMonitorUpdateDecodeErrorZ {
2636                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2637                         result: Box::into_raw(Box::new(o)),
2638                 },
2639                 result_ok: true,
2640         }
2641 }
2642 #[no_mangle]
2643 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2644         CResult_ChannelMonitorUpdateDecodeErrorZ {
2645                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2646                         err: Box::into_raw(Box::new(e)),
2647                 },
2648                 result_ok: false,
2649         }
2650 }
2651 #[no_mangle]
2652 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
2653 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
2654         fn drop(&mut self) {
2655                 if self.result_ok {
2656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2658                         }
2659                 } else {
2660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2662                         }
2663                 }
2664         }
2665 }
2666 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
2667         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
2668                 let contents = if o.result_ok {
2669                         let result = unsafe { o.contents.result };
2670                         unsafe { o.contents.result = std::ptr::null_mut() };
2671                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
2672                 } else {
2673                         let err = unsafe { o.contents.err };
2674                         unsafe { o.contents.err = std::ptr::null_mut(); }
2675                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
2676                 };
2677                 Self {
2678                         contents,
2679                         result_ok: o.result_ok,
2680                 }
2681         }
2682 }
2683 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
2684         fn clone(&self) -> Self {
2685                 if self.result_ok {
2686                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2687                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
2688                         } }
2689                 } else {
2690                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2691                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2692                         } }
2693                 }
2694         }
2695 }
2696 #[no_mangle]
2697 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
2698 #[repr(C)]
2699 pub union CResult_HTLCUpdateDecodeErrorZPtr {
2700         pub result: *mut crate::chain::channelmonitor::HTLCUpdate,
2701         pub err: *mut crate::ln::msgs::DecodeError,
2702 }
2703 #[repr(C)]
2704 pub struct CResult_HTLCUpdateDecodeErrorZ {
2705         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
2706         pub result_ok: bool,
2707 }
2708 #[no_mangle]
2709 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
2710         CResult_HTLCUpdateDecodeErrorZ {
2711                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2712                         result: Box::into_raw(Box::new(o)),
2713                 },
2714                 result_ok: true,
2715         }
2716 }
2717 #[no_mangle]
2718 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
2719         CResult_HTLCUpdateDecodeErrorZ {
2720                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2721                         err: Box::into_raw(Box::new(e)),
2722                 },
2723                 result_ok: false,
2724         }
2725 }
2726 #[no_mangle]
2727 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
2728 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
2729         fn drop(&mut self) {
2730                 if self.result_ok {
2731                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2732                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2733                         }
2734                 } else {
2735                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2736                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2737                         }
2738                 }
2739         }
2740 }
2741 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
2742         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>) -> Self {
2743                 let contents = if o.result_ok {
2744                         let result = unsafe { o.contents.result };
2745                         unsafe { o.contents.result = std::ptr::null_mut() };
2746                         CResult_HTLCUpdateDecodeErrorZPtr { result }
2747                 } else {
2748                         let err = unsafe { o.contents.err };
2749                         unsafe { o.contents.err = std::ptr::null_mut(); }
2750                         CResult_HTLCUpdateDecodeErrorZPtr { err }
2751                 };
2752                 Self {
2753                         contents,
2754                         result_ok: o.result_ok,
2755                 }
2756         }
2757 }
2758 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
2759         fn clone(&self) -> Self {
2760                 if self.result_ok {
2761                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2762                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
2763                         } }
2764                 } else {
2765                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2766                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2767                         } }
2768                 }
2769         }
2770 }
2771 #[no_mangle]
2772 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
2773 #[repr(C)]
2774 pub union CResult_NoneMonitorUpdateErrorZPtr {
2775         /// Note that this value is always NULL, as there are no contents in the OK variant
2776         pub result: *mut std::ffi::c_void,
2777         pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
2778 }
2779 #[repr(C)]
2780 pub struct CResult_NoneMonitorUpdateErrorZ {
2781         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
2782         pub result_ok: bool,
2783 }
2784 #[no_mangle]
2785 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
2786         CResult_NoneMonitorUpdateErrorZ {
2787                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2788                         result: std::ptr::null_mut(),
2789                 },
2790                 result_ok: true,
2791         }
2792 }
2793 #[no_mangle]
2794 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
2795         CResult_NoneMonitorUpdateErrorZ {
2796                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2797                         err: Box::into_raw(Box::new(e)),
2798                 },
2799                 result_ok: false,
2800         }
2801 }
2802 #[no_mangle]
2803 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
2804 impl Drop for CResult_NoneMonitorUpdateErrorZ {
2805         fn drop(&mut self) {
2806                 if self.result_ok {
2807                 } else {
2808                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2809                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2810                         }
2811                 }
2812         }
2813 }
2814 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
2815         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
2816                 let contents = if o.result_ok {
2817                         let _ = unsafe { Box::from_raw(o.contents.result) };
2818                         o.contents.result = std::ptr::null_mut();
2819                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
2820                 } else {
2821                         let err = unsafe { o.contents.err };
2822                         unsafe { o.contents.err = std::ptr::null_mut(); }
2823                         CResult_NoneMonitorUpdateErrorZPtr { err }
2824                 };
2825                 Self {
2826                         contents,
2827                         result_ok: o.result_ok,
2828                 }
2829         }
2830 }
2831 impl Clone for CResult_NoneMonitorUpdateErrorZ {
2832         fn clone(&self) -> Self {
2833                 if self.result_ok {
2834                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
2835                                 result: std::ptr::null_mut()
2836                         } }
2837                 } else {
2838                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
2839                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
2840                         } }
2841                 }
2842         }
2843 }
2844 #[no_mangle]
2845 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
2846 #[repr(C)]
2847 pub struct C2Tuple_OutPointScriptZ {
2848         pub a: crate::chain::transaction::OutPoint,
2849         pub b: crate::c_types::derived::CVec_u8Z,
2850 }
2851 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
2852         fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
2853                 Self {
2854                         a: tup.0,
2855                         b: tup.1,
2856                 }
2857         }
2858 }
2859 impl C2Tuple_OutPointScriptZ {
2860         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
2861                 (self.a, self.b)
2862         }
2863 }
2864 impl Clone for C2Tuple_OutPointScriptZ {
2865         fn clone(&self) -> Self {
2866                 Self {
2867                         a: self.a.clone(),
2868                         b: self.b.clone(),
2869                 }
2870         }
2871 }
2872 #[no_mangle]
2873 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
2874 #[no_mangle]
2875 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
2876         C2Tuple_OutPointScriptZ { a, b, }
2877 }
2878
2879 #[no_mangle]
2880 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
2881 #[repr(C)]
2882 pub struct CVec_TransactionZ {
2883         pub data: *mut crate::c_types::Transaction,
2884         pub datalen: usize
2885 }
2886 impl CVec_TransactionZ {
2887         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
2888                 if self.datalen == 0 { return Vec::new(); }
2889                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2890                 self.data = std::ptr::null_mut();
2891                 self.datalen = 0;
2892                 ret
2893         }
2894         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
2895                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2896         }
2897 }
2898 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
2899         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
2900                 let datalen = v.len();
2901                 let data = Box::into_raw(v.into_boxed_slice());
2902                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2903         }
2904 }
2905 #[no_mangle]
2906 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
2907 impl Drop for CVec_TransactionZ {
2908         fn drop(&mut self) {
2909                 if self.datalen == 0 { return; }
2910                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2911         }
2912 }
2913 #[repr(C)]
2914 pub struct C2Tuple_u32TxOutZ {
2915         pub a: u32,
2916         pub b: crate::c_types::TxOut,
2917 }
2918 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
2919         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
2920                 Self {
2921                         a: tup.0,
2922                         b: tup.1,
2923                 }
2924         }
2925 }
2926 impl C2Tuple_u32TxOutZ {
2927         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
2928                 (self.a, self.b)
2929         }
2930 }
2931 impl Clone for C2Tuple_u32TxOutZ {
2932         fn clone(&self) -> Self {
2933                 Self {
2934                         a: self.a.clone(),
2935                         b: self.b.clone(),
2936                 }
2937         }
2938 }
2939 #[no_mangle]
2940 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
2941 #[no_mangle]
2942 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
2943         C2Tuple_u32TxOutZ { a, b, }
2944 }
2945
2946 #[no_mangle]
2947 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
2948 #[repr(C)]
2949 pub struct CVec_C2Tuple_u32TxOutZZ {
2950         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
2951         pub datalen: usize
2952 }
2953 impl CVec_C2Tuple_u32TxOutZZ {
2954         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
2955                 if self.datalen == 0 { return Vec::new(); }
2956                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2957                 self.data = std::ptr::null_mut();
2958                 self.datalen = 0;
2959                 ret
2960         }
2961         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
2962                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2963         }
2964 }
2965 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
2966         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
2967                 let datalen = v.len();
2968                 let data = Box::into_raw(v.into_boxed_slice());
2969                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2970         }
2971 }
2972 #[no_mangle]
2973 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
2974 impl Drop for CVec_C2Tuple_u32TxOutZZ {
2975         fn drop(&mut self) {
2976                 if self.datalen == 0 { return; }
2977                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2978         }
2979 }
2980 impl Clone for CVec_C2Tuple_u32TxOutZZ {
2981         fn clone(&self) -> Self {
2982                 let mut res = Vec::new();
2983                 if self.datalen == 0 { return Self::from(res); }
2984                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2985                 Self::from(res)
2986         }
2987 }
2988 #[repr(C)]
2989 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2990         pub a: crate::c_types::ThirtyTwoBytes,
2991         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
2992 }
2993 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2994         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
2995                 Self {
2996                         a: tup.0,
2997                         b: tup.1,
2998                 }
2999         }
3000 }
3001 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3002         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3003                 (self.a, self.b)
3004         }
3005 }
3006 #[no_mangle]
3007 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 {
3008         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3009 }
3010
3011 #[no_mangle]
3012 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3013 #[repr(C)]
3014 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3015         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3016         pub datalen: usize
3017 }
3018 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3019         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3020                 if self.datalen == 0 { return Vec::new(); }
3021                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3022                 self.data = std::ptr::null_mut();
3023                 self.datalen = 0;
3024                 ret
3025         }
3026         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3027                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3028         }
3029 }
3030 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3031         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3032                 let datalen = v.len();
3033                 let data = Box::into_raw(v.into_boxed_slice());
3034                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3035         }
3036 }
3037 #[no_mangle]
3038 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) { }
3039 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3040         fn drop(&mut self) {
3041                 if self.datalen == 0 { return; }
3042                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3043         }
3044 }
3045 #[repr(C)]
3046 pub struct C2Tuple_BlockHashChannelMonitorZ {
3047         pub a: crate::c_types::ThirtyTwoBytes,
3048         pub b: crate::chain::channelmonitor::ChannelMonitor,
3049 }
3050 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3051         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
3052                 Self {
3053                         a: tup.0,
3054                         b: tup.1,
3055                 }
3056         }
3057 }
3058 impl C2Tuple_BlockHashChannelMonitorZ {
3059         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
3060                 (self.a, self.b)
3061         }
3062 }
3063 #[no_mangle]
3064 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3065         C2Tuple_BlockHashChannelMonitorZ { a, b, }
3066 }
3067
3068 #[no_mangle]
3069 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3070 #[repr(C)]
3071 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3072         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3073         pub err: *mut crate::ln::msgs::DecodeError,
3074 }
3075 #[repr(C)]
3076 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3077         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
3078         pub result_ok: bool,
3079 }
3080 #[no_mangle]
3081 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3082         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3083                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3084                         result: Box::into_raw(Box::new(o)),
3085                 },
3086                 result_ok: true,
3087         }
3088 }
3089 #[no_mangle]
3090 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3091         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3092                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3093                         err: Box::into_raw(Box::new(e)),
3094                 },
3095                 result_ok: false,
3096         }
3097 }
3098 #[no_mangle]
3099 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
3100 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3101         fn drop(&mut self) {
3102                 if self.result_ok {
3103                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3104                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3105                         }
3106                 } else {
3107                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3108                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3109                         }
3110                 }
3111         }
3112 }
3113 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3114         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
3115                 let contents = if o.result_ok {
3116                         let result = unsafe { o.contents.result };
3117                         unsafe { o.contents.result = std::ptr::null_mut() };
3118                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
3119                 } else {
3120                         let err = unsafe { o.contents.err };
3121                         unsafe { o.contents.err = std::ptr::null_mut(); }
3122                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
3123                 };
3124                 Self {
3125                         contents,
3126                         result_ok: o.result_ok,
3127                 }
3128         }
3129 }
3130 #[repr(C)]
3131 pub struct CVec_SpendableOutputDescriptorZ {
3132         pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
3133         pub datalen: usize
3134 }
3135 impl CVec_SpendableOutputDescriptorZ {
3136         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
3137                 if self.datalen == 0 { return Vec::new(); }
3138                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3139                 self.data = std::ptr::null_mut();
3140                 self.datalen = 0;
3141                 ret
3142         }
3143         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
3144                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3145         }
3146 }
3147 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3148         fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3149                 let datalen = v.len();
3150                 let data = Box::into_raw(v.into_boxed_slice());
3151                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3152         }
3153 }
3154 #[no_mangle]
3155 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3156 impl Drop for CVec_SpendableOutputDescriptorZ {
3157         fn drop(&mut self) {
3158                 if self.datalen == 0 { return; }
3159                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3160         }
3161 }
3162 impl Clone for CVec_SpendableOutputDescriptorZ {
3163         fn clone(&self) -> Self {
3164                 let mut res = Vec::new();
3165                 if self.datalen == 0 { return Self::from(res); }
3166                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3167                 Self::from(res)
3168         }
3169 }
3170 #[repr(C)]
3171 pub union CResult_TxOutAccessErrorZPtr {
3172         pub result: *mut crate::c_types::TxOut,
3173         pub err: *mut crate::chain::AccessError,
3174 }
3175 #[repr(C)]
3176 pub struct CResult_TxOutAccessErrorZ {
3177         pub contents: CResult_TxOutAccessErrorZPtr,
3178         pub result_ok: bool,
3179 }
3180 #[no_mangle]
3181 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3182         CResult_TxOutAccessErrorZ {
3183                 contents: CResult_TxOutAccessErrorZPtr {
3184                         result: Box::into_raw(Box::new(o)),
3185                 },
3186                 result_ok: true,
3187         }
3188 }
3189 #[no_mangle]
3190 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3191         CResult_TxOutAccessErrorZ {
3192                 contents: CResult_TxOutAccessErrorZPtr {
3193                         err: Box::into_raw(Box::new(e)),
3194                 },
3195                 result_ok: false,
3196         }
3197 }
3198 #[no_mangle]
3199 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3200 impl Drop for CResult_TxOutAccessErrorZ {
3201         fn drop(&mut self) {
3202                 if self.result_ok {
3203                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3204                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3205                         }
3206                 } else {
3207                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3208                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3209                         }
3210                 }
3211         }
3212 }
3213 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3214         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
3215                 let contents = if o.result_ok {
3216                         let result = unsafe { o.contents.result };
3217                         unsafe { o.contents.result = std::ptr::null_mut() };
3218                         CResult_TxOutAccessErrorZPtr { result }
3219                 } else {
3220                         let err = unsafe { o.contents.err };
3221                         unsafe { o.contents.err = std::ptr::null_mut(); }
3222                         CResult_TxOutAccessErrorZPtr { err }
3223                 };
3224                 Self {
3225                         contents,
3226                         result_ok: o.result_ok,
3227                 }
3228         }
3229 }
3230 impl Clone for CResult_TxOutAccessErrorZ {
3231         fn clone(&self) -> Self {
3232                 if self.result_ok {
3233                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3234                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3235                         } }
3236                 } else {
3237                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3238                                 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3239                         } }
3240                 }
3241         }
3242 }
3243 #[no_mangle]
3244 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
3245 #[repr(C)]
3246 pub union CResult_NoneAPIErrorZPtr {
3247         /// Note that this value is always NULL, as there are no contents in the OK variant
3248         pub result: *mut std::ffi::c_void,
3249         pub err: *mut crate::util::errors::APIError,
3250 }
3251 #[repr(C)]
3252 pub struct CResult_NoneAPIErrorZ {
3253         pub contents: CResult_NoneAPIErrorZPtr,
3254         pub result_ok: bool,
3255 }
3256 #[no_mangle]
3257 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
3258         CResult_NoneAPIErrorZ {
3259                 contents: CResult_NoneAPIErrorZPtr {
3260                         result: std::ptr::null_mut(),
3261                 },
3262                 result_ok: true,
3263         }
3264 }
3265 #[no_mangle]
3266 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
3267         CResult_NoneAPIErrorZ {
3268                 contents: CResult_NoneAPIErrorZPtr {
3269                         err: Box::into_raw(Box::new(e)),
3270                 },
3271                 result_ok: false,
3272         }
3273 }
3274 #[no_mangle]
3275 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
3276 impl Drop for CResult_NoneAPIErrorZ {
3277         fn drop(&mut self) {
3278                 if self.result_ok {
3279                 } else {
3280                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3281                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3282                         }
3283                 }
3284         }
3285 }
3286 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
3287         fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
3288                 let contents = if o.result_ok {
3289                         let _ = unsafe { Box::from_raw(o.contents.result) };
3290                         o.contents.result = std::ptr::null_mut();
3291                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
3292                 } else {
3293                         let err = unsafe { o.contents.err };
3294                         unsafe { o.contents.err = std::ptr::null_mut(); }
3295                         CResult_NoneAPIErrorZPtr { err }
3296                 };
3297                 Self {
3298                         contents,
3299                         result_ok: o.result_ok,
3300                 }
3301         }
3302 }
3303 impl Clone for CResult_NoneAPIErrorZ {
3304         fn clone(&self) -> Self {
3305                 if self.result_ok {
3306                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
3307                                 result: std::ptr::null_mut()
3308                         } }
3309                 } else {
3310                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
3311                                 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
3312                         } }
3313                 }
3314         }
3315 }
3316 #[no_mangle]
3317 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
3318 #[repr(C)]
3319 pub struct CVec_CResult_NoneAPIErrorZZ {
3320         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
3321         pub datalen: usize
3322 }
3323 impl CVec_CResult_NoneAPIErrorZZ {
3324         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
3325                 if self.datalen == 0 { return Vec::new(); }
3326                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3327                 self.data = std::ptr::null_mut();
3328                 self.datalen = 0;
3329                 ret
3330         }
3331         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
3332                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3333         }
3334 }
3335 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
3336         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
3337                 let datalen = v.len();
3338                 let data = Box::into_raw(v.into_boxed_slice());
3339                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3340         }
3341 }
3342 #[no_mangle]
3343 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
3344 impl Drop for CVec_CResult_NoneAPIErrorZZ {
3345         fn drop(&mut self) {
3346                 if self.datalen == 0 { return; }
3347                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3348         }
3349 }
3350 impl Clone for CVec_CResult_NoneAPIErrorZZ {
3351         fn clone(&self) -> Self {
3352                 let mut res = Vec::new();
3353                 if self.datalen == 0 { return Self::from(res); }
3354                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3355                 Self::from(res)
3356         }
3357 }
3358 #[repr(C)]
3359 pub struct CVec_APIErrorZ {
3360         pub data: *mut crate::util::errors::APIError,
3361         pub datalen: usize
3362 }
3363 impl CVec_APIErrorZ {
3364         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::errors::APIError> {
3365                 if self.datalen == 0 { return Vec::new(); }
3366                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3367                 self.data = std::ptr::null_mut();
3368                 self.datalen = 0;
3369                 ret
3370         }
3371         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::errors::APIError] {
3372                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3373         }
3374 }
3375 impl From<Vec<crate::util::errors::APIError>> for CVec_APIErrorZ {
3376         fn from(v: Vec<crate::util::errors::APIError>) -> Self {
3377                 let datalen = v.len();
3378                 let data = Box::into_raw(v.into_boxed_slice());
3379                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3380         }
3381 }
3382 #[no_mangle]
3383 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
3384 impl Drop for CVec_APIErrorZ {
3385         fn drop(&mut self) {
3386                 if self.datalen == 0 { return; }
3387                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3388         }
3389 }
3390 impl Clone for CVec_APIErrorZ {
3391         fn clone(&self) -> Self {
3392                 let mut res = Vec::new();
3393                 if self.datalen == 0 { return Self::from(res); }
3394                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3395                 Self::from(res)
3396         }
3397 }
3398 #[repr(C)]
3399 pub struct CVec_ChannelDetailsZ {
3400         pub data: *mut crate::ln::channelmanager::ChannelDetails,
3401         pub datalen: usize
3402 }
3403 impl CVec_ChannelDetailsZ {
3404         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
3405                 if self.datalen == 0 { return Vec::new(); }
3406                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3407                 self.data = std::ptr::null_mut();
3408                 self.datalen = 0;
3409                 ret
3410         }
3411         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
3412                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3413         }
3414 }
3415 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3416         fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
3417                 let datalen = v.len();
3418                 let data = Box::into_raw(v.into_boxed_slice());
3419                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3420         }
3421 }
3422 #[no_mangle]
3423 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3424 impl Drop for CVec_ChannelDetailsZ {
3425         fn drop(&mut self) {
3426                 if self.datalen == 0 { return; }
3427                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3428         }
3429 }
3430 impl Clone for CVec_ChannelDetailsZ {
3431         fn clone(&self) -> Self {
3432                 let mut res = Vec::new();
3433                 if self.datalen == 0 { return Self::from(res); }
3434                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3435                 Self::from(res)
3436         }
3437 }
3438 #[repr(C)]
3439 pub union CResult_NonePaymentSendFailureZPtr {
3440         /// Note that this value is always NULL, as there are no contents in the OK variant
3441         pub result: *mut std::ffi::c_void,
3442         pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
3443 }
3444 #[repr(C)]
3445 pub struct CResult_NonePaymentSendFailureZ {
3446         pub contents: CResult_NonePaymentSendFailureZPtr,
3447         pub result_ok: bool,
3448 }
3449 #[no_mangle]
3450 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
3451         CResult_NonePaymentSendFailureZ {
3452                 contents: CResult_NonePaymentSendFailureZPtr {
3453                         result: std::ptr::null_mut(),
3454                 },
3455                 result_ok: true,
3456         }
3457 }
3458 #[no_mangle]
3459 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
3460         CResult_NonePaymentSendFailureZ {
3461                 contents: CResult_NonePaymentSendFailureZPtr {
3462                         err: Box::into_raw(Box::new(e)),
3463                 },
3464                 result_ok: false,
3465         }
3466 }
3467 #[no_mangle]
3468 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
3469 impl Drop for CResult_NonePaymentSendFailureZ {
3470         fn drop(&mut self) {
3471                 if self.result_ok {
3472                 } else {
3473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3475                         }
3476                 }
3477         }
3478 }
3479 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
3480         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
3481                 let contents = if o.result_ok {
3482                         let _ = unsafe { Box::from_raw(o.contents.result) };
3483                         o.contents.result = std::ptr::null_mut();
3484                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
3485                 } else {
3486                         let err = unsafe { o.contents.err };
3487                         unsafe { o.contents.err = std::ptr::null_mut(); }
3488                         CResult_NonePaymentSendFailureZPtr { err }
3489                 };
3490                 Self {
3491                         contents,
3492                         result_ok: o.result_ok,
3493                 }
3494         }
3495 }
3496 impl Clone for CResult_NonePaymentSendFailureZ {
3497         fn clone(&self) -> Self {
3498                 if self.result_ok {
3499                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
3500                                 result: std::ptr::null_mut()
3501                         } }
3502                 } else {
3503                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
3504                                 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
3505                         } }
3506                 }
3507         }
3508 }
3509 #[no_mangle]
3510 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
3511 #[repr(C)]
3512 pub struct CVec_ChannelMonitorZ {
3513         pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
3514         pub datalen: usize
3515 }
3516 impl CVec_ChannelMonitorZ {
3517         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
3518                 if self.datalen == 0 { return Vec::new(); }
3519                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3520                 self.data = std::ptr::null_mut();
3521                 self.datalen = 0;
3522                 ret
3523         }
3524         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
3525                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3526         }
3527 }
3528 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
3529         fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
3530                 let datalen = v.len();
3531                 let data = Box::into_raw(v.into_boxed_slice());
3532                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3533         }
3534 }
3535 #[no_mangle]
3536 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
3537 impl Drop for CVec_ChannelMonitorZ {
3538         fn drop(&mut self) {
3539                 if self.datalen == 0 { return; }
3540                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3541         }
3542 }
3543 #[repr(C)]
3544 pub struct C2Tuple_BlockHashChannelManagerZ {
3545         pub a: crate::c_types::ThirtyTwoBytes,
3546         pub b: crate::ln::channelmanager::ChannelManager,
3547 }
3548 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
3549         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
3550                 Self {
3551                         a: tup.0,
3552                         b: tup.1,
3553                 }
3554         }
3555 }
3556 impl C2Tuple_BlockHashChannelManagerZ {
3557         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
3558                 (self.a, self.b)
3559         }
3560 }
3561 #[no_mangle]
3562 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
3563         C2Tuple_BlockHashChannelManagerZ { a, b, }
3564 }
3565
3566 #[no_mangle]
3567 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
3568 #[repr(C)]
3569 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3570         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
3571         pub err: *mut crate::ln::msgs::DecodeError,
3572 }
3573 #[repr(C)]
3574 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3575         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
3576         pub result_ok: bool,
3577 }
3578 #[no_mangle]
3579 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3580         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3581                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3582                         result: Box::into_raw(Box::new(o)),
3583                 },
3584                 result_ok: true,
3585         }
3586 }
3587 #[no_mangle]
3588 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3589         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3590                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3591                         err: Box::into_raw(Box::new(e)),
3592                 },
3593                 result_ok: false,
3594         }
3595 }
3596 #[no_mangle]
3597 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
3598 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3599         fn drop(&mut self) {
3600                 if self.result_ok {
3601                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3602                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3603                         }
3604                 } else {
3605                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3606                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3607                         }
3608                 }
3609         }
3610 }
3611 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3612         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
3613                 let contents = if o.result_ok {
3614                         let result = unsafe { o.contents.result };
3615                         unsafe { o.contents.result = std::ptr::null_mut() };
3616                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
3617                 } else {
3618                         let err = unsafe { o.contents.err };
3619                         unsafe { o.contents.err = std::ptr::null_mut(); }
3620                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
3621                 };
3622                 Self {
3623                         contents,
3624                         result_ok: o.result_ok,
3625                 }
3626         }
3627 }
3628 #[repr(C)]
3629 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3630         pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
3631         pub err: *mut crate::ln::msgs::DecodeError,
3632 }
3633 #[repr(C)]
3634 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3635         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3636         pub result_ok: bool,
3637 }
3638 #[no_mangle]
3639 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3640         CResult_SpendableOutputDescriptorDecodeErrorZ {
3641                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3642                         result: Box::into_raw(Box::new(o)),
3643                 },
3644                 result_ok: true,
3645         }
3646 }
3647 #[no_mangle]
3648 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3649         CResult_SpendableOutputDescriptorDecodeErrorZ {
3650                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3651                         err: Box::into_raw(Box::new(e)),
3652                 },
3653                 result_ok: false,
3654         }
3655 }
3656 #[no_mangle]
3657 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3658 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3659         fn drop(&mut self) {
3660                 if self.result_ok {
3661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3663                         }
3664                 } else {
3665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3667                         }
3668                 }
3669         }
3670 }
3671 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3672         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
3673                 let contents = if o.result_ok {
3674                         let result = unsafe { o.contents.result };
3675                         unsafe { o.contents.result = std::ptr::null_mut() };
3676                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3677                 } else {
3678                         let err = unsafe { o.contents.err };
3679                         unsafe { o.contents.err = std::ptr::null_mut(); }
3680                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3681                 };
3682                 Self {
3683                         contents,
3684                         result_ok: o.result_ok,
3685                 }
3686         }
3687 }
3688 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3689         fn clone(&self) -> Self {
3690                 if self.result_ok {
3691                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3692                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3693                         } }
3694                 } else {
3695                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3696                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3697                         } }
3698                 }
3699         }
3700 }
3701 #[no_mangle]
3702 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
3703 #[repr(C)]
3704 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3705         pub a: crate::c_types::Signature,
3706         pub b: crate::c_types::derived::CVec_SignatureZ,
3707 }
3708 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3709         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3710                 Self {
3711                         a: tup.0,
3712                         b: tup.1,
3713                 }
3714         }
3715 }
3716 impl C2Tuple_SignatureCVec_SignatureZZ {
3717         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3718                 (self.a, self.b)
3719         }
3720 }
3721 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3722         fn clone(&self) -> Self {
3723                 Self {
3724                         a: self.a.clone(),
3725                         b: self.b.clone(),
3726                 }
3727         }
3728 }
3729 #[no_mangle]
3730 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
3731 #[no_mangle]
3732 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3733         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3734 }
3735
3736 #[no_mangle]
3737 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3738 #[repr(C)]
3739 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3740         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3741         /// Note that this value is always NULL, as there are no contents in the Err variant
3742         pub err: *mut std::ffi::c_void,
3743 }
3744 #[repr(C)]
3745 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3746         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3747         pub result_ok: bool,
3748 }
3749 #[no_mangle]
3750 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3751         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3752                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3753                         result: Box::into_raw(Box::new(o)),
3754                 },
3755                 result_ok: true,
3756         }
3757 }
3758 #[no_mangle]
3759 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3760         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3761                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3762                         err: std::ptr::null_mut(),
3763                 },
3764                 result_ok: false,
3765         }
3766 }
3767 #[no_mangle]
3768 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3769 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3770         fn drop(&mut self) {
3771                 if self.result_ok {
3772                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3773                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3774                         }
3775                 } else {
3776                 }
3777         }
3778 }
3779 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3780         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
3781                 let contents = if o.result_ok {
3782                         let result = unsafe { o.contents.result };
3783                         unsafe { o.contents.result = std::ptr::null_mut() };
3784                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3785                 } else {
3786                         let _ = unsafe { Box::from_raw(o.contents.err) };
3787                         o.contents.err = std::ptr::null_mut();
3788                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3789                 };
3790                 Self {
3791                         contents,
3792                         result_ok: o.result_ok,
3793                 }
3794         }
3795 }
3796 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3797         fn clone(&self) -> Self {
3798                 if self.result_ok {
3799                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3800                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3801                         } }
3802                 } else {
3803                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3804                                 err: std::ptr::null_mut()
3805                         } }
3806                 }
3807         }
3808 }
3809 #[no_mangle]
3810 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
3811 #[repr(C)]
3812 pub union CResult_SignatureNoneZPtr {
3813         pub result: *mut crate::c_types::Signature,
3814         /// Note that this value is always NULL, as there are no contents in the Err variant
3815         pub err: *mut std::ffi::c_void,
3816 }
3817 #[repr(C)]
3818 pub struct CResult_SignatureNoneZ {
3819         pub contents: CResult_SignatureNoneZPtr,
3820         pub result_ok: bool,
3821 }
3822 #[no_mangle]
3823 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3824         CResult_SignatureNoneZ {
3825                 contents: CResult_SignatureNoneZPtr {
3826                         result: Box::into_raw(Box::new(o)),
3827                 },
3828                 result_ok: true,
3829         }
3830 }
3831 #[no_mangle]
3832 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3833         CResult_SignatureNoneZ {
3834                 contents: CResult_SignatureNoneZPtr {
3835                         err: std::ptr::null_mut(),
3836                 },
3837                 result_ok: false,
3838         }
3839 }
3840 #[no_mangle]
3841 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3842 impl Drop for CResult_SignatureNoneZ {
3843         fn drop(&mut self) {
3844                 if self.result_ok {
3845                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3846                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3847                         }
3848                 } else {
3849                 }
3850         }
3851 }
3852 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
3853         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
3854                 let contents = if o.result_ok {
3855                         let result = unsafe { o.contents.result };
3856                         unsafe { o.contents.result = std::ptr::null_mut() };
3857                         CResult_SignatureNoneZPtr { result }
3858                 } else {
3859                         let _ = unsafe { Box::from_raw(o.contents.err) };
3860                         o.contents.err = std::ptr::null_mut();
3861                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3862                 };
3863                 Self {
3864                         contents,
3865                         result_ok: o.result_ok,
3866                 }
3867         }
3868 }
3869 impl Clone for CResult_SignatureNoneZ {
3870         fn clone(&self) -> Self {
3871                 if self.result_ok {
3872                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3873                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3874                         } }
3875                 } else {
3876                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3877                                 err: std::ptr::null_mut()
3878                         } }
3879                 }
3880         }
3881 }
3882 #[no_mangle]
3883 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
3884 #[repr(C)]
3885 pub union CResult_SignDecodeErrorZPtr {
3886         pub result: *mut crate::chain::keysinterface::Sign,
3887         pub err: *mut crate::ln::msgs::DecodeError,
3888 }
3889 #[repr(C)]
3890 pub struct CResult_SignDecodeErrorZ {
3891         pub contents: CResult_SignDecodeErrorZPtr,
3892         pub result_ok: bool,
3893 }
3894 #[no_mangle]
3895 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
3896         CResult_SignDecodeErrorZ {
3897                 contents: CResult_SignDecodeErrorZPtr {
3898                         result: Box::into_raw(Box::new(o)),
3899                 },
3900                 result_ok: true,
3901         }
3902 }
3903 #[no_mangle]
3904 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
3905         CResult_SignDecodeErrorZ {
3906                 contents: CResult_SignDecodeErrorZPtr {
3907                         err: Box::into_raw(Box::new(e)),
3908                 },
3909                 result_ok: false,
3910         }
3911 }
3912 #[no_mangle]
3913 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
3914 impl Drop for CResult_SignDecodeErrorZ {
3915         fn drop(&mut self) {
3916                 if self.result_ok {
3917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3919                         }
3920                 } else {
3921                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3922                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3923                         }
3924                 }
3925         }
3926 }
3927 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
3928         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>) -> Self {
3929                 let contents = if o.result_ok {
3930                         let result = unsafe { o.contents.result };
3931                         unsafe { o.contents.result = std::ptr::null_mut() };
3932                         CResult_SignDecodeErrorZPtr { result }
3933                 } else {
3934                         let err = unsafe { o.contents.err };
3935                         unsafe { o.contents.err = std::ptr::null_mut(); }
3936                         CResult_SignDecodeErrorZPtr { err }
3937                 };
3938                 Self {
3939                         contents,
3940                         result_ok: o.result_ok,
3941                 }
3942         }
3943 }
3944 impl Clone for CResult_SignDecodeErrorZ {
3945         fn clone(&self) -> Self {
3946                 if self.result_ok {
3947                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
3948                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
3949                         } }
3950                 } else {
3951                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
3952                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3953                         } }
3954                 }
3955         }
3956 }
3957 #[no_mangle]
3958 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
3959 #[repr(C)]
3960 pub struct CVec_CVec_u8ZZ {
3961         pub data: *mut crate::c_types::derived::CVec_u8Z,
3962         pub datalen: usize
3963 }
3964 impl CVec_CVec_u8ZZ {
3965         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
3966                 if self.datalen == 0 { return Vec::new(); }
3967                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3968                 self.data = std::ptr::null_mut();
3969                 self.datalen = 0;
3970                 ret
3971         }
3972         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
3973                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3974         }
3975 }
3976 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
3977         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
3978                 let datalen = v.len();
3979                 let data = Box::into_raw(v.into_boxed_slice());
3980                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3981         }
3982 }
3983 #[no_mangle]
3984 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
3985 impl Drop for CVec_CVec_u8ZZ {
3986         fn drop(&mut self) {
3987                 if self.datalen == 0 { return; }
3988                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3989         }
3990 }
3991 impl Clone for CVec_CVec_u8ZZ {
3992         fn clone(&self) -> Self {
3993                 let mut res = Vec::new();
3994                 if self.datalen == 0 { return Self::from(res); }
3995                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3996                 Self::from(res)
3997         }
3998 }
3999 #[repr(C)]
4000 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4001         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4002         /// Note that this value is always NULL, as there are no contents in the Err variant
4003         pub err: *mut std::ffi::c_void,
4004 }
4005 #[repr(C)]
4006 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4007         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4008         pub result_ok: bool,
4009 }
4010 #[no_mangle]
4011 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4012         CResult_CVec_CVec_u8ZZNoneZ {
4013                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4014                         result: Box::into_raw(Box::new(o)),
4015                 },
4016                 result_ok: true,
4017         }
4018 }
4019 #[no_mangle]
4020 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4021         CResult_CVec_CVec_u8ZZNoneZ {
4022                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4023                         err: std::ptr::null_mut(),
4024                 },
4025                 result_ok: false,
4026         }
4027 }
4028 #[no_mangle]
4029 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4030 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4031         fn drop(&mut self) {
4032                 if self.result_ok {
4033                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4034                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4035                         }
4036                 } else {
4037                 }
4038         }
4039 }
4040 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
4041         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
4042                 let contents = if o.result_ok {
4043                         let result = unsafe { o.contents.result };
4044                         unsafe { o.contents.result = std::ptr::null_mut() };
4045                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
4046                 } else {
4047                         let _ = unsafe { Box::from_raw(o.contents.err) };
4048                         o.contents.err = std::ptr::null_mut();
4049                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4050                 };
4051                 Self {
4052                         contents,
4053                         result_ok: o.result_ok,
4054                 }
4055         }
4056 }
4057 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4058         fn clone(&self) -> Self {
4059                 if self.result_ok {
4060                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4061                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4062                         } }
4063                 } else {
4064                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4065                                 err: std::ptr::null_mut()
4066                         } }
4067                 }
4068         }
4069 }
4070 #[no_mangle]
4071 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
4072 #[repr(C)]
4073 pub union CResult_InMemorySignerDecodeErrorZPtr {
4074         pub result: *mut crate::chain::keysinterface::InMemorySigner,
4075         pub err: *mut crate::ln::msgs::DecodeError,
4076 }
4077 #[repr(C)]
4078 pub struct CResult_InMemorySignerDecodeErrorZ {
4079         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4080         pub result_ok: bool,
4081 }
4082 #[no_mangle]
4083 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4084         CResult_InMemorySignerDecodeErrorZ {
4085                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4086                         result: Box::into_raw(Box::new(o)),
4087                 },
4088                 result_ok: true,
4089         }
4090 }
4091 #[no_mangle]
4092 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4093         CResult_InMemorySignerDecodeErrorZ {
4094                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4095                         err: Box::into_raw(Box::new(e)),
4096                 },
4097                 result_ok: false,
4098         }
4099 }
4100 #[no_mangle]
4101 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4102 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4103         fn drop(&mut self) {
4104                 if self.result_ok {
4105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4107                         }
4108                 } else {
4109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4111                         }
4112                 }
4113         }
4114 }
4115 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4116         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>) -> Self {
4117                 let contents = if o.result_ok {
4118                         let result = unsafe { o.contents.result };
4119                         unsafe { o.contents.result = std::ptr::null_mut() };
4120                         CResult_InMemorySignerDecodeErrorZPtr { result }
4121                 } else {
4122                         let err = unsafe { o.contents.err };
4123                         unsafe { o.contents.err = std::ptr::null_mut(); }
4124                         CResult_InMemorySignerDecodeErrorZPtr { err }
4125                 };
4126                 Self {
4127                         contents,
4128                         result_ok: o.result_ok,
4129                 }
4130         }
4131 }
4132 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4133         fn clone(&self) -> Self {
4134                 if self.result_ok {
4135                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4136                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4137                         } }
4138                 } else {
4139                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4140                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4141                         } }
4142                 }
4143         }
4144 }
4145 #[no_mangle]
4146 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
4147 #[repr(C)]
4148 pub struct CVec_TxOutZ {
4149         pub data: *mut crate::c_types::TxOut,
4150         pub datalen: usize
4151 }
4152 impl CVec_TxOutZ {
4153         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4154                 if self.datalen == 0 { return Vec::new(); }
4155                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4156                 self.data = std::ptr::null_mut();
4157                 self.datalen = 0;
4158                 ret
4159         }
4160         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4161                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4162         }
4163 }
4164 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4165         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4166                 let datalen = v.len();
4167                 let data = Box::into_raw(v.into_boxed_slice());
4168                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4169         }
4170 }
4171 #[no_mangle]
4172 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4173 impl Drop for CVec_TxOutZ {
4174         fn drop(&mut self) {
4175                 if self.datalen == 0 { return; }
4176                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4177         }
4178 }
4179 impl Clone for CVec_TxOutZ {
4180         fn clone(&self) -> Self {
4181                 let mut res = Vec::new();
4182                 if self.datalen == 0 { return Self::from(res); }
4183                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4184                 Self::from(res)
4185         }
4186 }
4187 #[repr(C)]
4188 pub union CResult_TransactionNoneZPtr {
4189         pub result: *mut crate::c_types::Transaction,
4190         /// Note that this value is always NULL, as there are no contents in the Err variant
4191         pub err: *mut std::ffi::c_void,
4192 }
4193 #[repr(C)]
4194 pub struct CResult_TransactionNoneZ {
4195         pub contents: CResult_TransactionNoneZPtr,
4196         pub result_ok: bool,
4197 }
4198 #[no_mangle]
4199 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4200         CResult_TransactionNoneZ {
4201                 contents: CResult_TransactionNoneZPtr {
4202                         result: Box::into_raw(Box::new(o)),
4203                 },
4204                 result_ok: true,
4205         }
4206 }
4207 #[no_mangle]
4208 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4209         CResult_TransactionNoneZ {
4210                 contents: CResult_TransactionNoneZPtr {
4211                         err: std::ptr::null_mut(),
4212                 },
4213                 result_ok: false,
4214         }
4215 }
4216 #[no_mangle]
4217 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
4218 impl Drop for CResult_TransactionNoneZ {
4219         fn drop(&mut self) {
4220                 if self.result_ok {
4221                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4222                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4223                         }
4224                 } else {
4225                 }
4226         }
4227 }
4228 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
4229         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
4230                 let contents = if o.result_ok {
4231                         let result = unsafe { o.contents.result };
4232                         unsafe { o.contents.result = std::ptr::null_mut() };
4233                         CResult_TransactionNoneZPtr { result }
4234                 } else {
4235                         let _ = unsafe { Box::from_raw(o.contents.err) };
4236                         o.contents.err = std::ptr::null_mut();
4237                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
4238                 };
4239                 Self {
4240                         contents,
4241                         result_ok: o.result_ok,
4242                 }
4243         }
4244 }
4245 #[repr(C)]
4246 pub struct CVec_RouteHopZ {
4247         pub data: *mut crate::routing::router::RouteHop,
4248         pub datalen: usize
4249 }
4250 impl CVec_RouteHopZ {
4251         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
4252                 if self.datalen == 0 { return Vec::new(); }
4253                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4254                 self.data = std::ptr::null_mut();
4255                 self.datalen = 0;
4256                 ret
4257         }
4258         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
4259                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4260         }
4261 }
4262 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
4263         fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
4264                 let datalen = v.len();
4265                 let data = Box::into_raw(v.into_boxed_slice());
4266                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4267         }
4268 }
4269 #[no_mangle]
4270 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4271 impl Drop for CVec_RouteHopZ {
4272         fn drop(&mut self) {
4273                 if self.datalen == 0 { return; }
4274                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4275         }
4276 }
4277 impl Clone for CVec_RouteHopZ {
4278         fn clone(&self) -> Self {
4279                 let mut res = Vec::new();
4280                 if self.datalen == 0 { return Self::from(res); }
4281                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4282                 Self::from(res)
4283         }
4284 }
4285 #[repr(C)]
4286 pub struct CVec_CVec_RouteHopZZ {
4287         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
4288         pub datalen: usize
4289 }
4290 impl CVec_CVec_RouteHopZZ {
4291         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
4292                 if self.datalen == 0 { return Vec::new(); }
4293                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4294                 self.data = std::ptr::null_mut();
4295                 self.datalen = 0;
4296                 ret
4297         }
4298         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
4299                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4300         }
4301 }
4302 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
4303         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
4304                 let datalen = v.len();
4305                 let data = Box::into_raw(v.into_boxed_slice());
4306                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4307         }
4308 }
4309 #[no_mangle]
4310 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
4311 impl Drop for CVec_CVec_RouteHopZZ {
4312         fn drop(&mut self) {
4313                 if self.datalen == 0 { return; }
4314                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4315         }
4316 }
4317 impl Clone for CVec_CVec_RouteHopZZ {
4318         fn clone(&self) -> Self {
4319                 let mut res = Vec::new();
4320                 if self.datalen == 0 { return Self::from(res); }
4321                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4322                 Self::from(res)
4323         }
4324 }
4325 #[repr(C)]
4326 pub union CResult_RouteDecodeErrorZPtr {
4327         pub result: *mut crate::routing::router::Route,
4328         pub err: *mut crate::ln::msgs::DecodeError,
4329 }
4330 #[repr(C)]
4331 pub struct CResult_RouteDecodeErrorZ {
4332         pub contents: CResult_RouteDecodeErrorZPtr,
4333         pub result_ok: bool,
4334 }
4335 #[no_mangle]
4336 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4337         CResult_RouteDecodeErrorZ {
4338                 contents: CResult_RouteDecodeErrorZPtr {
4339                         result: Box::into_raw(Box::new(o)),
4340                 },
4341                 result_ok: true,
4342         }
4343 }
4344 #[no_mangle]
4345 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4346         CResult_RouteDecodeErrorZ {
4347                 contents: CResult_RouteDecodeErrorZPtr {
4348                         err: Box::into_raw(Box::new(e)),
4349                 },
4350                 result_ok: false,
4351         }
4352 }
4353 #[no_mangle]
4354 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4355 impl Drop for CResult_RouteDecodeErrorZ {
4356         fn drop(&mut self) {
4357                 if self.result_ok {
4358                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4359                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4360                         }
4361                 } else {
4362                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4363                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4364                         }
4365                 }
4366         }
4367 }
4368 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4369         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
4370                 let contents = if o.result_ok {
4371                         let result = unsafe { o.contents.result };
4372                         unsafe { o.contents.result = std::ptr::null_mut() };
4373                         CResult_RouteDecodeErrorZPtr { result }
4374                 } else {
4375                         let err = unsafe { o.contents.err };
4376                         unsafe { o.contents.err = std::ptr::null_mut(); }
4377                         CResult_RouteDecodeErrorZPtr { err }
4378                 };
4379                 Self {
4380                         contents,
4381                         result_ok: o.result_ok,
4382                 }
4383         }
4384 }
4385 impl Clone for CResult_RouteDecodeErrorZ {
4386         fn clone(&self) -> Self {
4387                 if self.result_ok {
4388                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4389                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4390                         } }
4391                 } else {
4392                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4393                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4394                         } }
4395                 }
4396         }
4397 }
4398 #[no_mangle]
4399 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
4400 #[repr(C)]
4401 pub struct CVec_RouteHintZ {
4402         pub data: *mut crate::routing::router::RouteHint,
4403         pub datalen: usize
4404 }
4405 impl CVec_RouteHintZ {
4406         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
4407                 if self.datalen == 0 { return Vec::new(); }
4408                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4409                 self.data = std::ptr::null_mut();
4410                 self.datalen = 0;
4411                 ret
4412         }
4413         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
4414                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4415         }
4416 }
4417 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
4418         fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
4419                 let datalen = v.len();
4420                 let data = Box::into_raw(v.into_boxed_slice());
4421                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4422         }
4423 }
4424 #[no_mangle]
4425 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4426 impl Drop for CVec_RouteHintZ {
4427         fn drop(&mut self) {
4428                 if self.datalen == 0 { return; }
4429                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4430         }
4431 }
4432 impl Clone for CVec_RouteHintZ {
4433         fn clone(&self) -> Self {
4434                 let mut res = Vec::new();
4435                 if self.datalen == 0 { return Self::from(res); }
4436                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4437                 Self::from(res)
4438         }
4439 }
4440 #[repr(C)]
4441 pub union CResult_RouteLightningErrorZPtr {
4442         pub result: *mut crate::routing::router::Route,
4443         pub err: *mut crate::ln::msgs::LightningError,
4444 }
4445 #[repr(C)]
4446 pub struct CResult_RouteLightningErrorZ {
4447         pub contents: CResult_RouteLightningErrorZPtr,
4448         pub result_ok: bool,
4449 }
4450 #[no_mangle]
4451 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
4452         CResult_RouteLightningErrorZ {
4453                 contents: CResult_RouteLightningErrorZPtr {
4454                         result: Box::into_raw(Box::new(o)),
4455                 },
4456                 result_ok: true,
4457         }
4458 }
4459 #[no_mangle]
4460 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
4461         CResult_RouteLightningErrorZ {
4462                 contents: CResult_RouteLightningErrorZPtr {
4463                         err: Box::into_raw(Box::new(e)),
4464                 },
4465                 result_ok: false,
4466         }
4467 }
4468 #[no_mangle]
4469 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
4470 impl Drop for CResult_RouteLightningErrorZ {
4471         fn drop(&mut self) {
4472                 if self.result_ok {
4473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4475                         }
4476                 } else {
4477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4479                         }
4480                 }
4481         }
4482 }
4483 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
4484         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
4485                 let contents = if o.result_ok {
4486                         let result = unsafe { o.contents.result };
4487                         unsafe { o.contents.result = std::ptr::null_mut() };
4488                         CResult_RouteLightningErrorZPtr { result }
4489                 } else {
4490                         let err = unsafe { o.contents.err };
4491                         unsafe { o.contents.err = std::ptr::null_mut(); }
4492                         CResult_RouteLightningErrorZPtr { err }
4493                 };
4494                 Self {
4495                         contents,
4496                         result_ok: o.result_ok,
4497                 }
4498         }
4499 }
4500 impl Clone for CResult_RouteLightningErrorZ {
4501         fn clone(&self) -> Self {
4502                 if self.result_ok {
4503                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
4504                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4505                         } }
4506                 } else {
4507                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
4508                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4509                         } }
4510                 }
4511         }
4512 }
4513 #[no_mangle]
4514 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
4515 #[repr(C)]
4516 pub union CResult_NetAddressu8ZPtr {
4517         pub result: *mut crate::ln::msgs::NetAddress,
4518         pub err: *mut u8,
4519 }
4520 #[repr(C)]
4521 pub struct CResult_NetAddressu8Z {
4522         pub contents: CResult_NetAddressu8ZPtr,
4523         pub result_ok: bool,
4524 }
4525 #[no_mangle]
4526 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
4527         CResult_NetAddressu8Z {
4528                 contents: CResult_NetAddressu8ZPtr {
4529                         result: Box::into_raw(Box::new(o)),
4530                 },
4531                 result_ok: true,
4532         }
4533 }
4534 #[no_mangle]
4535 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
4536         CResult_NetAddressu8Z {
4537                 contents: CResult_NetAddressu8ZPtr {
4538                         err: Box::into_raw(Box::new(e)),
4539                 },
4540                 result_ok: false,
4541         }
4542 }
4543 #[no_mangle]
4544 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
4545 impl Drop for CResult_NetAddressu8Z {
4546         fn drop(&mut self) {
4547                 if self.result_ok {
4548                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4549                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4550                         }
4551                 } else {
4552                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4553                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4554                         }
4555                 }
4556         }
4557 }
4558 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
4559         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
4560                 let contents = if o.result_ok {
4561                         let result = unsafe { o.contents.result };
4562                         unsafe { o.contents.result = std::ptr::null_mut() };
4563                         CResult_NetAddressu8ZPtr { result }
4564                 } else {
4565                         let err = unsafe { o.contents.err };
4566                         unsafe { o.contents.err = std::ptr::null_mut(); }
4567                         CResult_NetAddressu8ZPtr { err }
4568                 };
4569                 Self {
4570                         contents,
4571                         result_ok: o.result_ok,
4572                 }
4573         }
4574 }
4575 impl Clone for CResult_NetAddressu8Z {
4576         fn clone(&self) -> Self {
4577                 if self.result_ok {
4578                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
4579                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
4580                         } }
4581                 } else {
4582                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
4583                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
4584                         } }
4585                 }
4586         }
4587 }
4588 #[no_mangle]
4589 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
4590 #[repr(C)]
4591 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4592         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
4593         pub err: *mut crate::ln::msgs::DecodeError,
4594 }
4595 #[repr(C)]
4596 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
4597         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
4598         pub result_ok: bool,
4599 }
4600 #[no_mangle]
4601 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4602         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4603                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4604                         result: Box::into_raw(Box::new(o)),
4605                 },
4606                 result_ok: true,
4607         }
4608 }
4609 #[no_mangle]
4610 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4611         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4612                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4613                         err: Box::into_raw(Box::new(e)),
4614                 },
4615                 result_ok: false,
4616         }
4617 }
4618 #[no_mangle]
4619 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
4620 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4621         fn drop(&mut self) {
4622                 if self.result_ok {
4623                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4624                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4625                         }
4626                 } else {
4627                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4628                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4629                         }
4630                 }
4631         }
4632 }
4633 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4634         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
4635                 let contents = if o.result_ok {
4636                         let result = unsafe { o.contents.result };
4637                         unsafe { o.contents.result = std::ptr::null_mut() };
4638                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
4639                 } else {
4640                         let err = unsafe { o.contents.err };
4641                         unsafe { o.contents.err = std::ptr::null_mut(); }
4642                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
4643                 };
4644                 Self {
4645                         contents,
4646                         result_ok: o.result_ok,
4647                 }
4648         }
4649 }
4650 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4651         fn clone(&self) -> Self {
4652                 if self.result_ok {
4653                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4654                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
4655                         } }
4656                 } else {
4657                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4658                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4659                         } }
4660                 }
4661         }
4662 }
4663 #[no_mangle]
4664 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
4665 #[repr(C)]
4666 pub struct CVec_UpdateAddHTLCZ {
4667         pub data: *mut crate::ln::msgs::UpdateAddHTLC,
4668         pub datalen: usize
4669 }
4670 impl CVec_UpdateAddHTLCZ {
4671         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
4672                 if self.datalen == 0 { return Vec::new(); }
4673                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4674                 self.data = std::ptr::null_mut();
4675                 self.datalen = 0;
4676                 ret
4677         }
4678         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
4679                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4680         }
4681 }
4682 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
4683         fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
4684                 let datalen = v.len();
4685                 let data = Box::into_raw(v.into_boxed_slice());
4686                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4687         }
4688 }
4689 #[no_mangle]
4690 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
4691 impl Drop for CVec_UpdateAddHTLCZ {
4692         fn drop(&mut self) {
4693                 if self.datalen == 0 { return; }
4694                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4695         }
4696 }
4697 impl Clone for CVec_UpdateAddHTLCZ {
4698         fn clone(&self) -> Self {
4699                 let mut res = Vec::new();
4700                 if self.datalen == 0 { return Self::from(res); }
4701                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4702                 Self::from(res)
4703         }
4704 }
4705 #[repr(C)]
4706 pub struct CVec_UpdateFulfillHTLCZ {
4707         pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
4708         pub datalen: usize
4709 }
4710 impl CVec_UpdateFulfillHTLCZ {
4711         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
4712                 if self.datalen == 0 { return Vec::new(); }
4713                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4714                 self.data = std::ptr::null_mut();
4715                 self.datalen = 0;
4716                 ret
4717         }
4718         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
4719                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4720         }
4721 }
4722 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
4723         fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
4724                 let datalen = v.len();
4725                 let data = Box::into_raw(v.into_boxed_slice());
4726                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4727         }
4728 }
4729 #[no_mangle]
4730 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
4731 impl Drop for CVec_UpdateFulfillHTLCZ {
4732         fn drop(&mut self) {
4733                 if self.datalen == 0 { return; }
4734                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4735         }
4736 }
4737 impl Clone for CVec_UpdateFulfillHTLCZ {
4738         fn clone(&self) -> Self {
4739                 let mut res = Vec::new();
4740                 if self.datalen == 0 { return Self::from(res); }
4741                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4742                 Self::from(res)
4743         }
4744 }
4745 #[repr(C)]
4746 pub struct CVec_UpdateFailHTLCZ {
4747         pub data: *mut crate::ln::msgs::UpdateFailHTLC,
4748         pub datalen: usize
4749 }
4750 impl CVec_UpdateFailHTLCZ {
4751         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
4752                 if self.datalen == 0 { return Vec::new(); }
4753                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4754                 self.data = std::ptr::null_mut();
4755                 self.datalen = 0;
4756                 ret
4757         }
4758         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
4759                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4760         }
4761 }
4762 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
4763         fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
4764                 let datalen = v.len();
4765                 let data = Box::into_raw(v.into_boxed_slice());
4766                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4767         }
4768 }
4769 #[no_mangle]
4770 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
4771 impl Drop for CVec_UpdateFailHTLCZ {
4772         fn drop(&mut self) {
4773                 if self.datalen == 0 { return; }
4774                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4775         }
4776 }
4777 impl Clone for CVec_UpdateFailHTLCZ {
4778         fn clone(&self) -> Self {
4779                 let mut res = Vec::new();
4780                 if self.datalen == 0 { return Self::from(res); }
4781                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4782                 Self::from(res)
4783         }
4784 }
4785 #[repr(C)]
4786 pub struct CVec_UpdateFailMalformedHTLCZ {
4787         pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
4788         pub datalen: usize
4789 }
4790 impl CVec_UpdateFailMalformedHTLCZ {
4791         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
4792                 if self.datalen == 0 { return Vec::new(); }
4793                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4794                 self.data = std::ptr::null_mut();
4795                 self.datalen = 0;
4796                 ret
4797         }
4798         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
4799                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4800         }
4801 }
4802 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
4803         fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
4804                 let datalen = v.len();
4805                 let data = Box::into_raw(v.into_boxed_slice());
4806                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4807         }
4808 }
4809 #[no_mangle]
4810 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
4811 impl Drop for CVec_UpdateFailMalformedHTLCZ {
4812         fn drop(&mut self) {
4813                 if self.datalen == 0 { return; }
4814                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4815         }
4816 }
4817 impl Clone for CVec_UpdateFailMalformedHTLCZ {
4818         fn clone(&self) -> Self {
4819                 let mut res = Vec::new();
4820                 if self.datalen == 0 { return Self::from(res); }
4821                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4822                 Self::from(res)
4823         }
4824 }
4825 #[repr(C)]
4826 pub union CResult_AcceptChannelDecodeErrorZPtr {
4827         pub result: *mut crate::ln::msgs::AcceptChannel,
4828         pub err: *mut crate::ln::msgs::DecodeError,
4829 }
4830 #[repr(C)]
4831 pub struct CResult_AcceptChannelDecodeErrorZ {
4832         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
4833         pub result_ok: bool,
4834 }
4835 #[no_mangle]
4836 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
4837         CResult_AcceptChannelDecodeErrorZ {
4838                 contents: CResult_AcceptChannelDecodeErrorZPtr {
4839                         result: Box::into_raw(Box::new(o)),
4840                 },
4841                 result_ok: true,
4842         }
4843 }
4844 #[no_mangle]
4845 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
4846         CResult_AcceptChannelDecodeErrorZ {
4847                 contents: CResult_AcceptChannelDecodeErrorZPtr {
4848                         err: Box::into_raw(Box::new(e)),
4849                 },
4850                 result_ok: false,
4851         }
4852 }
4853 #[no_mangle]
4854 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
4855 impl Drop for CResult_AcceptChannelDecodeErrorZ {
4856         fn drop(&mut self) {
4857                 if self.result_ok {
4858                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4859                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4860                         }
4861                 } else {
4862                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4863                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4864                         }
4865                 }
4866         }
4867 }
4868 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
4869         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>) -> Self {
4870                 let contents = if o.result_ok {
4871                         let result = unsafe { o.contents.result };
4872                         unsafe { o.contents.result = std::ptr::null_mut() };
4873                         CResult_AcceptChannelDecodeErrorZPtr { result }
4874                 } else {
4875                         let err = unsafe { o.contents.err };
4876                         unsafe { o.contents.err = std::ptr::null_mut(); }
4877                         CResult_AcceptChannelDecodeErrorZPtr { err }
4878                 };
4879                 Self {
4880                         contents,
4881                         result_ok: o.result_ok,
4882                 }
4883         }
4884 }
4885 impl Clone for CResult_AcceptChannelDecodeErrorZ {
4886         fn clone(&self) -> Self {
4887                 if self.result_ok {
4888                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
4889                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
4890                         } }
4891                 } else {
4892                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
4893                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4894                         } }
4895                 }
4896         }
4897 }
4898 #[no_mangle]
4899 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
4900 #[repr(C)]
4901 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
4902         pub result: *mut crate::ln::msgs::AnnouncementSignatures,
4903         pub err: *mut crate::ln::msgs::DecodeError,
4904 }
4905 #[repr(C)]
4906 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
4907         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
4908         pub result_ok: bool,
4909 }
4910 #[no_mangle]
4911 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
4912         CResult_AnnouncementSignaturesDecodeErrorZ {
4913                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4914                         result: Box::into_raw(Box::new(o)),
4915                 },
4916                 result_ok: true,
4917         }
4918 }
4919 #[no_mangle]
4920 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
4921         CResult_AnnouncementSignaturesDecodeErrorZ {
4922                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4923                         err: Box::into_raw(Box::new(e)),
4924                 },
4925                 result_ok: false,
4926         }
4927 }
4928 #[no_mangle]
4929 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
4930 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
4931         fn drop(&mut self) {
4932                 if self.result_ok {
4933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4935                         }
4936                 } else {
4937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4939                         }
4940                 }
4941         }
4942 }
4943 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
4944         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>) -> Self {
4945                 let contents = if o.result_ok {
4946                         let result = unsafe { o.contents.result };
4947                         unsafe { o.contents.result = std::ptr::null_mut() };
4948                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
4949                 } else {
4950                         let err = unsafe { o.contents.err };
4951                         unsafe { o.contents.err = std::ptr::null_mut(); }
4952                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
4953                 };
4954                 Self {
4955                         contents,
4956                         result_ok: o.result_ok,
4957                 }
4958         }
4959 }
4960 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
4961         fn clone(&self) -> Self {
4962                 if self.result_ok {
4963                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4964                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
4965                         } }
4966                 } else {
4967                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4968                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4969                         } }
4970                 }
4971         }
4972 }
4973 #[no_mangle]
4974 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
4975 #[repr(C)]
4976 pub union CResult_ChannelReestablishDecodeErrorZPtr {
4977         pub result: *mut crate::ln::msgs::ChannelReestablish,
4978         pub err: *mut crate::ln::msgs::DecodeError,
4979 }
4980 #[repr(C)]
4981 pub struct CResult_ChannelReestablishDecodeErrorZ {
4982         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
4983         pub result_ok: bool,
4984 }
4985 #[no_mangle]
4986 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
4987         CResult_ChannelReestablishDecodeErrorZ {
4988                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
4989                         result: Box::into_raw(Box::new(o)),
4990                 },
4991                 result_ok: true,
4992         }
4993 }
4994 #[no_mangle]
4995 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
4996         CResult_ChannelReestablishDecodeErrorZ {
4997                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
4998                         err: Box::into_raw(Box::new(e)),
4999                 },
5000                 result_ok: false,
5001         }
5002 }
5003 #[no_mangle]
5004 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
5005 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
5006         fn drop(&mut self) {
5007                 if self.result_ok {
5008                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5009                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5010                         }
5011                 } else {
5012                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5013                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5014                         }
5015                 }
5016         }
5017 }
5018 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
5019         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
5020                 let contents = if o.result_ok {
5021                         let result = unsafe { o.contents.result };
5022                         unsafe { o.contents.result = std::ptr::null_mut() };
5023                         CResult_ChannelReestablishDecodeErrorZPtr { result }
5024                 } else {
5025                         let err = unsafe { o.contents.err };
5026                         unsafe { o.contents.err = std::ptr::null_mut(); }
5027                         CResult_ChannelReestablishDecodeErrorZPtr { err }
5028                 };
5029                 Self {
5030                         contents,
5031                         result_ok: o.result_ok,
5032                 }
5033         }
5034 }
5035 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
5036         fn clone(&self) -> Self {
5037                 if self.result_ok {
5038                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5039                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
5040                         } }
5041                 } else {
5042                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5043                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5044                         } }
5045                 }
5046         }
5047 }
5048 #[no_mangle]
5049 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
5050 #[repr(C)]
5051 pub union CResult_ClosingSignedDecodeErrorZPtr {
5052         pub result: *mut crate::ln::msgs::ClosingSigned,
5053         pub err: *mut crate::ln::msgs::DecodeError,
5054 }
5055 #[repr(C)]
5056 pub struct CResult_ClosingSignedDecodeErrorZ {
5057         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
5058         pub result_ok: bool,
5059 }
5060 #[no_mangle]
5061 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
5062         CResult_ClosingSignedDecodeErrorZ {
5063                 contents: CResult_ClosingSignedDecodeErrorZPtr {
5064                         result: Box::into_raw(Box::new(o)),
5065                 },
5066                 result_ok: true,
5067         }
5068 }
5069 #[no_mangle]
5070 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
5071         CResult_ClosingSignedDecodeErrorZ {
5072                 contents: CResult_ClosingSignedDecodeErrorZPtr {
5073                         err: Box::into_raw(Box::new(e)),
5074                 },
5075                 result_ok: false,
5076         }
5077 }
5078 #[no_mangle]
5079 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
5080 impl Drop for CResult_ClosingSignedDecodeErrorZ {
5081         fn drop(&mut self) {
5082                 if self.result_ok {
5083                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5084                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5085                         }
5086                 } else {
5087                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5088                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5089                         }
5090                 }
5091         }
5092 }
5093 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
5094         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>) -> Self {
5095                 let contents = if o.result_ok {
5096                         let result = unsafe { o.contents.result };
5097                         unsafe { o.contents.result = std::ptr::null_mut() };
5098                         CResult_ClosingSignedDecodeErrorZPtr { result }
5099                 } else {
5100                         let err = unsafe { o.contents.err };
5101                         unsafe { o.contents.err = std::ptr::null_mut(); }
5102                         CResult_ClosingSignedDecodeErrorZPtr { err }
5103                 };
5104                 Self {
5105                         contents,
5106                         result_ok: o.result_ok,
5107                 }
5108         }
5109 }
5110 impl Clone for CResult_ClosingSignedDecodeErrorZ {
5111         fn clone(&self) -> Self {
5112                 if self.result_ok {
5113                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
5114                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
5115                         } }
5116                 } else {
5117                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
5118                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5119                         } }
5120                 }
5121         }
5122 }
5123 #[no_mangle]
5124 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
5125 #[repr(C)]
5126 pub union CResult_CommitmentSignedDecodeErrorZPtr {
5127         pub result: *mut crate::ln::msgs::CommitmentSigned,
5128         pub err: *mut crate::ln::msgs::DecodeError,
5129 }
5130 #[repr(C)]
5131 pub struct CResult_CommitmentSignedDecodeErrorZ {
5132         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
5133         pub result_ok: bool,
5134 }
5135 #[no_mangle]
5136 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
5137         CResult_CommitmentSignedDecodeErrorZ {
5138                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5139                         result: Box::into_raw(Box::new(o)),
5140                 },
5141                 result_ok: true,
5142         }
5143 }
5144 #[no_mangle]
5145 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
5146         CResult_CommitmentSignedDecodeErrorZ {
5147                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5148                         err: Box::into_raw(Box::new(e)),
5149                 },
5150                 result_ok: false,
5151         }
5152 }
5153 #[no_mangle]
5154 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
5155 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
5156         fn drop(&mut self) {
5157                 if self.result_ok {
5158                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5159                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5160                         }
5161                 } else {
5162                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5163                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5164                         }
5165                 }
5166         }
5167 }
5168 impl From<crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
5169         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>) -> Self {
5170                 let contents = if o.result_ok {
5171                         let result = unsafe { o.contents.result };
5172                         unsafe { o.contents.result = std::ptr::null_mut() };
5173                         CResult_CommitmentSignedDecodeErrorZPtr { result }
5174                 } else {
5175                         let err = unsafe { o.contents.err };
5176                         unsafe { o.contents.err = std::ptr::null_mut(); }
5177                         CResult_CommitmentSignedDecodeErrorZPtr { err }
5178                 };
5179                 Self {
5180                         contents,
5181                         result_ok: o.result_ok,
5182                 }
5183         }
5184 }
5185 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
5186         fn clone(&self) -> Self {
5187                 if self.result_ok {
5188                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5189                                 result: Box::into_raw(Box::new(<crate::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
5190                         } }
5191                 } else {
5192                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5193                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5194                         } }
5195                 }
5196         }
5197 }
5198 #[no_mangle]
5199 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
5200 #[repr(C)]
5201 pub union CResult_FundingCreatedDecodeErrorZPtr {
5202         pub result: *mut crate::ln::msgs::FundingCreated,
5203         pub err: *mut crate::ln::msgs::DecodeError,
5204 }
5205 #[repr(C)]
5206 pub struct CResult_FundingCreatedDecodeErrorZ {
5207         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
5208         pub result_ok: bool,
5209 }
5210 #[no_mangle]
5211 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
5212         CResult_FundingCreatedDecodeErrorZ {
5213                 contents: CResult_FundingCreatedDecodeErrorZPtr {
5214                         result: Box::into_raw(Box::new(o)),
5215                 },
5216                 result_ok: true,
5217         }
5218 }
5219 #[no_mangle]
5220 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
5221         CResult_FundingCreatedDecodeErrorZ {
5222                 contents: CResult_FundingCreatedDecodeErrorZPtr {
5223                         err: Box::into_raw(Box::new(e)),
5224                 },
5225                 result_ok: false,
5226         }
5227 }
5228 #[no_mangle]
5229 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
5230 impl Drop for CResult_FundingCreatedDecodeErrorZ {
5231         fn drop(&mut self) {
5232                 if self.result_ok {
5233                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5234                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5235                         }
5236                 } else {
5237                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5238                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5239                         }
5240                 }
5241         }
5242 }
5243 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
5244         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>) -> Self {
5245                 let contents = if o.result_ok {
5246                         let result = unsafe { o.contents.result };
5247                         unsafe { o.contents.result = std::ptr::null_mut() };
5248                         CResult_FundingCreatedDecodeErrorZPtr { result }
5249                 } else {
5250                         let err = unsafe { o.contents.err };
5251                         unsafe { o.contents.err = std::ptr::null_mut(); }
5252                         CResult_FundingCreatedDecodeErrorZPtr { err }
5253                 };
5254                 Self {
5255                         contents,
5256                         result_ok: o.result_ok,
5257                 }
5258         }
5259 }
5260 impl Clone for CResult_FundingCreatedDecodeErrorZ {
5261         fn clone(&self) -> Self {
5262                 if self.result_ok {
5263                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
5264                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
5265                         } }
5266                 } else {
5267                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
5268                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5269                         } }
5270                 }
5271         }
5272 }
5273 #[no_mangle]
5274 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
5275 #[repr(C)]
5276 pub union CResult_FundingSignedDecodeErrorZPtr {
5277         pub result: *mut crate::ln::msgs::FundingSigned,
5278         pub err: *mut crate::ln::msgs::DecodeError,
5279 }
5280 #[repr(C)]
5281 pub struct CResult_FundingSignedDecodeErrorZ {
5282         pub contents: CResult_FundingSignedDecodeErrorZPtr,
5283         pub result_ok: bool,
5284 }
5285 #[no_mangle]
5286 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
5287         CResult_FundingSignedDecodeErrorZ {
5288                 contents: CResult_FundingSignedDecodeErrorZPtr {
5289                         result: Box::into_raw(Box::new(o)),
5290                 },
5291                 result_ok: true,
5292         }
5293 }
5294 #[no_mangle]
5295 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
5296         CResult_FundingSignedDecodeErrorZ {
5297                 contents: CResult_FundingSignedDecodeErrorZPtr {
5298                         err: Box::into_raw(Box::new(e)),
5299                 },
5300                 result_ok: false,
5301         }
5302 }
5303 #[no_mangle]
5304 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
5305 impl Drop for CResult_FundingSignedDecodeErrorZ {
5306         fn drop(&mut self) {
5307                 if self.result_ok {
5308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5310                         }
5311                 } else {
5312                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5313                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5314                         }
5315                 }
5316         }
5317 }
5318 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
5319         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>) -> Self {
5320                 let contents = if o.result_ok {
5321                         let result = unsafe { o.contents.result };
5322                         unsafe { o.contents.result = std::ptr::null_mut() };
5323                         CResult_FundingSignedDecodeErrorZPtr { result }
5324                 } else {
5325                         let err = unsafe { o.contents.err };
5326                         unsafe { o.contents.err = std::ptr::null_mut(); }
5327                         CResult_FundingSignedDecodeErrorZPtr { err }
5328                 };
5329                 Self {
5330                         contents,
5331                         result_ok: o.result_ok,
5332                 }
5333         }
5334 }
5335 impl Clone for CResult_FundingSignedDecodeErrorZ {
5336         fn clone(&self) -> Self {
5337                 if self.result_ok {
5338                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
5339                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
5340                         } }
5341                 } else {
5342                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
5343                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5344                         } }
5345                 }
5346         }
5347 }
5348 #[no_mangle]
5349 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
5350 #[repr(C)]
5351 pub union CResult_FundingLockedDecodeErrorZPtr {
5352         pub result: *mut crate::ln::msgs::FundingLocked,
5353         pub err: *mut crate::ln::msgs::DecodeError,
5354 }
5355 #[repr(C)]
5356 pub struct CResult_FundingLockedDecodeErrorZ {
5357         pub contents: CResult_FundingLockedDecodeErrorZPtr,
5358         pub result_ok: bool,
5359 }
5360 #[no_mangle]
5361 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
5362         CResult_FundingLockedDecodeErrorZ {
5363                 contents: CResult_FundingLockedDecodeErrorZPtr {
5364                         result: Box::into_raw(Box::new(o)),
5365                 },
5366                 result_ok: true,
5367         }
5368 }
5369 #[no_mangle]
5370 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
5371         CResult_FundingLockedDecodeErrorZ {
5372                 contents: CResult_FundingLockedDecodeErrorZPtr {
5373                         err: Box::into_raw(Box::new(e)),
5374                 },
5375                 result_ok: false,
5376         }
5377 }
5378 #[no_mangle]
5379 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
5380 impl Drop for CResult_FundingLockedDecodeErrorZ {
5381         fn drop(&mut self) {
5382                 if self.result_ok {
5383                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5384                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5385                         }
5386                 } else {
5387                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5388                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5389                         }
5390                 }
5391         }
5392 }
5393 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
5394         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>) -> Self {
5395                 let contents = if o.result_ok {
5396                         let result = unsafe { o.contents.result };
5397                         unsafe { o.contents.result = std::ptr::null_mut() };
5398                         CResult_FundingLockedDecodeErrorZPtr { result }
5399                 } else {
5400                         let err = unsafe { o.contents.err };
5401                         unsafe { o.contents.err = std::ptr::null_mut(); }
5402                         CResult_FundingLockedDecodeErrorZPtr { err }
5403                 };
5404                 Self {
5405                         contents,
5406                         result_ok: o.result_ok,
5407                 }
5408         }
5409 }
5410 impl Clone for CResult_FundingLockedDecodeErrorZ {
5411         fn clone(&self) -> Self {
5412                 if self.result_ok {
5413                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
5414                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
5415                         } }
5416                 } else {
5417                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
5418                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5419                         } }
5420                 }
5421         }
5422 }
5423 #[no_mangle]
5424 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
5425 #[repr(C)]
5426 pub union CResult_InitDecodeErrorZPtr {
5427         pub result: *mut crate::ln::msgs::Init,
5428         pub err: *mut crate::ln::msgs::DecodeError,
5429 }
5430 #[repr(C)]
5431 pub struct CResult_InitDecodeErrorZ {
5432         pub contents: CResult_InitDecodeErrorZPtr,
5433         pub result_ok: bool,
5434 }
5435 #[no_mangle]
5436 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
5437         CResult_InitDecodeErrorZ {
5438                 contents: CResult_InitDecodeErrorZPtr {
5439                         result: Box::into_raw(Box::new(o)),
5440                 },
5441                 result_ok: true,
5442         }
5443 }
5444 #[no_mangle]
5445 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
5446         CResult_InitDecodeErrorZ {
5447                 contents: CResult_InitDecodeErrorZPtr {
5448                         err: Box::into_raw(Box::new(e)),
5449                 },
5450                 result_ok: false,
5451         }
5452 }
5453 #[no_mangle]
5454 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
5455 impl Drop for CResult_InitDecodeErrorZ {
5456         fn drop(&mut self) {
5457                 if self.result_ok {
5458                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5459                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5460                         }
5461                 } else {
5462                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5463                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5464                         }
5465                 }
5466         }
5467 }
5468 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
5469         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
5470                 let contents = if o.result_ok {
5471                         let result = unsafe { o.contents.result };
5472                         unsafe { o.contents.result = std::ptr::null_mut() };
5473                         CResult_InitDecodeErrorZPtr { result }
5474                 } else {
5475                         let err = unsafe { o.contents.err };
5476                         unsafe { o.contents.err = std::ptr::null_mut(); }
5477                         CResult_InitDecodeErrorZPtr { err }
5478                 };
5479                 Self {
5480                         contents,
5481                         result_ok: o.result_ok,
5482                 }
5483         }
5484 }
5485 impl Clone for CResult_InitDecodeErrorZ {
5486         fn clone(&self) -> Self {
5487                 if self.result_ok {
5488                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
5489                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
5490                         } }
5491                 } else {
5492                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
5493                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5494                         } }
5495                 }
5496         }
5497 }
5498 #[no_mangle]
5499 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
5500 #[repr(C)]
5501 pub union CResult_OpenChannelDecodeErrorZPtr {
5502         pub result: *mut crate::ln::msgs::OpenChannel,
5503         pub err: *mut crate::ln::msgs::DecodeError,
5504 }
5505 #[repr(C)]
5506 pub struct CResult_OpenChannelDecodeErrorZ {
5507         pub contents: CResult_OpenChannelDecodeErrorZPtr,
5508         pub result_ok: bool,
5509 }
5510 #[no_mangle]
5511 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
5512         CResult_OpenChannelDecodeErrorZ {
5513                 contents: CResult_OpenChannelDecodeErrorZPtr {
5514                         result: Box::into_raw(Box::new(o)),
5515                 },
5516                 result_ok: true,
5517         }
5518 }
5519 #[no_mangle]
5520 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
5521         CResult_OpenChannelDecodeErrorZ {
5522                 contents: CResult_OpenChannelDecodeErrorZPtr {
5523                         err: Box::into_raw(Box::new(e)),
5524                 },
5525                 result_ok: false,
5526         }
5527 }
5528 #[no_mangle]
5529 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
5530 impl Drop for CResult_OpenChannelDecodeErrorZ {
5531         fn drop(&mut self) {
5532                 if self.result_ok {
5533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5535                         }
5536                 } else {
5537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5539                         }
5540                 }
5541         }
5542 }
5543 impl From<crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
5544         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>) -> Self {
5545                 let contents = if o.result_ok {
5546                         let result = unsafe { o.contents.result };
5547                         unsafe { o.contents.result = std::ptr::null_mut() };
5548                         CResult_OpenChannelDecodeErrorZPtr { result }
5549                 } else {
5550                         let err = unsafe { o.contents.err };
5551                         unsafe { o.contents.err = std::ptr::null_mut(); }
5552                         CResult_OpenChannelDecodeErrorZPtr { err }
5553                 };
5554                 Self {
5555                         contents,
5556                         result_ok: o.result_ok,
5557                 }
5558         }
5559 }
5560 impl Clone for CResult_OpenChannelDecodeErrorZ {
5561         fn clone(&self) -> Self {
5562                 if self.result_ok {
5563                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
5564                                 result: Box::into_raw(Box::new(<crate::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
5565                         } }
5566                 } else {
5567                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
5568                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5569                         } }
5570                 }
5571         }
5572 }
5573 #[no_mangle]
5574 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
5575 #[repr(C)]
5576 pub union CResult_RevokeAndACKDecodeErrorZPtr {
5577         pub result: *mut crate::ln::msgs::RevokeAndACK,
5578         pub err: *mut crate::ln::msgs::DecodeError,
5579 }
5580 #[repr(C)]
5581 pub struct CResult_RevokeAndACKDecodeErrorZ {
5582         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
5583         pub result_ok: bool,
5584 }
5585 #[no_mangle]
5586 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
5587         CResult_RevokeAndACKDecodeErrorZ {
5588                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5589                         result: Box::into_raw(Box::new(o)),
5590                 },
5591                 result_ok: true,
5592         }
5593 }
5594 #[no_mangle]
5595 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
5596         CResult_RevokeAndACKDecodeErrorZ {
5597                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5598                         err: Box::into_raw(Box::new(e)),
5599                 },
5600                 result_ok: false,
5601         }
5602 }
5603 #[no_mangle]
5604 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
5605 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
5606         fn drop(&mut self) {
5607                 if self.result_ok {
5608                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5609                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5610                         }
5611                 } else {
5612                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5613                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5614                         }
5615                 }
5616         }
5617 }
5618 impl From<crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
5619         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>) -> Self {
5620                 let contents = if o.result_ok {
5621                         let result = unsafe { o.contents.result };
5622                         unsafe { o.contents.result = std::ptr::null_mut() };
5623                         CResult_RevokeAndACKDecodeErrorZPtr { result }
5624                 } else {
5625                         let err = unsafe { o.contents.err };
5626                         unsafe { o.contents.err = std::ptr::null_mut(); }
5627                         CResult_RevokeAndACKDecodeErrorZPtr { err }
5628                 };
5629                 Self {
5630                         contents,
5631                         result_ok: o.result_ok,
5632                 }
5633         }
5634 }
5635 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
5636         fn clone(&self) -> Self {
5637                 if self.result_ok {
5638                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5639                                 result: Box::into_raw(Box::new(<crate::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
5640                         } }
5641                 } else {
5642                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5643                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5644                         } }
5645                 }
5646         }
5647 }
5648 #[no_mangle]
5649 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
5650 #[repr(C)]
5651 pub union CResult_ShutdownDecodeErrorZPtr {
5652         pub result: *mut crate::ln::msgs::Shutdown,
5653         pub err: *mut crate::ln::msgs::DecodeError,
5654 }
5655 #[repr(C)]
5656 pub struct CResult_ShutdownDecodeErrorZ {
5657         pub contents: CResult_ShutdownDecodeErrorZPtr,
5658         pub result_ok: bool,
5659 }
5660 #[no_mangle]
5661 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
5662         CResult_ShutdownDecodeErrorZ {
5663                 contents: CResult_ShutdownDecodeErrorZPtr {
5664                         result: Box::into_raw(Box::new(o)),
5665                 },
5666                 result_ok: true,
5667         }
5668 }
5669 #[no_mangle]
5670 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
5671         CResult_ShutdownDecodeErrorZ {
5672                 contents: CResult_ShutdownDecodeErrorZPtr {
5673                         err: Box::into_raw(Box::new(e)),
5674                 },
5675                 result_ok: false,
5676         }
5677 }
5678 #[no_mangle]
5679 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
5680 impl Drop for CResult_ShutdownDecodeErrorZ {
5681         fn drop(&mut self) {
5682                 if self.result_ok {
5683                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5684                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5685                         }
5686                 } else {
5687                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5688                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5689                         }
5690                 }
5691         }
5692 }
5693 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
5694         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>) -> Self {
5695                 let contents = if o.result_ok {
5696                         let result = unsafe { o.contents.result };
5697                         unsafe { o.contents.result = std::ptr::null_mut() };
5698                         CResult_ShutdownDecodeErrorZPtr { result }
5699                 } else {
5700                         let err = unsafe { o.contents.err };
5701                         unsafe { o.contents.err = std::ptr::null_mut(); }
5702                         CResult_ShutdownDecodeErrorZPtr { err }
5703                 };
5704                 Self {
5705                         contents,
5706                         result_ok: o.result_ok,
5707                 }
5708         }
5709 }
5710 impl Clone for CResult_ShutdownDecodeErrorZ {
5711         fn clone(&self) -> Self {
5712                 if self.result_ok {
5713                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
5714                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
5715                         } }
5716                 } else {
5717                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
5718                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5719                         } }
5720                 }
5721         }
5722 }
5723 #[no_mangle]
5724 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
5725 #[repr(C)]
5726 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
5727         pub result: *mut crate::ln::msgs::UpdateFailHTLC,
5728         pub err: *mut crate::ln::msgs::DecodeError,
5729 }
5730 #[repr(C)]
5731 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
5732         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
5733         pub result_ok: bool,
5734 }
5735 #[no_mangle]
5736 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
5737         CResult_UpdateFailHTLCDecodeErrorZ {
5738                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5739                         result: Box::into_raw(Box::new(o)),
5740                 },
5741                 result_ok: true,
5742         }
5743 }
5744 #[no_mangle]
5745 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
5746         CResult_UpdateFailHTLCDecodeErrorZ {
5747                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5748                         err: Box::into_raw(Box::new(e)),
5749                 },
5750                 result_ok: false,
5751         }
5752 }
5753 #[no_mangle]
5754 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
5755 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
5756         fn drop(&mut self) {
5757                 if self.result_ok {
5758                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5759                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5760                         }
5761                 } else {
5762                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5763                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5764                         }
5765                 }
5766         }
5767 }
5768 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
5769         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>) -> Self {
5770                 let contents = if o.result_ok {
5771                         let result = unsafe { o.contents.result };
5772                         unsafe { o.contents.result = std::ptr::null_mut() };
5773                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
5774                 } else {
5775                         let err = unsafe { o.contents.err };
5776                         unsafe { o.contents.err = std::ptr::null_mut(); }
5777                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
5778                 };
5779                 Self {
5780                         contents,
5781                         result_ok: o.result_ok,
5782                 }
5783         }
5784 }
5785 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
5786         fn clone(&self) -> Self {
5787                 if self.result_ok {
5788                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5789                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
5790                         } }
5791                 } else {
5792                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5793                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5794                         } }
5795                 }
5796         }
5797 }
5798 #[no_mangle]
5799 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
5800 #[repr(C)]
5801 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5802         pub result: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
5803         pub err: *mut crate::ln::msgs::DecodeError,
5804 }
5805 #[repr(C)]
5806 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5807         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
5808         pub result_ok: bool,
5809 }
5810 #[no_mangle]
5811 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5812         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5813                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5814                         result: Box::into_raw(Box::new(o)),
5815                 },
5816                 result_ok: true,
5817         }
5818 }
5819 #[no_mangle]
5820 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5821         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5822                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5823                         err: Box::into_raw(Box::new(e)),
5824                 },
5825                 result_ok: false,
5826         }
5827 }
5828 #[no_mangle]
5829 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
5830 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5831         fn drop(&mut self) {
5832                 if self.result_ok {
5833                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5834                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5835                         }
5836                 } else {
5837                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5838                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5839                         }
5840                 }
5841         }
5842 }
5843 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5844         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>) -> Self {
5845                 let contents = if o.result_ok {
5846                         let result = unsafe { o.contents.result };
5847                         unsafe { o.contents.result = std::ptr::null_mut() };
5848                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
5849                 } else {
5850                         let err = unsafe { o.contents.err };
5851                         unsafe { o.contents.err = std::ptr::null_mut(); }
5852                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
5853                 };
5854                 Self {
5855                         contents,
5856                         result_ok: o.result_ok,
5857                 }
5858         }
5859 }
5860 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5861         fn clone(&self) -> Self {
5862                 if self.result_ok {
5863                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5864                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
5865                         } }
5866                 } else {
5867                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5868                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5869                         } }
5870                 }
5871         }
5872 }
5873 #[no_mangle]
5874 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
5875 #[repr(C)]
5876 pub union CResult_UpdateFeeDecodeErrorZPtr {
5877         pub result: *mut crate::ln::msgs::UpdateFee,
5878         pub err: *mut crate::ln::msgs::DecodeError,
5879 }
5880 #[repr(C)]
5881 pub struct CResult_UpdateFeeDecodeErrorZ {
5882         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
5883         pub result_ok: bool,
5884 }
5885 #[no_mangle]
5886 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
5887         CResult_UpdateFeeDecodeErrorZ {
5888                 contents: CResult_UpdateFeeDecodeErrorZPtr {
5889                         result: Box::into_raw(Box::new(o)),
5890                 },
5891                 result_ok: true,
5892         }
5893 }
5894 #[no_mangle]
5895 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
5896         CResult_UpdateFeeDecodeErrorZ {
5897                 contents: CResult_UpdateFeeDecodeErrorZPtr {
5898                         err: Box::into_raw(Box::new(e)),
5899                 },
5900                 result_ok: false,
5901         }
5902 }
5903 #[no_mangle]
5904 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
5905 impl Drop for CResult_UpdateFeeDecodeErrorZ {
5906         fn drop(&mut self) {
5907                 if self.result_ok {
5908                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5909                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5910                         }
5911                 } else {
5912                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5913                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5914                         }
5915                 }
5916         }
5917 }
5918 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
5919         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>) -> Self {
5920                 let contents = if o.result_ok {
5921                         let result = unsafe { o.contents.result };
5922                         unsafe { o.contents.result = std::ptr::null_mut() };
5923                         CResult_UpdateFeeDecodeErrorZPtr { result }
5924                 } else {
5925                         let err = unsafe { o.contents.err };
5926                         unsafe { o.contents.err = std::ptr::null_mut(); }
5927                         CResult_UpdateFeeDecodeErrorZPtr { err }
5928                 };
5929                 Self {
5930                         contents,
5931                         result_ok: o.result_ok,
5932                 }
5933         }
5934 }
5935 impl Clone for CResult_UpdateFeeDecodeErrorZ {
5936         fn clone(&self) -> Self {
5937                 if self.result_ok {
5938                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
5939                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
5940                         } }
5941                 } else {
5942                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
5943                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5944                         } }
5945                 }
5946         }
5947 }
5948 #[no_mangle]
5949 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
5950 #[repr(C)]
5951 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5952         pub result: *mut crate::ln::msgs::UpdateFulfillHTLC,
5953         pub err: *mut crate::ln::msgs::DecodeError,
5954 }
5955 #[repr(C)]
5956 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
5957         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
5958         pub result_ok: bool,
5959 }
5960 #[no_mangle]
5961 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
5962         CResult_UpdateFulfillHTLCDecodeErrorZ {
5963                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5964                         result: Box::into_raw(Box::new(o)),
5965                 },
5966                 result_ok: true,
5967         }
5968 }
5969 #[no_mangle]
5970 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
5971         CResult_UpdateFulfillHTLCDecodeErrorZ {
5972                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5973                         err: Box::into_raw(Box::new(e)),
5974                 },
5975                 result_ok: false,
5976         }
5977 }
5978 #[no_mangle]
5979 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
5980 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
5981         fn drop(&mut self) {
5982                 if self.result_ok {
5983                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5984                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5985                         }
5986                 } else {
5987                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5988                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5989                         }
5990                 }
5991         }
5992 }
5993 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
5994         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>) -> Self {
5995                 let contents = if o.result_ok {
5996                         let result = unsafe { o.contents.result };
5997                         unsafe { o.contents.result = std::ptr::null_mut() };
5998                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
5999                 } else {
6000                         let err = unsafe { o.contents.err };
6001                         unsafe { o.contents.err = std::ptr::null_mut(); }
6002                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
6003                 };
6004                 Self {
6005                         contents,
6006                         result_ok: o.result_ok,
6007                 }
6008         }
6009 }
6010 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
6011         fn clone(&self) -> Self {
6012                 if self.result_ok {
6013                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6014                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
6015                         } }
6016                 } else {
6017                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6018                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6019                         } }
6020                 }
6021         }
6022 }
6023 #[no_mangle]
6024 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
6025 #[repr(C)]
6026 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
6027         pub result: *mut crate::ln::msgs::UpdateAddHTLC,
6028         pub err: *mut crate::ln::msgs::DecodeError,
6029 }
6030 #[repr(C)]
6031 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
6032         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
6033         pub result_ok: bool,
6034 }
6035 #[no_mangle]
6036 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
6037         CResult_UpdateAddHTLCDecodeErrorZ {
6038                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6039                         result: Box::into_raw(Box::new(o)),
6040                 },
6041                 result_ok: true,
6042         }
6043 }
6044 #[no_mangle]
6045 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
6046         CResult_UpdateAddHTLCDecodeErrorZ {
6047                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6048                         err: Box::into_raw(Box::new(e)),
6049                 },
6050                 result_ok: false,
6051         }
6052 }
6053 #[no_mangle]
6054 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
6055 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
6056         fn drop(&mut self) {
6057                 if self.result_ok {
6058                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6059                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6060                         }
6061                 } else {
6062                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6063                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6064                         }
6065                 }
6066         }
6067 }
6068 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
6069         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>) -> Self {
6070                 let contents = if o.result_ok {
6071                         let result = unsafe { o.contents.result };
6072                         unsafe { o.contents.result = std::ptr::null_mut() };
6073                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
6074                 } else {
6075                         let err = unsafe { o.contents.err };
6076                         unsafe { o.contents.err = std::ptr::null_mut(); }
6077                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
6078                 };
6079                 Self {
6080                         contents,
6081                         result_ok: o.result_ok,
6082                 }
6083         }
6084 }
6085 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
6086         fn clone(&self) -> Self {
6087                 if self.result_ok {
6088                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6089                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
6090                         } }
6091                 } else {
6092                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6093                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6094                         } }
6095                 }
6096         }
6097 }
6098 #[no_mangle]
6099 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
6100 #[repr(C)]
6101 pub union CResult_PingDecodeErrorZPtr {
6102         pub result: *mut crate::ln::msgs::Ping,
6103         pub err: *mut crate::ln::msgs::DecodeError,
6104 }
6105 #[repr(C)]
6106 pub struct CResult_PingDecodeErrorZ {
6107         pub contents: CResult_PingDecodeErrorZPtr,
6108         pub result_ok: bool,
6109 }
6110 #[no_mangle]
6111 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
6112         CResult_PingDecodeErrorZ {
6113                 contents: CResult_PingDecodeErrorZPtr {
6114                         result: Box::into_raw(Box::new(o)),
6115                 },
6116                 result_ok: true,
6117         }
6118 }
6119 #[no_mangle]
6120 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
6121         CResult_PingDecodeErrorZ {
6122                 contents: CResult_PingDecodeErrorZPtr {
6123                         err: Box::into_raw(Box::new(e)),
6124                 },
6125                 result_ok: false,
6126         }
6127 }
6128 #[no_mangle]
6129 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
6130 impl Drop for CResult_PingDecodeErrorZ {
6131         fn drop(&mut self) {
6132                 if self.result_ok {
6133                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6134                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6135                         }
6136                 } else {
6137                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6138                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6139                         }
6140                 }
6141         }
6142 }
6143 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
6144         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
6145                 let contents = if o.result_ok {
6146                         let result = unsafe { o.contents.result };
6147                         unsafe { o.contents.result = std::ptr::null_mut() };
6148                         CResult_PingDecodeErrorZPtr { result }
6149                 } else {
6150                         let err = unsafe { o.contents.err };
6151                         unsafe { o.contents.err = std::ptr::null_mut(); }
6152                         CResult_PingDecodeErrorZPtr { err }
6153                 };
6154                 Self {
6155                         contents,
6156                         result_ok: o.result_ok,
6157                 }
6158         }
6159 }
6160 impl Clone for CResult_PingDecodeErrorZ {
6161         fn clone(&self) -> Self {
6162                 if self.result_ok {
6163                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
6164                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
6165                         } }
6166                 } else {
6167                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
6168                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6169                         } }
6170                 }
6171         }
6172 }
6173 #[no_mangle]
6174 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
6175 #[repr(C)]
6176 pub union CResult_PongDecodeErrorZPtr {
6177         pub result: *mut crate::ln::msgs::Pong,
6178         pub err: *mut crate::ln::msgs::DecodeError,
6179 }
6180 #[repr(C)]
6181 pub struct CResult_PongDecodeErrorZ {
6182         pub contents: CResult_PongDecodeErrorZPtr,
6183         pub result_ok: bool,
6184 }
6185 #[no_mangle]
6186 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
6187         CResult_PongDecodeErrorZ {
6188                 contents: CResult_PongDecodeErrorZPtr {
6189                         result: Box::into_raw(Box::new(o)),
6190                 },
6191                 result_ok: true,
6192         }
6193 }
6194 #[no_mangle]
6195 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
6196         CResult_PongDecodeErrorZ {
6197                 contents: CResult_PongDecodeErrorZPtr {
6198                         err: Box::into_raw(Box::new(e)),
6199                 },
6200                 result_ok: false,
6201         }
6202 }
6203 #[no_mangle]
6204 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
6205 impl Drop for CResult_PongDecodeErrorZ {
6206         fn drop(&mut self) {
6207                 if self.result_ok {
6208                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6209                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6210                         }
6211                 } else {
6212                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6213                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6214                         }
6215                 }
6216         }
6217 }
6218 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
6219         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
6220                 let contents = if o.result_ok {
6221                         let result = unsafe { o.contents.result };
6222                         unsafe { o.contents.result = std::ptr::null_mut() };
6223                         CResult_PongDecodeErrorZPtr { result }
6224                 } else {
6225                         let err = unsafe { o.contents.err };
6226                         unsafe { o.contents.err = std::ptr::null_mut(); }
6227                         CResult_PongDecodeErrorZPtr { err }
6228                 };
6229                 Self {
6230                         contents,
6231                         result_ok: o.result_ok,
6232                 }
6233         }
6234 }
6235 impl Clone for CResult_PongDecodeErrorZ {
6236         fn clone(&self) -> Self {
6237                 if self.result_ok {
6238                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
6239                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
6240                         } }
6241                 } else {
6242                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
6243                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6244                         } }
6245                 }
6246         }
6247 }
6248 #[no_mangle]
6249 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
6250 #[repr(C)]
6251 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6252         pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
6253         pub err: *mut crate::ln::msgs::DecodeError,
6254 }
6255 #[repr(C)]
6256 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6257         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
6258         pub result_ok: bool,
6259 }
6260 #[no_mangle]
6261 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6262         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6263                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6264                         result: Box::into_raw(Box::new(o)),
6265                 },
6266                 result_ok: true,
6267         }
6268 }
6269 #[no_mangle]
6270 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6271         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6272                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6273                         err: Box::into_raw(Box::new(e)),
6274                 },
6275                 result_ok: false,
6276         }
6277 }
6278 #[no_mangle]
6279 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
6280 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6281         fn drop(&mut self) {
6282                 if self.result_ok {
6283                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6284                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6285                         }
6286                 } else {
6287                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6288                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6289                         }
6290                 }
6291         }
6292 }
6293 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6294         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6295                 let contents = if o.result_ok {
6296                         let result = unsafe { o.contents.result };
6297                         unsafe { o.contents.result = std::ptr::null_mut() };
6298                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
6299                 } else {
6300                         let err = unsafe { o.contents.err };
6301                         unsafe { o.contents.err = std::ptr::null_mut(); }
6302                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
6303                 };
6304                 Self {
6305                         contents,
6306                         result_ok: o.result_ok,
6307                 }
6308         }
6309 }
6310 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6311         fn clone(&self) -> Self {
6312                 if self.result_ok {
6313                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6314                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6315                         } }
6316                 } else {
6317                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6318                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6319                         } }
6320                 }
6321         }
6322 }
6323 #[no_mangle]
6324 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
6325 #[repr(C)]
6326 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
6327         pub result: *mut crate::ln::msgs::ChannelAnnouncement,
6328         pub err: *mut crate::ln::msgs::DecodeError,
6329 }
6330 #[repr(C)]
6331 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
6332         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
6333         pub result_ok: bool,
6334 }
6335 #[no_mangle]
6336 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
6337         CResult_ChannelAnnouncementDecodeErrorZ {
6338                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6339                         result: Box::into_raw(Box::new(o)),
6340                 },
6341                 result_ok: true,
6342         }
6343 }
6344 #[no_mangle]
6345 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
6346         CResult_ChannelAnnouncementDecodeErrorZ {
6347                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6348                         err: Box::into_raw(Box::new(e)),
6349                 },
6350                 result_ok: false,
6351         }
6352 }
6353 #[no_mangle]
6354 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
6355 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
6356         fn drop(&mut self) {
6357                 if self.result_ok {
6358                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6359                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6360                         }
6361                 } else {
6362                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6363                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6364                         }
6365                 }
6366         }
6367 }
6368 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
6369         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6370                 let contents = if o.result_ok {
6371                         let result = unsafe { o.contents.result };
6372                         unsafe { o.contents.result = std::ptr::null_mut() };
6373                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
6374                 } else {
6375                         let err = unsafe { o.contents.err };
6376                         unsafe { o.contents.err = std::ptr::null_mut(); }
6377                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
6378                 };
6379                 Self {
6380                         contents,
6381                         result_ok: o.result_ok,
6382                 }
6383         }
6384 }
6385 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
6386         fn clone(&self) -> Self {
6387                 if self.result_ok {
6388                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6389                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6390                         } }
6391                 } else {
6392                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6393                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6394                         } }
6395                 }
6396         }
6397 }
6398 #[no_mangle]
6399 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
6400 #[repr(C)]
6401 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6402         pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
6403         pub err: *mut crate::ln::msgs::DecodeError,
6404 }
6405 #[repr(C)]
6406 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
6407         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
6408         pub result_ok: bool,
6409 }
6410 #[no_mangle]
6411 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6412         CResult_UnsignedChannelUpdateDecodeErrorZ {
6413                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6414                         result: Box::into_raw(Box::new(o)),
6415                 },
6416                 result_ok: true,
6417         }
6418 }
6419 #[no_mangle]
6420 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6421         CResult_UnsignedChannelUpdateDecodeErrorZ {
6422                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6423                         err: Box::into_raw(Box::new(e)),
6424                 },
6425                 result_ok: false,
6426         }
6427 }
6428 #[no_mangle]
6429 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
6430 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
6431         fn drop(&mut self) {
6432                 if self.result_ok {
6433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6435                         }
6436                 } else {
6437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6439                         }
6440                 }
6441         }
6442 }
6443 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
6444         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
6445                 let contents = if o.result_ok {
6446                         let result = unsafe { o.contents.result };
6447                         unsafe { o.contents.result = std::ptr::null_mut() };
6448                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
6449                 } else {
6450                         let err = unsafe { o.contents.err };
6451                         unsafe { o.contents.err = std::ptr::null_mut(); }
6452                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
6453                 };
6454                 Self {
6455                         contents,
6456                         result_ok: o.result_ok,
6457                 }
6458         }
6459 }
6460 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
6461         fn clone(&self) -> Self {
6462                 if self.result_ok {
6463                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6464                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
6465                         } }
6466                 } else {
6467                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6468                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6469                         } }
6470                 }
6471         }
6472 }
6473 #[no_mangle]
6474 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
6475 #[repr(C)]
6476 pub union CResult_ChannelUpdateDecodeErrorZPtr {
6477         pub result: *mut crate::ln::msgs::ChannelUpdate,
6478         pub err: *mut crate::ln::msgs::DecodeError,
6479 }
6480 #[repr(C)]
6481 pub struct CResult_ChannelUpdateDecodeErrorZ {
6482         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
6483         pub result_ok: bool,
6484 }
6485 #[no_mangle]
6486 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
6487         CResult_ChannelUpdateDecodeErrorZ {
6488                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
6489                         result: Box::into_raw(Box::new(o)),
6490                 },
6491                 result_ok: true,
6492         }
6493 }
6494 #[no_mangle]
6495 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
6496         CResult_ChannelUpdateDecodeErrorZ {
6497                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
6498                         err: Box::into_raw(Box::new(e)),
6499                 },
6500                 result_ok: false,
6501         }
6502 }
6503 #[no_mangle]
6504 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
6505 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
6506         fn drop(&mut self) {
6507                 if self.result_ok {
6508                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6509                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6510                         }
6511                 } else {
6512                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6513                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6514                         }
6515                 }
6516         }
6517 }
6518 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
6519         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
6520                 let contents = if o.result_ok {
6521                         let result = unsafe { o.contents.result };
6522                         unsafe { o.contents.result = std::ptr::null_mut() };
6523                         CResult_ChannelUpdateDecodeErrorZPtr { result }
6524                 } else {
6525                         let err = unsafe { o.contents.err };
6526                         unsafe { o.contents.err = std::ptr::null_mut(); }
6527                         CResult_ChannelUpdateDecodeErrorZPtr { err }
6528                 };
6529                 Self {
6530                         contents,
6531                         result_ok: o.result_ok,
6532                 }
6533         }
6534 }
6535 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
6536         fn clone(&self) -> Self {
6537                 if self.result_ok {
6538                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
6539                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
6540                         } }
6541                 } else {
6542                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
6543                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6544                         } }
6545                 }
6546         }
6547 }
6548 #[no_mangle]
6549 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
6550 #[repr(C)]
6551 pub union CResult_ErrorMessageDecodeErrorZPtr {
6552         pub result: *mut crate::ln::msgs::ErrorMessage,
6553         pub err: *mut crate::ln::msgs::DecodeError,
6554 }
6555 #[repr(C)]
6556 pub struct CResult_ErrorMessageDecodeErrorZ {
6557         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
6558         pub result_ok: bool,
6559 }
6560 #[no_mangle]
6561 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
6562         CResult_ErrorMessageDecodeErrorZ {
6563                 contents: CResult_ErrorMessageDecodeErrorZPtr {
6564                         result: Box::into_raw(Box::new(o)),
6565                 },
6566                 result_ok: true,
6567         }
6568 }
6569 #[no_mangle]
6570 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
6571         CResult_ErrorMessageDecodeErrorZ {
6572                 contents: CResult_ErrorMessageDecodeErrorZPtr {
6573                         err: Box::into_raw(Box::new(e)),
6574                 },
6575                 result_ok: false,
6576         }
6577 }
6578 #[no_mangle]
6579 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
6580 impl Drop for CResult_ErrorMessageDecodeErrorZ {
6581         fn drop(&mut self) {
6582                 if self.result_ok {
6583                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6584                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6585                         }
6586                 } else {
6587                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6588                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6589                         }
6590                 }
6591         }
6592 }
6593 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
6594         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
6595                 let contents = if o.result_ok {
6596                         let result = unsafe { o.contents.result };
6597                         unsafe { o.contents.result = std::ptr::null_mut() };
6598                         CResult_ErrorMessageDecodeErrorZPtr { result }
6599                 } else {
6600                         let err = unsafe { o.contents.err };
6601                         unsafe { o.contents.err = std::ptr::null_mut(); }
6602                         CResult_ErrorMessageDecodeErrorZPtr { err }
6603                 };
6604                 Self {
6605                         contents,
6606                         result_ok: o.result_ok,
6607                 }
6608         }
6609 }
6610 impl Clone for CResult_ErrorMessageDecodeErrorZ {
6611         fn clone(&self) -> Self {
6612                 if self.result_ok {
6613                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
6614                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
6615                         } }
6616                 } else {
6617                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
6618                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6619                         } }
6620                 }
6621         }
6622 }
6623 #[no_mangle]
6624 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
6625 #[repr(C)]
6626 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6627         pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
6628         pub err: *mut crate::ln::msgs::DecodeError,
6629 }
6630 #[repr(C)]
6631 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6632         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
6633         pub result_ok: bool,
6634 }
6635 #[no_mangle]
6636 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6637         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6638                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6639                         result: Box::into_raw(Box::new(o)),
6640                 },
6641                 result_ok: true,
6642         }
6643 }
6644 #[no_mangle]
6645 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6646         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6647                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6648                         err: Box::into_raw(Box::new(e)),
6649                 },
6650                 result_ok: false,
6651         }
6652 }
6653 #[no_mangle]
6654 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
6655 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6656         fn drop(&mut self) {
6657                 if self.result_ok {
6658                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6659                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6660                         }
6661                 } else {
6662                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6663                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6664                         }
6665                 }
6666         }
6667 }
6668 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6669         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6670                 let contents = if o.result_ok {
6671                         let result = unsafe { o.contents.result };
6672                         unsafe { o.contents.result = std::ptr::null_mut() };
6673                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
6674                 } else {
6675                         let err = unsafe { o.contents.err };
6676                         unsafe { o.contents.err = std::ptr::null_mut(); }
6677                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
6678                 };
6679                 Self {
6680                         contents,
6681                         result_ok: o.result_ok,
6682                 }
6683         }
6684 }
6685 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6686         fn clone(&self) -> Self {
6687                 if self.result_ok {
6688                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6689                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
6690                         } }
6691                 } else {
6692                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6693                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6694                         } }
6695                 }
6696         }
6697 }
6698 #[no_mangle]
6699 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
6700 #[repr(C)]
6701 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
6702         pub result: *mut crate::ln::msgs::NodeAnnouncement,
6703         pub err: *mut crate::ln::msgs::DecodeError,
6704 }
6705 #[repr(C)]
6706 pub struct CResult_NodeAnnouncementDecodeErrorZ {
6707         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
6708         pub result_ok: bool,
6709 }
6710 #[no_mangle]
6711 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
6712         CResult_NodeAnnouncementDecodeErrorZ {
6713                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6714                         result: Box::into_raw(Box::new(o)),
6715                 },
6716                 result_ok: true,
6717         }
6718 }
6719 #[no_mangle]
6720 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
6721         CResult_NodeAnnouncementDecodeErrorZ {
6722                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6723                         err: Box::into_raw(Box::new(e)),
6724                 },
6725                 result_ok: false,
6726         }
6727 }
6728 #[no_mangle]
6729 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
6730 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
6731         fn drop(&mut self) {
6732                 if self.result_ok {
6733                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6734                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6735                         }
6736                 } else {
6737                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6738                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6739                         }
6740                 }
6741         }
6742 }
6743 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
6744         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6745                 let contents = if o.result_ok {
6746                         let result = unsafe { o.contents.result };
6747                         unsafe { o.contents.result = std::ptr::null_mut() };
6748                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
6749                 } else {
6750                         let err = unsafe { o.contents.err };
6751                         unsafe { o.contents.err = std::ptr::null_mut(); }
6752                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
6753                 };
6754                 Self {
6755                         contents,
6756                         result_ok: o.result_ok,
6757                 }
6758         }
6759 }
6760 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
6761         fn clone(&self) -> Self {
6762                 if self.result_ok {
6763                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6764                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
6765                         } }
6766                 } else {
6767                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6768                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6769                         } }
6770                 }
6771         }
6772 }
6773 #[no_mangle]
6774 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
6775 #[repr(C)]
6776 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
6777         pub result: *mut crate::ln::msgs::QueryShortChannelIds,
6778         pub err: *mut crate::ln::msgs::DecodeError,
6779 }
6780 #[repr(C)]
6781 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
6782         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
6783         pub result_ok: bool,
6784 }
6785 #[no_mangle]
6786 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
6787         CResult_QueryShortChannelIdsDecodeErrorZ {
6788                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6789                         result: Box::into_raw(Box::new(o)),
6790                 },
6791                 result_ok: true,
6792         }
6793 }
6794 #[no_mangle]
6795 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
6796         CResult_QueryShortChannelIdsDecodeErrorZ {
6797                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6798                         err: Box::into_raw(Box::new(e)),
6799                 },
6800                 result_ok: false,
6801         }
6802 }
6803 #[no_mangle]
6804 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
6805 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
6806         fn drop(&mut self) {
6807                 if self.result_ok {
6808                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6809                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6810                         }
6811                 } else {
6812                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6813                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6814                         }
6815                 }
6816         }
6817 }
6818 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
6819         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
6820                 let contents = if o.result_ok {
6821                         let result = unsafe { o.contents.result };
6822                         unsafe { o.contents.result = std::ptr::null_mut() };
6823                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
6824                 } else {
6825                         let err = unsafe { o.contents.err };
6826                         unsafe { o.contents.err = std::ptr::null_mut(); }
6827                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
6828                 };
6829                 Self {
6830                         contents,
6831                         result_ok: o.result_ok,
6832                 }
6833         }
6834 }
6835 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
6836         fn clone(&self) -> Self {
6837                 if self.result_ok {
6838                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6839                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
6840                         } }
6841                 } else {
6842                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6843                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6844                         } }
6845                 }
6846         }
6847 }
6848 #[no_mangle]
6849 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
6850 #[repr(C)]
6851 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6852         pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
6853         pub err: *mut crate::ln::msgs::DecodeError,
6854 }
6855 #[repr(C)]
6856 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6857         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
6858         pub result_ok: bool,
6859 }
6860 #[no_mangle]
6861 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6862         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6863                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6864                         result: Box::into_raw(Box::new(o)),
6865                 },
6866                 result_ok: true,
6867         }
6868 }
6869 #[no_mangle]
6870 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6871         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6872                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6873                         err: Box::into_raw(Box::new(e)),
6874                 },
6875                 result_ok: false,
6876         }
6877 }
6878 #[no_mangle]
6879 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
6880 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6881         fn drop(&mut self) {
6882                 if self.result_ok {
6883                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6884                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6885                         }
6886                 } else {
6887                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6888                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6889                         }
6890                 }
6891         }
6892 }
6893 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6894         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
6895                 let contents = if o.result_ok {
6896                         let result = unsafe { o.contents.result };
6897                         unsafe { o.contents.result = std::ptr::null_mut() };
6898                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
6899                 } else {
6900                         let err = unsafe { o.contents.err };
6901                         unsafe { o.contents.err = std::ptr::null_mut(); }
6902                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
6903                 };
6904                 Self {
6905                         contents,
6906                         result_ok: o.result_ok,
6907                 }
6908         }
6909 }
6910 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6911         fn clone(&self) -> Self {
6912                 if self.result_ok {
6913                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6914                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
6915                         } }
6916                 } else {
6917                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6918                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6919                         } }
6920                 }
6921         }
6922 }
6923 #[no_mangle]
6924 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
6925 #[repr(C)]
6926 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
6927         pub result: *mut crate::ln::msgs::QueryChannelRange,
6928         pub err: *mut crate::ln::msgs::DecodeError,
6929 }
6930 #[repr(C)]
6931 pub struct CResult_QueryChannelRangeDecodeErrorZ {
6932         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
6933         pub result_ok: bool,
6934 }
6935 #[no_mangle]
6936 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
6937         CResult_QueryChannelRangeDecodeErrorZ {
6938                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6939                         result: Box::into_raw(Box::new(o)),
6940                 },
6941                 result_ok: true,
6942         }
6943 }
6944 #[no_mangle]
6945 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
6946         CResult_QueryChannelRangeDecodeErrorZ {
6947                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6948                         err: Box::into_raw(Box::new(e)),
6949                 },
6950                 result_ok: false,
6951         }
6952 }
6953 #[no_mangle]
6954 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
6955 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
6956         fn drop(&mut self) {
6957                 if self.result_ok {
6958                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6959                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6960                         }
6961                 } else {
6962                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6963                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6964                         }
6965                 }
6966         }
6967 }
6968 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
6969         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
6970                 let contents = if o.result_ok {
6971                         let result = unsafe { o.contents.result };
6972                         unsafe { o.contents.result = std::ptr::null_mut() };
6973                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
6974                 } else {
6975                         let err = unsafe { o.contents.err };
6976                         unsafe { o.contents.err = std::ptr::null_mut(); }
6977                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
6978                 };
6979                 Self {
6980                         contents,
6981                         result_ok: o.result_ok,
6982                 }
6983         }
6984 }
6985 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
6986         fn clone(&self) -> Self {
6987                 if self.result_ok {
6988                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6989                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
6990                         } }
6991                 } else {
6992                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6993                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6994                         } }
6995                 }
6996         }
6997 }
6998 #[no_mangle]
6999 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
7000 #[repr(C)]
7001 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
7002         pub result: *mut crate::ln::msgs::ReplyChannelRange,
7003         pub err: *mut crate::ln::msgs::DecodeError,
7004 }
7005 #[repr(C)]
7006 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
7007         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
7008         pub result_ok: bool,
7009 }
7010 #[no_mangle]
7011 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
7012         CResult_ReplyChannelRangeDecodeErrorZ {
7013                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7014                         result: Box::into_raw(Box::new(o)),
7015                 },
7016                 result_ok: true,
7017         }
7018 }
7019 #[no_mangle]
7020 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
7021         CResult_ReplyChannelRangeDecodeErrorZ {
7022                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7023                         err: Box::into_raw(Box::new(e)),
7024                 },
7025                 result_ok: false,
7026         }
7027 }
7028 #[no_mangle]
7029 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
7030 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
7031         fn drop(&mut self) {
7032                 if self.result_ok {
7033                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7034                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7035                         }
7036                 } else {
7037                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7038                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7039                         }
7040                 }
7041         }
7042 }
7043 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
7044         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
7045                 let contents = if o.result_ok {
7046                         let result = unsafe { o.contents.result };
7047                         unsafe { o.contents.result = std::ptr::null_mut() };
7048                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
7049                 } else {
7050                         let err = unsafe { o.contents.err };
7051                         unsafe { o.contents.err = std::ptr::null_mut(); }
7052                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
7053                 };
7054                 Self {
7055                         contents,
7056                         result_ok: o.result_ok,
7057                 }
7058         }
7059 }
7060 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
7061         fn clone(&self) -> Self {
7062                 if self.result_ok {
7063                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7064                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
7065                         } }
7066                 } else {
7067                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7068                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7069                         } }
7070                 }
7071         }
7072 }
7073 #[no_mangle]
7074 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
7075 #[repr(C)]
7076 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
7077         pub result: *mut crate::ln::msgs::GossipTimestampFilter,
7078         pub err: *mut crate::ln::msgs::DecodeError,
7079 }
7080 #[repr(C)]
7081 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
7082         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
7083         pub result_ok: bool,
7084 }
7085 #[no_mangle]
7086 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
7087         CResult_GossipTimestampFilterDecodeErrorZ {
7088                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7089                         result: Box::into_raw(Box::new(o)),
7090                 },
7091                 result_ok: true,
7092         }
7093 }
7094 #[no_mangle]
7095 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
7096         CResult_GossipTimestampFilterDecodeErrorZ {
7097                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7098                         err: Box::into_raw(Box::new(e)),
7099                 },
7100                 result_ok: false,
7101         }
7102 }
7103 #[no_mangle]
7104 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
7105 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
7106         fn drop(&mut self) {
7107                 if self.result_ok {
7108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7110                         }
7111                 } else {
7112                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7113                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7114                         }
7115                 }
7116         }
7117 }
7118 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
7119         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
7120                 let contents = if o.result_ok {
7121                         let result = unsafe { o.contents.result };
7122                         unsafe { o.contents.result = std::ptr::null_mut() };
7123                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
7124                 } else {
7125                         let err = unsafe { o.contents.err };
7126                         unsafe { o.contents.err = std::ptr::null_mut(); }
7127                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
7128                 };
7129                 Self {
7130                         contents,
7131                         result_ok: o.result_ok,
7132                 }
7133         }
7134 }
7135 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
7136         fn clone(&self) -> Self {
7137                 if self.result_ok {
7138                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7139                                 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
7140                         } }
7141                 } else {
7142                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7143                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7144                         } }
7145                 }
7146         }
7147 }
7148 #[no_mangle]
7149 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }