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