Update auto-generated bindings to latest upstream
[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 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3032 /// This corresponds to std::vector in C++
3033 pub struct CVec_TxidZ {
3034         /// The elements in the array.
3035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3036         pub data: *mut crate::c_types::ThirtyTwoBytes,
3037         /// The number of elements pointed to by `data`.
3038         pub datalen: usize
3039 }
3040 impl CVec_TxidZ {
3041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3042                 if self.datalen == 0 { return Vec::new(); }
3043                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3044                 self.data = std::ptr::null_mut();
3045                 self.datalen = 0;
3046                 ret
3047         }
3048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3049                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3050         }
3051 }
3052 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3053         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3054                 let datalen = v.len();
3055                 let data = Box::into_raw(v.into_boxed_slice());
3056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3057         }
3058 }
3059 #[no_mangle]
3060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3061 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3062 impl Drop for CVec_TxidZ {
3063         fn drop(&mut self) {
3064                 if self.datalen == 0 { return; }
3065                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3066         }
3067 }
3068 #[repr(C)]
3069 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3070 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3071         /// Note that this value is always NULL, as there are no contents in the OK variant
3072         pub result: *mut std::ffi::c_void,
3073         /// A pointer to the contents in the error state.
3074         /// Reading from this pointer when `result_ok` is set is undefined.
3075         pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
3076 }
3077 #[repr(C)]
3078 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3079 /// containing a () on success and a crate::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
3080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3081 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3082         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3083         /// `err` or `result` depending on the state of `result_ok`.
3084         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3085         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3086         pub result_ok: bool,
3087 }
3088 #[no_mangle]
3089 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3090 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3091         CResult_NoneChannelMonitorUpdateErrZ {
3092                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3093                         result: std::ptr::null_mut(),
3094                 },
3095                 result_ok: true,
3096         }
3097 }
3098 #[no_mangle]
3099 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3100 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3101         CResult_NoneChannelMonitorUpdateErrZ {
3102                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3103                         err: Box::into_raw(Box::new(e)),
3104                 },
3105                 result_ok: false,
3106         }
3107 }
3108 #[no_mangle]
3109 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3110 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3111 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3112         fn drop(&mut self) {
3113                 if self.result_ok {
3114                 } else {
3115                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3116                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3117                         }
3118                 }
3119         }
3120 }
3121 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3122         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
3123                 let contents = if o.result_ok {
3124                         let _ = unsafe { Box::from_raw(o.contents.result) };
3125                         o.contents.result = std::ptr::null_mut();
3126                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
3127                 } else {
3128                         let err = unsafe { o.contents.err };
3129                         unsafe { o.contents.err = std::ptr::null_mut(); }
3130                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3131                 };
3132                 Self {
3133                         contents,
3134                         result_ok: o.result_ok,
3135                 }
3136         }
3137 }
3138 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3139         fn clone(&self) -> Self {
3140                 if self.result_ok {
3141                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3142                                 result: std::ptr::null_mut()
3143                         } }
3144                 } else {
3145                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3146                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3147                         } }
3148                 }
3149         }
3150 }
3151 #[no_mangle]
3152 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3153 /// but with all dynamically-allocated buffers duplicated in new buffers.
3154 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
3155 #[repr(C)]
3156 /// A dynamically-allocated array of crate::chain::channelmonitor::MonitorEvents of arbitrary size.
3157 /// This corresponds to std::vector in C++
3158 pub struct CVec_MonitorEventZ {
3159         /// The elements in the array.
3160         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3161         pub data: *mut crate::chain::channelmonitor::MonitorEvent,
3162         /// The number of elements pointed to by `data`.
3163         pub datalen: usize
3164 }
3165 impl CVec_MonitorEventZ {
3166         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
3167                 if self.datalen == 0 { return Vec::new(); }
3168                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3169                 self.data = std::ptr::null_mut();
3170                 self.datalen = 0;
3171                 ret
3172         }
3173         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
3174                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3175         }
3176 }
3177 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3178         fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
3179                 let datalen = v.len();
3180                 let data = Box::into_raw(v.into_boxed_slice());
3181                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3182         }
3183 }
3184 #[no_mangle]
3185 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3186 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3187 impl Drop for CVec_MonitorEventZ {
3188         fn drop(&mut self) {
3189                 if self.datalen == 0 { return; }
3190                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3191         }
3192 }
3193 impl Clone for CVec_MonitorEventZ {
3194         fn clone(&self) -> Self {
3195                 let mut res = Vec::new();
3196                 if self.datalen == 0 { return Self::from(res); }
3197                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3198                 Self::from(res)
3199         }
3200 }
3201 #[repr(C)]
3202 /// A dynamically-allocated array of crate::util::events::Events of arbitrary size.
3203 /// This corresponds to std::vector in C++
3204 pub struct CVec_EventZ {
3205         /// The elements in the array.
3206         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3207         pub data: *mut crate::util::events::Event,
3208         /// The number of elements pointed to by `data`.
3209         pub datalen: usize
3210 }
3211 impl CVec_EventZ {
3212         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
3213                 if self.datalen == 0 { return Vec::new(); }
3214                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3215                 self.data = std::ptr::null_mut();
3216                 self.datalen = 0;
3217                 ret
3218         }
3219         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
3220                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3221         }
3222 }
3223 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
3224         fn from(v: Vec<crate::util::events::Event>) -> Self {
3225                 let datalen = v.len();
3226                 let data = Box::into_raw(v.into_boxed_slice());
3227                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3228         }
3229 }
3230 #[no_mangle]
3231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3232 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
3233 impl Drop for CVec_EventZ {
3234         fn drop(&mut self) {
3235                 if self.datalen == 0 { return; }
3236                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3237         }
3238 }
3239 impl Clone for CVec_EventZ {
3240         fn clone(&self) -> Self {
3241                 let mut res = Vec::new();
3242                 if self.datalen == 0 { return Self::from(res); }
3243                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3244                 Self::from(res)
3245         }
3246 }
3247 #[repr(C)]
3248 /// The contents of CResult_OutPointDecodeErrorZ
3249 pub union CResult_OutPointDecodeErrorZPtr {
3250         /// A pointer to the contents in the success state.
3251         /// Reading from this pointer when `result_ok` is not set is undefined.
3252         pub result: *mut crate::chain::transaction::OutPoint,
3253         /// A pointer to the contents in the error state.
3254         /// Reading from this pointer when `result_ok` is set is undefined.
3255         pub err: *mut crate::ln::msgs::DecodeError,
3256 }
3257 #[repr(C)]
3258 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
3259 /// containing a crate::chain::transaction::OutPoint on success and a crate::ln::msgs::DecodeError on failure.
3260 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3261 pub struct CResult_OutPointDecodeErrorZ {
3262         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
3263         /// `err` or `result` depending on the state of `result_ok`.
3264         pub contents: CResult_OutPointDecodeErrorZPtr,
3265         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
3266         pub result_ok: bool,
3267 }
3268 #[no_mangle]
3269 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
3270 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
3271         CResult_OutPointDecodeErrorZ {
3272                 contents: CResult_OutPointDecodeErrorZPtr {
3273                         result: Box::into_raw(Box::new(o)),
3274                 },
3275                 result_ok: true,
3276         }
3277 }
3278 #[no_mangle]
3279 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
3280 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
3281         CResult_OutPointDecodeErrorZ {
3282                 contents: CResult_OutPointDecodeErrorZPtr {
3283                         err: Box::into_raw(Box::new(e)),
3284                 },
3285                 result_ok: false,
3286         }
3287 }
3288 #[no_mangle]
3289 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
3290 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
3291 impl Drop for CResult_OutPointDecodeErrorZ {
3292         fn drop(&mut self) {
3293                 if self.result_ok {
3294                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3295                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3296                         }
3297                 } else {
3298                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3299                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3300                         }
3301                 }
3302         }
3303 }
3304 impl From<crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
3305         fn from(mut o: crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>) -> Self {
3306                 let contents = if o.result_ok {
3307                         let result = unsafe { o.contents.result };
3308                         unsafe { o.contents.result = std::ptr::null_mut() };
3309                         CResult_OutPointDecodeErrorZPtr { result }
3310                 } else {
3311                         let err = unsafe { o.contents.err };
3312                         unsafe { o.contents.err = std::ptr::null_mut(); }
3313                         CResult_OutPointDecodeErrorZPtr { err }
3314                 };
3315                 Self {
3316                         contents,
3317                         result_ok: o.result_ok,
3318                 }
3319         }
3320 }
3321 impl Clone for CResult_OutPointDecodeErrorZ {
3322         fn clone(&self) -> Self {
3323                 if self.result_ok {
3324                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
3325                                 result: Box::into_raw(Box::new(<crate::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
3326                         } }
3327                 } else {
3328                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
3329                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3330                         } }
3331                 }
3332         }
3333 }
3334 #[no_mangle]
3335 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
3336 /// but with all dynamically-allocated buffers duplicated in new buffers.
3337 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
3338 #[repr(C)]
3339 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
3340 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3341         /// A pointer to the contents in the success state.
3342         /// Reading from this pointer when `result_ok` is not set is undefined.
3343         pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
3344         /// A pointer to the contents in the error state.
3345         /// Reading from this pointer when `result_ok` is set is undefined.
3346         pub err: *mut crate::ln::msgs::DecodeError,
3347 }
3348 #[repr(C)]
3349 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
3350 /// containing a crate::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::ln::msgs::DecodeError on failure.
3351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3352 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
3353         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
3354         /// `err` or `result` depending on the state of `result_ok`.
3355         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
3356         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
3357         pub result_ok: bool,
3358 }
3359 #[no_mangle]
3360 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
3361 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
3362         CResult_ChannelMonitorUpdateDecodeErrorZ {
3363                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3364                         result: Box::into_raw(Box::new(o)),
3365                 },
3366                 result_ok: true,
3367         }
3368 }
3369 #[no_mangle]
3370 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
3371 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
3372         CResult_ChannelMonitorUpdateDecodeErrorZ {
3373                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3374                         err: Box::into_raw(Box::new(e)),
3375                 },
3376                 result_ok: false,
3377         }
3378 }
3379 #[no_mangle]
3380 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
3381 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
3382 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
3383         fn drop(&mut self) {
3384                 if self.result_ok {
3385                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3386                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3387                         }
3388                 } else {
3389                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3390                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3391                         }
3392                 }
3393         }
3394 }
3395 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
3396         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
3397                 let contents = if o.result_ok {
3398                         let result = unsafe { o.contents.result };
3399                         unsafe { o.contents.result = std::ptr::null_mut() };
3400                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
3401                 } else {
3402                         let err = unsafe { o.contents.err };
3403                         unsafe { o.contents.err = std::ptr::null_mut(); }
3404                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
3405                 };
3406                 Self {
3407                         contents,
3408                         result_ok: o.result_ok,
3409                 }
3410         }
3411 }
3412 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
3413         fn clone(&self) -> Self {
3414                 if self.result_ok {
3415                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3416                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
3417                         } }
3418                 } else {
3419                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3420                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3421                         } }
3422                 }
3423         }
3424 }
3425 #[no_mangle]
3426 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
3427 /// but with all dynamically-allocated buffers duplicated in new buffers.
3428 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
3429 #[repr(C)]
3430 /// The contents of CResult_HTLCUpdateDecodeErrorZ
3431 pub union CResult_HTLCUpdateDecodeErrorZPtr {
3432         /// A pointer to the contents in the success state.
3433         /// Reading from this pointer when `result_ok` is not set is undefined.
3434         pub result: *mut crate::chain::channelmonitor::HTLCUpdate,
3435         /// A pointer to the contents in the error state.
3436         /// Reading from this pointer when `result_ok` is set is undefined.
3437         pub err: *mut crate::ln::msgs::DecodeError,
3438 }
3439 #[repr(C)]
3440 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
3441 /// containing a crate::chain::channelmonitor::HTLCUpdate on success and a crate::ln::msgs::DecodeError on failure.
3442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3443 pub struct CResult_HTLCUpdateDecodeErrorZ {
3444         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
3445         /// `err` or `result` depending on the state of `result_ok`.
3446         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
3447         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
3448         pub result_ok: bool,
3449 }
3450 #[no_mangle]
3451 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
3452 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
3453         CResult_HTLCUpdateDecodeErrorZ {
3454                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
3455                         result: Box::into_raw(Box::new(o)),
3456                 },
3457                 result_ok: true,
3458         }
3459 }
3460 #[no_mangle]
3461 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
3462 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
3463         CResult_HTLCUpdateDecodeErrorZ {
3464                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
3465                         err: Box::into_raw(Box::new(e)),
3466                 },
3467                 result_ok: false,
3468         }
3469 }
3470 #[no_mangle]
3471 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
3472 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
3473 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
3474         fn drop(&mut self) {
3475                 if self.result_ok {
3476                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3477                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3478                         }
3479                 } else {
3480                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3481                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3482                         }
3483                 }
3484         }
3485 }
3486 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
3487         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>) -> Self {
3488                 let contents = if o.result_ok {
3489                         let result = unsafe { o.contents.result };
3490                         unsafe { o.contents.result = std::ptr::null_mut() };
3491                         CResult_HTLCUpdateDecodeErrorZPtr { result }
3492                 } else {
3493                         let err = unsafe { o.contents.err };
3494                         unsafe { o.contents.err = std::ptr::null_mut(); }
3495                         CResult_HTLCUpdateDecodeErrorZPtr { err }
3496                 };
3497                 Self {
3498                         contents,
3499                         result_ok: o.result_ok,
3500                 }
3501         }
3502 }
3503 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
3504         fn clone(&self) -> Self {
3505                 if self.result_ok {
3506                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
3507                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
3508                         } }
3509                 } else {
3510                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
3511                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3512                         } }
3513                 }
3514         }
3515 }
3516 #[no_mangle]
3517 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
3518 /// but with all dynamically-allocated buffers duplicated in new buffers.
3519 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
3520 #[repr(C)]
3521 /// The contents of CResult_NoneMonitorUpdateErrorZ
3522 pub union CResult_NoneMonitorUpdateErrorZPtr {
3523         /// Note that this value is always NULL, as there are no contents in the OK variant
3524         pub result: *mut std::ffi::c_void,
3525         /// A pointer to the contents in the error state.
3526         /// Reading from this pointer when `result_ok` is set is undefined.
3527         pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
3528 }
3529 #[repr(C)]
3530 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
3531 /// containing a () on success and a crate::chain::channelmonitor::MonitorUpdateError on failure.
3532 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3533 pub struct CResult_NoneMonitorUpdateErrorZ {
3534         /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
3535         /// `err` or `result` depending on the state of `result_ok`.
3536         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
3537         /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
3538         pub result_ok: bool,
3539 }
3540 #[no_mangle]
3541 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
3542 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
3543         CResult_NoneMonitorUpdateErrorZ {
3544                 contents: CResult_NoneMonitorUpdateErrorZPtr {
3545                         result: std::ptr::null_mut(),
3546                 },
3547                 result_ok: true,
3548         }
3549 }
3550 #[no_mangle]
3551 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
3552 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
3553         CResult_NoneMonitorUpdateErrorZ {
3554                 contents: CResult_NoneMonitorUpdateErrorZPtr {
3555                         err: Box::into_raw(Box::new(e)),
3556                 },
3557                 result_ok: false,
3558         }
3559 }
3560 #[no_mangle]
3561 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
3562 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
3563 impl Drop for CResult_NoneMonitorUpdateErrorZ {
3564         fn drop(&mut self) {
3565                 if self.result_ok {
3566                 } else {
3567                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3568                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3569                         }
3570                 }
3571         }
3572 }
3573 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
3574         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
3575                 let contents = if o.result_ok {
3576                         let _ = unsafe { Box::from_raw(o.contents.result) };
3577                         o.contents.result = std::ptr::null_mut();
3578                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
3579                 } else {
3580                         let err = unsafe { o.contents.err };
3581                         unsafe { o.contents.err = std::ptr::null_mut(); }
3582                         CResult_NoneMonitorUpdateErrorZPtr { err }
3583                 };
3584                 Self {
3585                         contents,
3586                         result_ok: o.result_ok,
3587                 }
3588         }
3589 }
3590 impl Clone for CResult_NoneMonitorUpdateErrorZ {
3591         fn clone(&self) -> Self {
3592                 if self.result_ok {
3593                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
3594                                 result: std::ptr::null_mut()
3595                         } }
3596                 } else {
3597                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
3598                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
3599                         } }
3600                 }
3601         }
3602 }
3603 #[no_mangle]
3604 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
3605 /// but with all dynamically-allocated buffers duplicated in new buffers.
3606 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
3607 #[repr(C)]
3608 /// A tuple of 2 elements. See the individual fields for the types contained.
3609 pub struct C2Tuple_OutPointScriptZ {
3610         /// The element at position 0
3611         pub a: crate::chain::transaction::OutPoint,
3612         /// The element at position 1
3613         pub b: crate::c_types::derived::CVec_u8Z,
3614 }
3615 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
3616         fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
3617                 Self {
3618                         a: tup.0,
3619                         b: tup.1,
3620                 }
3621         }
3622 }
3623 impl C2Tuple_OutPointScriptZ {
3624         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
3625                 (self.a, self.b)
3626         }
3627 }
3628 impl Clone for C2Tuple_OutPointScriptZ {
3629         fn clone(&self) -> Self {
3630                 Self {
3631                         a: self.a.clone(),
3632                         b: self.b.clone(),
3633                 }
3634         }
3635 }
3636 #[no_mangle]
3637 /// Creates a new tuple which has the same data as `orig`
3638 /// but with all dynamically-allocated buffers duplicated in new buffers.
3639 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
3640 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
3641 #[no_mangle]
3642 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
3643         C2Tuple_OutPointScriptZ { a, b, }
3644 }
3645
3646 #[no_mangle]
3647 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
3648 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
3649 #[repr(C)]
3650 /// A tuple of 2 elements. See the individual fields for the types contained.
3651 pub struct C2Tuple_u32ScriptZ {
3652         /// The element at position 0
3653         pub a: u32,
3654         /// The element at position 1
3655         pub b: crate::c_types::derived::CVec_u8Z,
3656 }
3657 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
3658         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
3659                 Self {
3660                         a: tup.0,
3661                         b: tup.1,
3662                 }
3663         }
3664 }
3665 impl C2Tuple_u32ScriptZ {
3666         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
3667                 (self.a, self.b)
3668         }
3669 }
3670 impl Clone for C2Tuple_u32ScriptZ {
3671         fn clone(&self) -> Self {
3672                 Self {
3673                         a: self.a.clone(),
3674                         b: self.b.clone(),
3675                 }
3676         }
3677 }
3678 #[no_mangle]
3679 /// Creates a new tuple which has the same data as `orig`
3680 /// but with all dynamically-allocated buffers duplicated in new buffers.
3681 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
3682 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
3683 #[no_mangle]
3684 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
3685         C2Tuple_u32ScriptZ { a, b, }
3686 }
3687
3688 #[no_mangle]
3689 /// Frees any resources used by the C2Tuple_u32ScriptZ.
3690 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
3691 #[repr(C)]
3692 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
3693 /// This corresponds to std::vector in C++
3694 pub struct CVec_C2Tuple_u32ScriptZZ {
3695         /// The elements in the array.
3696         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3697         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
3698         /// The number of elements pointed to by `data`.
3699         pub datalen: usize
3700 }
3701 impl CVec_C2Tuple_u32ScriptZZ {
3702         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
3703                 if self.datalen == 0 { return Vec::new(); }
3704                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3705                 self.data = std::ptr::null_mut();
3706                 self.datalen = 0;
3707                 ret
3708         }
3709         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
3710                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3711         }
3712 }
3713 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
3714         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
3715                 let datalen = v.len();
3716                 let data = Box::into_raw(v.into_boxed_slice());
3717                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3718         }
3719 }
3720 #[no_mangle]
3721 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3722 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
3723 impl Drop for CVec_C2Tuple_u32ScriptZZ {
3724         fn drop(&mut self) {
3725                 if self.datalen == 0 { return; }
3726                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3727         }
3728 }
3729 impl Clone for CVec_C2Tuple_u32ScriptZZ {
3730         fn clone(&self) -> Self {
3731                 let mut res = Vec::new();
3732                 if self.datalen == 0 { return Self::from(res); }
3733                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3734                 Self::from(res)
3735         }
3736 }
3737 #[repr(C)]
3738 /// A tuple of 2 elements. See the individual fields for the types contained.
3739 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3740         /// The element at position 0
3741         pub a: crate::c_types::ThirtyTwoBytes,
3742         /// The element at position 1
3743         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
3744 }
3745 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3746         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
3747                 Self {
3748                         a: tup.0,
3749                         b: tup.1,
3750                 }
3751         }
3752 }
3753 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3754         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
3755                 (self.a, self.b)
3756         }
3757 }
3758 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
3759 #[no_mangle]
3760 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 {
3761         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
3762 }
3763
3764 #[no_mangle]
3765 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
3766 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
3767 #[repr(C)]
3768 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
3769 /// This corresponds to std::vector in C++
3770 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
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::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
3774         /// The number of elements pointed to by `data`.
3775         pub datalen: usize
3776 }
3777 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3778         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
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::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
3786                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3787         }
3788 }
3789 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3790         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> 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_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
3799 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
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 dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
3807 /// This corresponds to std::vector in C++
3808 pub struct CVec_TransactionZ {
3809         /// The elements in the array.
3810         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3811         pub data: *mut crate::c_types::Transaction,
3812         /// The number of elements pointed to by `data`.
3813         pub datalen: usize
3814 }
3815 impl CVec_TransactionZ {
3816         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
3817                 if self.datalen == 0 { return Vec::new(); }
3818                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3819                 self.data = std::ptr::null_mut();
3820                 self.datalen = 0;
3821                 ret
3822         }
3823         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
3824                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3825         }
3826 }
3827 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
3828         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
3829                 let datalen = v.len();
3830                 let data = Box::into_raw(v.into_boxed_slice());
3831                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3832         }
3833 }
3834 #[no_mangle]
3835 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3836 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
3837 impl Drop for CVec_TransactionZ {
3838         fn drop(&mut self) {
3839                 if self.datalen == 0 { return; }
3840                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3841         }
3842 }
3843 #[repr(C)]
3844 /// A tuple of 2 elements. See the individual fields for the types contained.
3845 pub struct C2Tuple_u32TxOutZ {
3846         /// The element at position 0
3847         pub a: u32,
3848         /// The element at position 1
3849         pub b: crate::c_types::TxOut,
3850 }
3851 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3852         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3853                 Self {
3854                         a: tup.0,
3855                         b: tup.1,
3856                 }
3857         }
3858 }
3859 impl C2Tuple_u32TxOutZ {
3860         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3861                 (self.a, self.b)
3862         }
3863 }
3864 impl Clone for C2Tuple_u32TxOutZ {
3865         fn clone(&self) -> Self {
3866                 Self {
3867                         a: self.a.clone(),
3868                         b: self.b.clone(),
3869                 }
3870         }
3871 }
3872 #[no_mangle]
3873 /// Creates a new tuple which has the same data as `orig`
3874 /// but with all dynamically-allocated buffers duplicated in new buffers.
3875 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3876 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
3877 #[no_mangle]
3878 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3879         C2Tuple_u32TxOutZ { a, b, }
3880 }
3881
3882 #[no_mangle]
3883 /// Frees any resources used by the C2Tuple_u32TxOutZ.
3884 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3885 #[repr(C)]
3886 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3887 /// This corresponds to std::vector in C++
3888 pub struct CVec_C2Tuple_u32TxOutZZ {
3889         /// The elements in the array.
3890         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3891         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3892         /// The number of elements pointed to by `data`.
3893         pub datalen: usize
3894 }
3895 impl CVec_C2Tuple_u32TxOutZZ {
3896         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3897                 if self.datalen == 0 { return Vec::new(); }
3898                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3899                 self.data = std::ptr::null_mut();
3900                 self.datalen = 0;
3901                 ret
3902         }
3903         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3904                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3905         }
3906 }
3907 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3908         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3909                 let datalen = v.len();
3910                 let data = Box::into_raw(v.into_boxed_slice());
3911                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3912         }
3913 }
3914 #[no_mangle]
3915 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3916 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3917 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3918         fn drop(&mut self) {
3919                 if self.datalen == 0 { return; }
3920                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3921         }
3922 }
3923 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3924         fn clone(&self) -> Self {
3925                 let mut res = Vec::new();
3926                 if self.datalen == 0 { return Self::from(res); }
3927                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3928                 Self::from(res)
3929         }
3930 }
3931 #[repr(C)]
3932 /// A tuple of 2 elements. See the individual fields for the types contained.
3933 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3934         /// The element at position 0
3935         pub a: crate::c_types::ThirtyTwoBytes,
3936         /// The element at position 1
3937         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3938 }
3939 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3940         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3941                 Self {
3942                         a: tup.0,
3943                         b: tup.1,
3944                 }
3945         }
3946 }
3947 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3948         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3949                 (self.a, self.b)
3950         }
3951 }
3952 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
3953 #[no_mangle]
3954 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 {
3955         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3956 }
3957
3958 #[no_mangle]
3959 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
3960 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3961 #[repr(C)]
3962 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3963 /// This corresponds to std::vector in C++
3964 pub struct CVec_TransactionOutputsZ {
3965         /// The elements in the array.
3966         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3967         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3968         /// The number of elements pointed to by `data`.
3969         pub datalen: usize
3970 }
3971 impl CVec_TransactionOutputsZ {
3972         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3973                 if self.datalen == 0 { return Vec::new(); }
3974                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3975                 self.data = std::ptr::null_mut();
3976                 self.datalen = 0;
3977                 ret
3978         }
3979         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3980                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3981         }
3982 }
3983 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
3984         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3985                 let datalen = v.len();
3986                 let data = Box::into_raw(v.into_boxed_slice());
3987                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3988         }
3989 }
3990 #[no_mangle]
3991 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3992 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
3993 impl Drop for CVec_TransactionOutputsZ {
3994         fn drop(&mut self) {
3995                 if self.datalen == 0 { return; }
3996                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3997         }
3998 }
3999 #[repr(C)]
4000 /// A tuple of 2 elements. See the individual fields for the types contained.
4001 pub struct C2Tuple_BlockHashChannelMonitorZ {
4002         /// The element at position 0
4003         pub a: crate::c_types::ThirtyTwoBytes,
4004         /// The element at position 1
4005         pub b: crate::chain::channelmonitor::ChannelMonitor,
4006 }
4007 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4008         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
4009                 Self {
4010                         a: tup.0,
4011                         b: tup.1,
4012                 }
4013         }
4014 }
4015 impl C2Tuple_BlockHashChannelMonitorZ {
4016         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
4017                 (self.a, self.b)
4018         }
4019 }
4020 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4021 #[no_mangle]
4022 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4023         C2Tuple_BlockHashChannelMonitorZ { a, b, }
4024 }
4025
4026 #[no_mangle]
4027 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4028 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4029 #[repr(C)]
4030 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
4031 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4032         /// A pointer to the contents in the success state.
4033         /// Reading from this pointer when `result_ok` is not set is undefined.
4034         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4035         /// A pointer to the contents in the error state.
4036         /// Reading from this pointer when `result_ok` is set is undefined.
4037         pub err: *mut crate::ln::msgs::DecodeError,
4038 }
4039 #[repr(C)]
4040 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
4041 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::ln::msgs::DecodeError on failure.
4042 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4043 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4044         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
4045         /// `err` or `result` depending on the state of `result_ok`.
4046         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
4047         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
4048         pub result_ok: bool,
4049 }
4050 #[no_mangle]
4051 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
4052 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4053         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4054                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4055                         result: Box::into_raw(Box::new(o)),
4056                 },
4057                 result_ok: true,
4058         }
4059 }
4060 #[no_mangle]
4061 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
4062 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4063         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4064                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4065                         err: Box::into_raw(Box::new(e)),
4066                 },
4067                 result_ok: false,
4068         }
4069 }
4070 #[no_mangle]
4071 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
4072 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
4073 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4074         fn drop(&mut self) {
4075                 if self.result_ok {
4076                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4077                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4078                         }
4079                 } else {
4080                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4081                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4082                         }
4083                 }
4084         }
4085 }
4086 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4087         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
4088                 let contents = if o.result_ok {
4089                         let result = unsafe { o.contents.result };
4090                         unsafe { o.contents.result = std::ptr::null_mut() };
4091                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
4092                 } else {
4093                         let err = unsafe { o.contents.err };
4094                         unsafe { o.contents.err = std::ptr::null_mut(); }
4095                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
4096                 };
4097                 Self {
4098                         contents,
4099                         result_ok: o.result_ok,
4100                 }
4101         }
4102 }
4103 #[repr(C)]
4104 /// A dynamically-allocated array of crate::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4105 /// This corresponds to std::vector in C++
4106 pub struct CVec_SpendableOutputDescriptorZ {
4107         /// The elements in the array.
4108         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4109         pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
4110         /// The number of elements pointed to by `data`.
4111         pub datalen: usize
4112 }
4113 impl CVec_SpendableOutputDescriptorZ {
4114         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
4115                 if self.datalen == 0 { return Vec::new(); }
4116                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4117                 self.data = std::ptr::null_mut();
4118                 self.datalen = 0;
4119                 ret
4120         }
4121         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
4122                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4123         }
4124 }
4125 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4126         fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4127                 let datalen = v.len();
4128                 let data = Box::into_raw(v.into_boxed_slice());
4129                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4130         }
4131 }
4132 #[no_mangle]
4133 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4134 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4135 impl Drop for CVec_SpendableOutputDescriptorZ {
4136         fn drop(&mut self) {
4137                 if self.datalen == 0 { return; }
4138                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4139         }
4140 }
4141 impl Clone for CVec_SpendableOutputDescriptorZ {
4142         fn clone(&self) -> Self {
4143                 let mut res = Vec::new();
4144                 if self.datalen == 0 { return Self::from(res); }
4145                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4146                 Self::from(res)
4147         }
4148 }
4149 #[repr(C)]
4150 /// The contents of CResult_TxOutAccessErrorZ
4151 pub union CResult_TxOutAccessErrorZPtr {
4152         /// A pointer to the contents in the success state.
4153         /// Reading from this pointer when `result_ok` is not set is undefined.
4154         pub result: *mut crate::c_types::TxOut,
4155         /// A pointer to the contents in the error state.
4156         /// Reading from this pointer when `result_ok` is set is undefined.
4157         pub err: *mut crate::chain::AccessError,
4158 }
4159 #[repr(C)]
4160 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4161 /// containing a crate::c_types::TxOut on success and a crate::chain::AccessError on failure.
4162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4163 pub struct CResult_TxOutAccessErrorZ {
4164         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4165         /// `err` or `result` depending on the state of `result_ok`.
4166         pub contents: CResult_TxOutAccessErrorZPtr,
4167         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4168         pub result_ok: bool,
4169 }
4170 #[no_mangle]
4171 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4172 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4173         CResult_TxOutAccessErrorZ {
4174                 contents: CResult_TxOutAccessErrorZPtr {
4175                         result: Box::into_raw(Box::new(o)),
4176                 },
4177                 result_ok: true,
4178         }
4179 }
4180 #[no_mangle]
4181 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4182 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4183         CResult_TxOutAccessErrorZ {
4184                 contents: CResult_TxOutAccessErrorZPtr {
4185                         err: Box::into_raw(Box::new(e)),
4186                 },
4187                 result_ok: false,
4188         }
4189 }
4190 #[no_mangle]
4191 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
4192 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4193 impl Drop for CResult_TxOutAccessErrorZ {
4194         fn drop(&mut self) {
4195                 if self.result_ok {
4196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4198                         }
4199                 } else {
4200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4202                         }
4203                 }
4204         }
4205 }
4206 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4207         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
4208                 let contents = if o.result_ok {
4209                         let result = unsafe { o.contents.result };
4210                         unsafe { o.contents.result = std::ptr::null_mut() };
4211                         CResult_TxOutAccessErrorZPtr { result }
4212                 } else {
4213                         let err = unsafe { o.contents.err };
4214                         unsafe { o.contents.err = std::ptr::null_mut(); }
4215                         CResult_TxOutAccessErrorZPtr { err }
4216                 };
4217                 Self {
4218                         contents,
4219                         result_ok: o.result_ok,
4220                 }
4221         }
4222 }
4223 impl Clone for CResult_TxOutAccessErrorZ {
4224         fn clone(&self) -> Self {
4225                 if self.result_ok {
4226                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4227                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4228                         } }
4229                 } else {
4230                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4231                                 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4232                         } }
4233                 }
4234         }
4235 }
4236 #[no_mangle]
4237 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4238 /// but with all dynamically-allocated buffers duplicated in new buffers.
4239 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4240 #[repr(C)]
4241 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4242 pub enum COption_C2Tuple_usizeTransactionZZ {
4243         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4244         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4245         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4246         None
4247 }
4248 impl COption_C2Tuple_usizeTransactionZZ {
4249         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4250                 if let Self::Some(_) = self { true } else { false }
4251         }
4252         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4253                 if let Self::Some(v) = self { v } else { unreachable!() }
4254         }
4255 }
4256 #[no_mangle]
4257 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4258 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4259         COption_C2Tuple_usizeTransactionZZ::Some(o)
4260 }
4261 #[no_mangle]
4262 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4263 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4264         COption_C2Tuple_usizeTransactionZZ::None
4265 }
4266 #[no_mangle]
4267 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4268 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4269 #[repr(C)]
4270 /// The contents of CResult_NoneAPIErrorZ
4271 pub union CResult_NoneAPIErrorZPtr {
4272         /// Note that this value is always NULL, as there are no contents in the OK variant
4273         pub result: *mut std::ffi::c_void,
4274         /// A pointer to the contents in the error state.
4275         /// Reading from this pointer when `result_ok` is set is undefined.
4276         pub err: *mut crate::util::errors::APIError,
4277 }
4278 #[repr(C)]
4279 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4280 /// containing a () on success and a crate::util::errors::APIError on failure.
4281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4282 pub struct CResult_NoneAPIErrorZ {
4283         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4284         /// `err` or `result` depending on the state of `result_ok`.
4285         pub contents: CResult_NoneAPIErrorZPtr,
4286         /// Whether this CResult_NoneAPIErrorZ represents a success state.
4287         pub result_ok: bool,
4288 }
4289 #[no_mangle]
4290 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4291 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4292         CResult_NoneAPIErrorZ {
4293                 contents: CResult_NoneAPIErrorZPtr {
4294                         result: std::ptr::null_mut(),
4295                 },
4296                 result_ok: true,
4297         }
4298 }
4299 #[no_mangle]
4300 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4301 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4302         CResult_NoneAPIErrorZ {
4303                 contents: CResult_NoneAPIErrorZPtr {
4304                         err: Box::into_raw(Box::new(e)),
4305                 },
4306                 result_ok: false,
4307         }
4308 }
4309 #[no_mangle]
4310 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4311 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4312 impl Drop for CResult_NoneAPIErrorZ {
4313         fn drop(&mut self) {
4314                 if self.result_ok {
4315                 } else {
4316                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4317                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4318                         }
4319                 }
4320         }
4321 }
4322 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4323         fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
4324                 let contents = if o.result_ok {
4325                         let _ = unsafe { Box::from_raw(o.contents.result) };
4326                         o.contents.result = std::ptr::null_mut();
4327                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4328                 } else {
4329                         let err = unsafe { o.contents.err };
4330                         unsafe { o.contents.err = std::ptr::null_mut(); }
4331                         CResult_NoneAPIErrorZPtr { err }
4332                 };
4333                 Self {
4334                         contents,
4335                         result_ok: o.result_ok,
4336                 }
4337         }
4338 }
4339 impl Clone for CResult_NoneAPIErrorZ {
4340         fn clone(&self) -> Self {
4341                 if self.result_ok {
4342                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4343                                 result: std::ptr::null_mut()
4344                         } }
4345                 } else {
4346                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4347                                 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4348                         } }
4349                 }
4350         }
4351 }
4352 #[no_mangle]
4353 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4354 /// but with all dynamically-allocated buffers duplicated in new buffers.
4355 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
4356 #[repr(C)]
4357 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4358 /// This corresponds to std::vector in C++
4359 pub struct CVec_CResult_NoneAPIErrorZZ {
4360         /// The elements in the array.
4361         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4362         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4363         /// The number of elements pointed to by `data`.
4364         pub datalen: usize
4365 }
4366 impl CVec_CResult_NoneAPIErrorZZ {
4367         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4368                 if self.datalen == 0 { return Vec::new(); }
4369                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4370                 self.data = std::ptr::null_mut();
4371                 self.datalen = 0;
4372                 ret
4373         }
4374         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4375                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4376         }
4377 }
4378 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4379         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4380                 let datalen = v.len();
4381                 let data = Box::into_raw(v.into_boxed_slice());
4382                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4383         }
4384 }
4385 #[no_mangle]
4386 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4387 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4388 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4389         fn drop(&mut self) {
4390                 if self.datalen == 0 { return; }
4391                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4392         }
4393 }
4394 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4395         fn clone(&self) -> Self {
4396                 let mut res = Vec::new();
4397                 if self.datalen == 0 { return Self::from(res); }
4398                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4399                 Self::from(res)
4400         }
4401 }
4402 #[repr(C)]
4403 /// A dynamically-allocated array of crate::util::errors::APIErrors of arbitrary size.
4404 /// This corresponds to std::vector in C++
4405 pub struct CVec_APIErrorZ {
4406         /// The elements in the array.
4407         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4408         pub data: *mut crate::util::errors::APIError,
4409         /// The number of elements pointed to by `data`.
4410         pub datalen: usize
4411 }
4412 impl CVec_APIErrorZ {
4413         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::errors::APIError> {
4414                 if self.datalen == 0 { return Vec::new(); }
4415                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4416                 self.data = std::ptr::null_mut();
4417                 self.datalen = 0;
4418                 ret
4419         }
4420         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::errors::APIError] {
4421                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4422         }
4423 }
4424 impl From<Vec<crate::util::errors::APIError>> for CVec_APIErrorZ {
4425         fn from(v: Vec<crate::util::errors::APIError>) -> Self {
4426                 let datalen = v.len();
4427                 let data = Box::into_raw(v.into_boxed_slice());
4428                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4429         }
4430 }
4431 #[no_mangle]
4432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4433 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4434 impl Drop for CVec_APIErrorZ {
4435         fn drop(&mut self) {
4436                 if self.datalen == 0 { return; }
4437                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4438         }
4439 }
4440 impl Clone for CVec_APIErrorZ {
4441         fn clone(&self) -> Self {
4442                 let mut res = Vec::new();
4443                 if self.datalen == 0 { return Self::from(res); }
4444                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4445                 Self::from(res)
4446         }
4447 }
4448 #[repr(C)]
4449 /// A dynamically-allocated array of crate::ln::channelmanager::ChannelDetailss of arbitrary size.
4450 /// This corresponds to std::vector in C++
4451 pub struct CVec_ChannelDetailsZ {
4452         /// The elements in the array.
4453         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4454         pub data: *mut crate::ln::channelmanager::ChannelDetails,
4455         /// The number of elements pointed to by `data`.
4456         pub datalen: usize
4457 }
4458 impl CVec_ChannelDetailsZ {
4459         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
4460                 if self.datalen == 0 { return Vec::new(); }
4461                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4462                 self.data = std::ptr::null_mut();
4463                 self.datalen = 0;
4464                 ret
4465         }
4466         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
4467                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4468         }
4469 }
4470 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
4471         fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
4472                 let datalen = v.len();
4473                 let data = Box::into_raw(v.into_boxed_slice());
4474                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4475         }
4476 }
4477 #[no_mangle]
4478 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4479 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
4480 impl Drop for CVec_ChannelDetailsZ {
4481         fn drop(&mut self) {
4482                 if self.datalen == 0 { return; }
4483                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4484         }
4485 }
4486 impl Clone for CVec_ChannelDetailsZ {
4487         fn clone(&self) -> Self {
4488                 let mut res = Vec::new();
4489                 if self.datalen == 0 { return Self::from(res); }
4490                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4491                 Self::from(res)
4492         }
4493 }
4494 #[repr(C)]
4495 /// The contents of CResult_NonePaymentSendFailureZ
4496 pub union CResult_NonePaymentSendFailureZPtr {
4497         /// Note that this value is always NULL, as there are no contents in the OK variant
4498         pub result: *mut std::ffi::c_void,
4499         /// A pointer to the contents in the error state.
4500         /// Reading from this pointer when `result_ok` is set is undefined.
4501         pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
4502 }
4503 #[repr(C)]
4504 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4505 /// containing a () on success and a crate::ln::channelmanager::PaymentSendFailure on failure.
4506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4507 pub struct CResult_NonePaymentSendFailureZ {
4508         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4509         /// `err` or `result` depending on the state of `result_ok`.
4510         pub contents: CResult_NonePaymentSendFailureZPtr,
4511         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4512         pub result_ok: bool,
4513 }
4514 #[no_mangle]
4515 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4516 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4517         CResult_NonePaymentSendFailureZ {
4518                 contents: CResult_NonePaymentSendFailureZPtr {
4519                         result: std::ptr::null_mut(),
4520                 },
4521                 result_ok: true,
4522         }
4523 }
4524 #[no_mangle]
4525 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4526 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4527         CResult_NonePaymentSendFailureZ {
4528                 contents: CResult_NonePaymentSendFailureZPtr {
4529                         err: Box::into_raw(Box::new(e)),
4530                 },
4531                 result_ok: false,
4532         }
4533 }
4534 #[no_mangle]
4535 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4536 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4537 impl Drop for CResult_NonePaymentSendFailureZ {
4538         fn drop(&mut self) {
4539                 if self.result_ok {
4540                 } else {
4541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4543                         }
4544                 }
4545         }
4546 }
4547 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4548         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
4549                 let contents = if o.result_ok {
4550                         let _ = unsafe { Box::from_raw(o.contents.result) };
4551                         o.contents.result = std::ptr::null_mut();
4552                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4553                 } else {
4554                         let err = unsafe { o.contents.err };
4555                         unsafe { o.contents.err = std::ptr::null_mut(); }
4556                         CResult_NonePaymentSendFailureZPtr { err }
4557                 };
4558                 Self {
4559                         contents,
4560                         result_ok: o.result_ok,
4561                 }
4562         }
4563 }
4564 impl Clone for CResult_NonePaymentSendFailureZ {
4565         fn clone(&self) -> Self {
4566                 if self.result_ok {
4567                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4568                                 result: std::ptr::null_mut()
4569                         } }
4570                 } else {
4571                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4572                                 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4573                         } }
4574                 }
4575         }
4576 }
4577 #[no_mangle]
4578 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4579 /// but with all dynamically-allocated buffers duplicated in new buffers.
4580 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4581 #[repr(C)]
4582 /// A dynamically-allocated array of crate::chain::channelmonitor::ChannelMonitors of arbitrary size.
4583 /// This corresponds to std::vector in C++
4584 pub struct CVec_ChannelMonitorZ {
4585         /// The elements in the array.
4586         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4587         pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
4588         /// The number of elements pointed to by `data`.
4589         pub datalen: usize
4590 }
4591 impl CVec_ChannelMonitorZ {
4592         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
4593                 if self.datalen == 0 { return Vec::new(); }
4594                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4595                 self.data = std::ptr::null_mut();
4596                 self.datalen = 0;
4597                 ret
4598         }
4599         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
4600                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4601         }
4602 }
4603 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4604         fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
4605                 let datalen = v.len();
4606                 let data = Box::into_raw(v.into_boxed_slice());
4607                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4608         }
4609 }
4610 #[no_mangle]
4611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4612 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4613 impl Drop for CVec_ChannelMonitorZ {
4614         fn drop(&mut self) {
4615                 if self.datalen == 0 { return; }
4616                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4617         }
4618 }
4619 #[repr(C)]
4620 /// A tuple of 2 elements. See the individual fields for the types contained.
4621 pub struct C2Tuple_BlockHashChannelManagerZ {
4622         /// The element at position 0
4623         pub a: crate::c_types::ThirtyTwoBytes,
4624         /// The element at position 1
4625         pub b: crate::ln::channelmanager::ChannelManager,
4626 }
4627 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4628         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
4629                 Self {
4630                         a: tup.0,
4631                         b: tup.1,
4632                 }
4633         }
4634 }
4635 impl C2Tuple_BlockHashChannelManagerZ {
4636         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
4637                 (self.a, self.b)
4638         }
4639 }
4640 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4641 #[no_mangle]
4642 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4643         C2Tuple_BlockHashChannelManagerZ { a, b, }
4644 }
4645
4646 #[no_mangle]
4647 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4648 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4649 #[repr(C)]
4650 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4651 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4652         /// A pointer to the contents in the success state.
4653         /// Reading from this pointer when `result_ok` is not set is undefined.
4654         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4655         /// A pointer to the contents in the error state.
4656         /// Reading from this pointer when `result_ok` is set is undefined.
4657         pub err: *mut crate::ln::msgs::DecodeError,
4658 }
4659 #[repr(C)]
4660 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4661 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::ln::msgs::DecodeError on failure.
4662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4663 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4664         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4665         /// `err` or `result` depending on the state of `result_ok`.
4666         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4667         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4668         pub result_ok: bool,
4669 }
4670 #[no_mangle]
4671 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4672 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4673         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4674                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4675                         result: Box::into_raw(Box::new(o)),
4676                 },
4677                 result_ok: true,
4678         }
4679 }
4680 #[no_mangle]
4681 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4682 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4683         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4684                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4685                         err: Box::into_raw(Box::new(e)),
4686                 },
4687                 result_ok: false,
4688         }
4689 }
4690 #[no_mangle]
4691 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4692 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4693 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4694         fn drop(&mut self) {
4695                 if self.result_ok {
4696                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4697                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4698                         }
4699                 } else {
4700                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4701                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4702                         }
4703                 }
4704         }
4705 }
4706 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4707         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
4708                 let contents = if o.result_ok {
4709                         let result = unsafe { o.contents.result };
4710                         unsafe { o.contents.result = std::ptr::null_mut() };
4711                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4712                 } else {
4713                         let err = unsafe { o.contents.err };
4714                         unsafe { o.contents.err = std::ptr::null_mut(); }
4715                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4716                 };
4717                 Self {
4718                         contents,
4719                         result_ok: o.result_ok,
4720                 }
4721         }
4722 }
4723 #[repr(C)]
4724 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4725 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4726         /// A pointer to the contents in the success state.
4727         /// Reading from this pointer when `result_ok` is not set is undefined.
4728         pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
4729         /// A pointer to the contents in the error state.
4730         /// Reading from this pointer when `result_ok` is set is undefined.
4731         pub err: *mut crate::ln::msgs::DecodeError,
4732 }
4733 #[repr(C)]
4734 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4735 /// containing a crate::chain::keysinterface::SpendableOutputDescriptor on success and a crate::ln::msgs::DecodeError on failure.
4736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4737 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4738         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4739         /// `err` or `result` depending on the state of `result_ok`.
4740         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4741         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4742         pub result_ok: bool,
4743 }
4744 #[no_mangle]
4745 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4746 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4747         CResult_SpendableOutputDescriptorDecodeErrorZ {
4748                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4749                         result: Box::into_raw(Box::new(o)),
4750                 },
4751                 result_ok: true,
4752         }
4753 }
4754 #[no_mangle]
4755 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4756 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4757         CResult_SpendableOutputDescriptorDecodeErrorZ {
4758                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4759                         err: Box::into_raw(Box::new(e)),
4760                 },
4761                 result_ok: false,
4762         }
4763 }
4764 #[no_mangle]
4765 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4766 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4767 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4768         fn drop(&mut self) {
4769                 if self.result_ok {
4770                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4771                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4772                         }
4773                 } else {
4774                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4775                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4776                         }
4777                 }
4778         }
4779 }
4780 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4781         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
4782                 let contents = if o.result_ok {
4783                         let result = unsafe { o.contents.result };
4784                         unsafe { o.contents.result = std::ptr::null_mut() };
4785                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4786                 } else {
4787                         let err = unsafe { o.contents.err };
4788                         unsafe { o.contents.err = std::ptr::null_mut(); }
4789                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4790                 };
4791                 Self {
4792                         contents,
4793                         result_ok: o.result_ok,
4794                 }
4795         }
4796 }
4797 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4798         fn clone(&self) -> Self {
4799                 if self.result_ok {
4800                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4801                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4802                         } }
4803                 } else {
4804                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4805                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4806                         } }
4807                 }
4808         }
4809 }
4810 #[no_mangle]
4811 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4812 /// but with all dynamically-allocated buffers duplicated in new buffers.
4813 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
4814 #[repr(C)]
4815 /// A tuple of 2 elements. See the individual fields for the types contained.
4816 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4817         /// The element at position 0
4818         pub a: crate::c_types::Signature,
4819         /// The element at position 1
4820         pub b: crate::c_types::derived::CVec_SignatureZ,
4821 }
4822 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4823         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4824                 Self {
4825                         a: tup.0,
4826                         b: tup.1,
4827                 }
4828         }
4829 }
4830 impl C2Tuple_SignatureCVec_SignatureZZ {
4831         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4832                 (self.a, self.b)
4833         }
4834 }
4835 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4836         fn clone(&self) -> Self {
4837                 Self {
4838                         a: self.a.clone(),
4839                         b: self.b.clone(),
4840                 }
4841         }
4842 }
4843 #[no_mangle]
4844 /// Creates a new tuple which has the same data as `orig`
4845 /// but with all dynamically-allocated buffers duplicated in new buffers.
4846 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
4847 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4848 #[no_mangle]
4849 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4850         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4851 }
4852
4853 #[no_mangle]
4854 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4855 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4856 #[repr(C)]
4857 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4858 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4859         /// A pointer to the contents in the success state.
4860         /// Reading from this pointer when `result_ok` is not set is undefined.
4861         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4862         /// Note that this value is always NULL, as there are no contents in the Err variant
4863         pub err: *mut std::ffi::c_void,
4864 }
4865 #[repr(C)]
4866 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4867 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4869 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4870         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4871         /// `err` or `result` depending on the state of `result_ok`.
4872         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4873         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4874         pub result_ok: bool,
4875 }
4876 #[no_mangle]
4877 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4878 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4879         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4880                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4881                         result: Box::into_raw(Box::new(o)),
4882                 },
4883                 result_ok: true,
4884         }
4885 }
4886 #[no_mangle]
4887 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4888 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4889         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4890                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4891                         err: std::ptr::null_mut(),
4892                 },
4893                 result_ok: false,
4894         }
4895 }
4896 #[no_mangle]
4897 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4898 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4899 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4900         fn drop(&mut self) {
4901                 if self.result_ok {
4902                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4903                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4904                         }
4905                 } else {
4906                 }
4907         }
4908 }
4909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4910         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
4911                 let contents = if o.result_ok {
4912                         let result = unsafe { o.contents.result };
4913                         unsafe { o.contents.result = std::ptr::null_mut() };
4914                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4915                 } else {
4916                         let _ = unsafe { Box::from_raw(o.contents.err) };
4917                         o.contents.err = std::ptr::null_mut();
4918                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
4919                 };
4920                 Self {
4921                         contents,
4922                         result_ok: o.result_ok,
4923                 }
4924         }
4925 }
4926 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4927         fn clone(&self) -> Self {
4928                 if self.result_ok {
4929                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4930                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4931                         } }
4932                 } else {
4933                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4934                                 err: std::ptr::null_mut()
4935                         } }
4936                 }
4937         }
4938 }
4939 #[no_mangle]
4940 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4941 /// but with all dynamically-allocated buffers duplicated in new buffers.
4942 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
4943 #[repr(C)]
4944 /// The contents of CResult_SignatureNoneZ
4945 pub union CResult_SignatureNoneZPtr {
4946         /// A pointer to the contents in the success state.
4947         /// Reading from this pointer when `result_ok` is not set is undefined.
4948         pub result: *mut crate::c_types::Signature,
4949         /// Note that this value is always NULL, as there are no contents in the Err variant
4950         pub err: *mut std::ffi::c_void,
4951 }
4952 #[repr(C)]
4953 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4954 /// containing a crate::c_types::Signature on success and a () on failure.
4955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4956 pub struct CResult_SignatureNoneZ {
4957         /// The contents of this CResult_SignatureNoneZ, accessible via either
4958         /// `err` or `result` depending on the state of `result_ok`.
4959         pub contents: CResult_SignatureNoneZPtr,
4960         /// Whether this CResult_SignatureNoneZ represents a success state.
4961         pub result_ok: bool,
4962 }
4963 #[no_mangle]
4964 /// Creates a new CResult_SignatureNoneZ in the success state.
4965 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4966         CResult_SignatureNoneZ {
4967                 contents: CResult_SignatureNoneZPtr {
4968                         result: Box::into_raw(Box::new(o)),
4969                 },
4970                 result_ok: true,
4971         }
4972 }
4973 #[no_mangle]
4974 /// Creates a new CResult_SignatureNoneZ in the error state.
4975 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4976         CResult_SignatureNoneZ {
4977                 contents: CResult_SignatureNoneZPtr {
4978                         err: std::ptr::null_mut(),
4979                 },
4980                 result_ok: false,
4981         }
4982 }
4983 #[no_mangle]
4984 /// Frees any resources used by the CResult_SignatureNoneZ.
4985 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4986 impl Drop for CResult_SignatureNoneZ {
4987         fn drop(&mut self) {
4988                 if self.result_ok {
4989                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4990                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4991                         }
4992                 } else {
4993                 }
4994         }
4995 }
4996 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
4997         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
4998                 let contents = if o.result_ok {
4999                         let result = unsafe { o.contents.result };
5000                         unsafe { o.contents.result = std::ptr::null_mut() };
5001                         CResult_SignatureNoneZPtr { result }
5002                 } else {
5003                         let _ = unsafe { Box::from_raw(o.contents.err) };
5004                         o.contents.err = std::ptr::null_mut();
5005                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
5006                 };
5007                 Self {
5008                         contents,
5009                         result_ok: o.result_ok,
5010                 }
5011         }
5012 }
5013 impl Clone for CResult_SignatureNoneZ {
5014         fn clone(&self) -> Self {
5015                 if self.result_ok {
5016                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
5017                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
5018                         } }
5019                 } else {
5020                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
5021                                 err: std::ptr::null_mut()
5022                         } }
5023                 }
5024         }
5025 }
5026 #[no_mangle]
5027 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
5028 /// but with all dynamically-allocated buffers duplicated in new buffers.
5029 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
5030 #[repr(C)]
5031 /// The contents of CResult_SignDecodeErrorZ
5032 pub union CResult_SignDecodeErrorZPtr {
5033         /// A pointer to the contents in the success state.
5034         /// Reading from this pointer when `result_ok` is not set is undefined.
5035         pub result: *mut crate::chain::keysinterface::Sign,
5036         /// A pointer to the contents in the error state.
5037         /// Reading from this pointer when `result_ok` is set is undefined.
5038         pub err: *mut crate::ln::msgs::DecodeError,
5039 }
5040 #[repr(C)]
5041 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5042 /// containing a crate::chain::keysinterface::Sign on success and a crate::ln::msgs::DecodeError on failure.
5043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5044 pub struct CResult_SignDecodeErrorZ {
5045         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5046         /// `err` or `result` depending on the state of `result_ok`.
5047         pub contents: CResult_SignDecodeErrorZPtr,
5048         /// Whether this CResult_SignDecodeErrorZ represents a success state.
5049         pub result_ok: bool,
5050 }
5051 #[no_mangle]
5052 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5053 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5054         CResult_SignDecodeErrorZ {
5055                 contents: CResult_SignDecodeErrorZPtr {
5056                         result: Box::into_raw(Box::new(o)),
5057                 },
5058                 result_ok: true,
5059         }
5060 }
5061 #[no_mangle]
5062 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5063 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5064         CResult_SignDecodeErrorZ {
5065                 contents: CResult_SignDecodeErrorZPtr {
5066                         err: Box::into_raw(Box::new(e)),
5067                 },
5068                 result_ok: false,
5069         }
5070 }
5071 #[no_mangle]
5072 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5073 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5074 impl Drop for CResult_SignDecodeErrorZ {
5075         fn drop(&mut self) {
5076                 if self.result_ok {
5077                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5078                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5079                         }
5080                 } else {
5081                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5082                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5083                         }
5084                 }
5085         }
5086 }
5087 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5088         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>) -> Self {
5089                 let contents = if o.result_ok {
5090                         let result = unsafe { o.contents.result };
5091                         unsafe { o.contents.result = std::ptr::null_mut() };
5092                         CResult_SignDecodeErrorZPtr { result }
5093                 } else {
5094                         let err = unsafe { o.contents.err };
5095                         unsafe { o.contents.err = std::ptr::null_mut(); }
5096                         CResult_SignDecodeErrorZPtr { err }
5097                 };
5098                 Self {
5099                         contents,
5100                         result_ok: o.result_ok,
5101                 }
5102         }
5103 }
5104 impl Clone for CResult_SignDecodeErrorZ {
5105         fn clone(&self) -> Self {
5106                 if self.result_ok {
5107                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5108                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5109                         } }
5110                 } else {
5111                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5112                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5113                         } }
5114                 }
5115         }
5116 }
5117 #[no_mangle]
5118 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5119 /// but with all dynamically-allocated buffers duplicated in new buffers.
5120 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
5121 #[repr(C)]
5122 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5123 /// This corresponds to std::vector in C++
5124 pub struct CVec_CVec_u8ZZ {
5125         /// The elements in the array.
5126         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5127         pub data: *mut crate::c_types::derived::CVec_u8Z,
5128         /// The number of elements pointed to by `data`.
5129         pub datalen: usize
5130 }
5131 impl CVec_CVec_u8ZZ {
5132         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5133                 if self.datalen == 0 { return Vec::new(); }
5134                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5135                 self.data = std::ptr::null_mut();
5136                 self.datalen = 0;
5137                 ret
5138         }
5139         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5140                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5141         }
5142 }
5143 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5144         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5145                 let datalen = v.len();
5146                 let data = Box::into_raw(v.into_boxed_slice());
5147                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5148         }
5149 }
5150 #[no_mangle]
5151 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5152 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5153 impl Drop for CVec_CVec_u8ZZ {
5154         fn drop(&mut self) {
5155                 if self.datalen == 0 { return; }
5156                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5157         }
5158 }
5159 impl Clone for CVec_CVec_u8ZZ {
5160         fn clone(&self) -> Self {
5161                 let mut res = Vec::new();
5162                 if self.datalen == 0 { return Self::from(res); }
5163                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5164                 Self::from(res)
5165         }
5166 }
5167 #[repr(C)]
5168 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5169 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5170         /// A pointer to the contents in the success state.
5171         /// Reading from this pointer when `result_ok` is not set is undefined.
5172         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5173         /// Note that this value is always NULL, as there are no contents in the Err variant
5174         pub err: *mut std::ffi::c_void,
5175 }
5176 #[repr(C)]
5177 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5178 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5180 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5181         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5182         /// `err` or `result` depending on the state of `result_ok`.
5183         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5184         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5185         pub result_ok: bool,
5186 }
5187 #[no_mangle]
5188 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5189 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5190         CResult_CVec_CVec_u8ZZNoneZ {
5191                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5192                         result: Box::into_raw(Box::new(o)),
5193                 },
5194                 result_ok: true,
5195         }
5196 }
5197 #[no_mangle]
5198 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5199 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5200         CResult_CVec_CVec_u8ZZNoneZ {
5201                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5202                         err: std::ptr::null_mut(),
5203                 },
5204                 result_ok: false,
5205         }
5206 }
5207 #[no_mangle]
5208 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5209 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5210 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5211         fn drop(&mut self) {
5212                 if self.result_ok {
5213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5215                         }
5216                 } else {
5217                 }
5218         }
5219 }
5220 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
5221         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
5222                 let contents = if o.result_ok {
5223                         let result = unsafe { o.contents.result };
5224                         unsafe { o.contents.result = std::ptr::null_mut() };
5225                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
5226                 } else {
5227                         let _ = unsafe { Box::from_raw(o.contents.err) };
5228                         o.contents.err = std::ptr::null_mut();
5229                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
5230                 };
5231                 Self {
5232                         contents,
5233                         result_ok: o.result_ok,
5234                 }
5235         }
5236 }
5237 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5238         fn clone(&self) -> Self {
5239                 if self.result_ok {
5240                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5241                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5242                         } }
5243                 } else {
5244                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5245                                 err: std::ptr::null_mut()
5246                         } }
5247                 }
5248         }
5249 }
5250 #[no_mangle]
5251 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
5254 #[repr(C)]
5255 /// The contents of CResult_InMemorySignerDecodeErrorZ
5256 pub union CResult_InMemorySignerDecodeErrorZPtr {
5257         /// A pointer to the contents in the success state.
5258         /// Reading from this pointer when `result_ok` is not set is undefined.
5259         pub result: *mut crate::chain::keysinterface::InMemorySigner,
5260         /// A pointer to the contents in the error state.
5261         /// Reading from this pointer when `result_ok` is set is undefined.
5262         pub err: *mut crate::ln::msgs::DecodeError,
5263 }
5264 #[repr(C)]
5265 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5266 /// containing a crate::chain::keysinterface::InMemorySigner on success and a crate::ln::msgs::DecodeError on failure.
5267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5268 pub struct CResult_InMemorySignerDecodeErrorZ {
5269         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5270         /// `err` or `result` depending on the state of `result_ok`.
5271         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5272         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5273         pub result_ok: bool,
5274 }
5275 #[no_mangle]
5276 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5277 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5278         CResult_InMemorySignerDecodeErrorZ {
5279                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5280                         result: Box::into_raw(Box::new(o)),
5281                 },
5282                 result_ok: true,
5283         }
5284 }
5285 #[no_mangle]
5286 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5287 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5288         CResult_InMemorySignerDecodeErrorZ {
5289                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5290                         err: Box::into_raw(Box::new(e)),
5291                 },
5292                 result_ok: false,
5293         }
5294 }
5295 #[no_mangle]
5296 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5297 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5298 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5299         fn drop(&mut self) {
5300                 if self.result_ok {
5301                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5302                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5303                         }
5304                 } else {
5305                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5306                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5307                         }
5308                 }
5309         }
5310 }
5311 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5312         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>) -> Self {
5313                 let contents = if o.result_ok {
5314                         let result = unsafe { o.contents.result };
5315                         unsafe { o.contents.result = std::ptr::null_mut() };
5316                         CResult_InMemorySignerDecodeErrorZPtr { result }
5317                 } else {
5318                         let err = unsafe { o.contents.err };
5319                         unsafe { o.contents.err = std::ptr::null_mut(); }
5320                         CResult_InMemorySignerDecodeErrorZPtr { err }
5321                 };
5322                 Self {
5323                         contents,
5324                         result_ok: o.result_ok,
5325                 }
5326         }
5327 }
5328 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5329         fn clone(&self) -> Self {
5330                 if self.result_ok {
5331                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5332                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5333                         } }
5334                 } else {
5335                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5336                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5337                         } }
5338                 }
5339         }
5340 }
5341 #[no_mangle]
5342 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5343 /// but with all dynamically-allocated buffers duplicated in new buffers.
5344 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
5345 #[repr(C)]
5346 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5347 /// This corresponds to std::vector in C++
5348 pub struct CVec_TxOutZ {
5349         /// The elements in the array.
5350         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5351         pub data: *mut crate::c_types::TxOut,
5352         /// The number of elements pointed to by `data`.
5353         pub datalen: usize
5354 }
5355 impl CVec_TxOutZ {
5356         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5357                 if self.datalen == 0 { return Vec::new(); }
5358                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5359                 self.data = std::ptr::null_mut();
5360                 self.datalen = 0;
5361                 ret
5362         }
5363         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5364                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5365         }
5366 }
5367 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5368         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5369                 let datalen = v.len();
5370                 let data = Box::into_raw(v.into_boxed_slice());
5371                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5372         }
5373 }
5374 #[no_mangle]
5375 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5376 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5377 impl Drop for CVec_TxOutZ {
5378         fn drop(&mut self) {
5379                 if self.datalen == 0 { return; }
5380                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5381         }
5382 }
5383 impl Clone for CVec_TxOutZ {
5384         fn clone(&self) -> Self {
5385                 let mut res = Vec::new();
5386                 if self.datalen == 0 { return Self::from(res); }
5387                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5388                 Self::from(res)
5389         }
5390 }
5391 #[repr(C)]
5392 /// The contents of CResult_TransactionNoneZ
5393 pub union CResult_TransactionNoneZPtr {
5394         /// A pointer to the contents in the success state.
5395         /// Reading from this pointer when `result_ok` is not set is undefined.
5396         pub result: *mut crate::c_types::Transaction,
5397         /// Note that this value is always NULL, as there are no contents in the Err variant
5398         pub err: *mut std::ffi::c_void,
5399 }
5400 #[repr(C)]
5401 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5402 /// containing a crate::c_types::Transaction on success and a () on failure.
5403 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5404 pub struct CResult_TransactionNoneZ {
5405         /// The contents of this CResult_TransactionNoneZ, accessible via either
5406         /// `err` or `result` depending on the state of `result_ok`.
5407         pub contents: CResult_TransactionNoneZPtr,
5408         /// Whether this CResult_TransactionNoneZ represents a success state.
5409         pub result_ok: bool,
5410 }
5411 #[no_mangle]
5412 /// Creates a new CResult_TransactionNoneZ in the success state.
5413 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5414         CResult_TransactionNoneZ {
5415                 contents: CResult_TransactionNoneZPtr {
5416                         result: Box::into_raw(Box::new(o)),
5417                 },
5418                 result_ok: true,
5419         }
5420 }
5421 #[no_mangle]
5422 /// Creates a new CResult_TransactionNoneZ in the error state.
5423 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5424         CResult_TransactionNoneZ {
5425                 contents: CResult_TransactionNoneZPtr {
5426                         err: std::ptr::null_mut(),
5427                 },
5428                 result_ok: false,
5429         }
5430 }
5431 #[no_mangle]
5432 /// Frees any resources used by the CResult_TransactionNoneZ.
5433 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5434 impl Drop for CResult_TransactionNoneZ {
5435         fn drop(&mut self) {
5436                 if self.result_ok {
5437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5439                         }
5440                 } else {
5441                 }
5442         }
5443 }
5444 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
5445         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
5446                 let contents = if o.result_ok {
5447                         let result = unsafe { o.contents.result };
5448                         unsafe { o.contents.result = std::ptr::null_mut() };
5449                         CResult_TransactionNoneZPtr { result }
5450                 } else {
5451                         let _ = unsafe { Box::from_raw(o.contents.err) };
5452                         o.contents.err = std::ptr::null_mut();
5453                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
5454                 };
5455                 Self {
5456                         contents,
5457                         result_ok: o.result_ok,
5458                 }
5459         }
5460 }
5461 #[repr(C)]
5462 /// A dynamically-allocated array of crate::routing::router::RouteHops of arbitrary size.
5463 /// This corresponds to std::vector in C++
5464 pub struct CVec_RouteHopZ {
5465         /// The elements in the array.
5466         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5467         pub data: *mut crate::routing::router::RouteHop,
5468         /// The number of elements pointed to by `data`.
5469         pub datalen: usize
5470 }
5471 impl CVec_RouteHopZ {
5472         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
5473                 if self.datalen == 0 { return Vec::new(); }
5474                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5475                 self.data = std::ptr::null_mut();
5476                 self.datalen = 0;
5477                 ret
5478         }
5479         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
5480                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5481         }
5482 }
5483 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
5484         fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
5485                 let datalen = v.len();
5486                 let data = Box::into_raw(v.into_boxed_slice());
5487                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5488         }
5489 }
5490 #[no_mangle]
5491 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5492 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
5493 impl Drop for CVec_RouteHopZ {
5494         fn drop(&mut self) {
5495                 if self.datalen == 0 { return; }
5496                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5497         }
5498 }
5499 impl Clone for CVec_RouteHopZ {
5500         fn clone(&self) -> Self {
5501                 let mut res = Vec::new();
5502                 if self.datalen == 0 { return Self::from(res); }
5503                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5504                 Self::from(res)
5505         }
5506 }
5507 #[repr(C)]
5508 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
5509 /// This corresponds to std::vector in C++
5510 pub struct CVec_CVec_RouteHopZZ {
5511         /// The elements in the array.
5512         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5513         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
5514         /// The number of elements pointed to by `data`.
5515         pub datalen: usize
5516 }
5517 impl CVec_CVec_RouteHopZZ {
5518         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
5519                 if self.datalen == 0 { return Vec::new(); }
5520                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5521                 self.data = std::ptr::null_mut();
5522                 self.datalen = 0;
5523                 ret
5524         }
5525         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
5526                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5527         }
5528 }
5529 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
5530         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
5531                 let datalen = v.len();
5532                 let data = Box::into_raw(v.into_boxed_slice());
5533                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5534         }
5535 }
5536 #[no_mangle]
5537 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5538 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
5539 impl Drop for CVec_CVec_RouteHopZZ {
5540         fn drop(&mut self) {
5541                 if self.datalen == 0 { return; }
5542                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5543         }
5544 }
5545 impl Clone for CVec_CVec_RouteHopZZ {
5546         fn clone(&self) -> Self {
5547                 let mut res = Vec::new();
5548                 if self.datalen == 0 { return Self::from(res); }
5549                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5550                 Self::from(res)
5551         }
5552 }
5553 #[repr(C)]
5554 /// The contents of CResult_RouteDecodeErrorZ
5555 pub union CResult_RouteDecodeErrorZPtr {
5556         /// A pointer to the contents in the success state.
5557         /// Reading from this pointer when `result_ok` is not set is undefined.
5558         pub result: *mut crate::routing::router::Route,
5559         /// A pointer to the contents in the error state.
5560         /// Reading from this pointer when `result_ok` is set is undefined.
5561         pub err: *mut crate::ln::msgs::DecodeError,
5562 }
5563 #[repr(C)]
5564 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
5565 /// containing a crate::routing::router::Route on success and a crate::ln::msgs::DecodeError on failure.
5566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5567 pub struct CResult_RouteDecodeErrorZ {
5568         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
5569         /// `err` or `result` depending on the state of `result_ok`.
5570         pub contents: CResult_RouteDecodeErrorZPtr,
5571         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
5572         pub result_ok: bool,
5573 }
5574 #[no_mangle]
5575 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
5576 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
5577         CResult_RouteDecodeErrorZ {
5578                 contents: CResult_RouteDecodeErrorZPtr {
5579                         result: Box::into_raw(Box::new(o)),
5580                 },
5581                 result_ok: true,
5582         }
5583 }
5584 #[no_mangle]
5585 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
5586 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
5587         CResult_RouteDecodeErrorZ {
5588                 contents: CResult_RouteDecodeErrorZPtr {
5589                         err: Box::into_raw(Box::new(e)),
5590                 },
5591                 result_ok: false,
5592         }
5593 }
5594 #[no_mangle]
5595 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
5596 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
5597 impl Drop for CResult_RouteDecodeErrorZ {
5598         fn drop(&mut self) {
5599                 if self.result_ok {
5600                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5601                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5602                         }
5603                 } else {
5604                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5605                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5606                         }
5607                 }
5608         }
5609 }
5610 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
5611         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
5612                 let contents = if o.result_ok {
5613                         let result = unsafe { o.contents.result };
5614                         unsafe { o.contents.result = std::ptr::null_mut() };
5615                         CResult_RouteDecodeErrorZPtr { result }
5616                 } else {
5617                         let err = unsafe { o.contents.err };
5618                         unsafe { o.contents.err = std::ptr::null_mut(); }
5619                         CResult_RouteDecodeErrorZPtr { err }
5620                 };
5621                 Self {
5622                         contents,
5623                         result_ok: o.result_ok,
5624                 }
5625         }
5626 }
5627 impl Clone for CResult_RouteDecodeErrorZ {
5628         fn clone(&self) -> Self {
5629                 if self.result_ok {
5630                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
5631                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
5632                         } }
5633                 } else {
5634                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
5635                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5636                         } }
5637                 }
5638         }
5639 }
5640 #[no_mangle]
5641 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
5642 /// but with all dynamically-allocated buffers duplicated in new buffers.
5643 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
5644 #[repr(C)]
5645 /// A dynamically-allocated array of crate::routing::router::RouteHints of arbitrary size.
5646 /// This corresponds to std::vector in C++
5647 pub struct CVec_RouteHintZ {
5648         /// The elements in the array.
5649         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5650         pub data: *mut crate::routing::router::RouteHint,
5651         /// The number of elements pointed to by `data`.
5652         pub datalen: usize
5653 }
5654 impl CVec_RouteHintZ {
5655         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
5656                 if self.datalen == 0 { return Vec::new(); }
5657                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5658                 self.data = std::ptr::null_mut();
5659                 self.datalen = 0;
5660                 ret
5661         }
5662         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
5663                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5664         }
5665 }
5666 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
5667         fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
5668                 let datalen = v.len();
5669                 let data = Box::into_raw(v.into_boxed_slice());
5670                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5671         }
5672 }
5673 #[no_mangle]
5674 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5675 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
5676 impl Drop for CVec_RouteHintZ {
5677         fn drop(&mut self) {
5678                 if self.datalen == 0 { return; }
5679                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5680         }
5681 }
5682 impl Clone for CVec_RouteHintZ {
5683         fn clone(&self) -> Self {
5684                 let mut res = Vec::new();
5685                 if self.datalen == 0 { return Self::from(res); }
5686                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5687                 Self::from(res)
5688         }
5689 }
5690 #[repr(C)]
5691 /// The contents of CResult_RouteLightningErrorZ
5692 pub union CResult_RouteLightningErrorZPtr {
5693         /// A pointer to the contents in the success state.
5694         /// Reading from this pointer when `result_ok` is not set is undefined.
5695         pub result: *mut crate::routing::router::Route,
5696         /// A pointer to the contents in the error state.
5697         /// Reading from this pointer when `result_ok` is set is undefined.
5698         pub err: *mut crate::ln::msgs::LightningError,
5699 }
5700 #[repr(C)]
5701 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
5702 /// containing a crate::routing::router::Route on success and a crate::ln::msgs::LightningError on failure.
5703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5704 pub struct CResult_RouteLightningErrorZ {
5705         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
5706         /// `err` or `result` depending on the state of `result_ok`.
5707         pub contents: CResult_RouteLightningErrorZPtr,
5708         /// Whether this CResult_RouteLightningErrorZ represents a success state.
5709         pub result_ok: bool,
5710 }
5711 #[no_mangle]
5712 /// Creates a new CResult_RouteLightningErrorZ in the success state.
5713 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
5714         CResult_RouteLightningErrorZ {
5715                 contents: CResult_RouteLightningErrorZPtr {
5716                         result: Box::into_raw(Box::new(o)),
5717                 },
5718                 result_ok: true,
5719         }
5720 }
5721 #[no_mangle]
5722 /// Creates a new CResult_RouteLightningErrorZ in the error state.
5723 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
5724         CResult_RouteLightningErrorZ {
5725                 contents: CResult_RouteLightningErrorZPtr {
5726                         err: Box::into_raw(Box::new(e)),
5727                 },
5728                 result_ok: false,
5729         }
5730 }
5731 #[no_mangle]
5732 /// Frees any resources used by the CResult_RouteLightningErrorZ.
5733 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
5734 impl Drop for CResult_RouteLightningErrorZ {
5735         fn drop(&mut self) {
5736                 if self.result_ok {
5737                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5738                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5739                         }
5740                 } else {
5741                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5742                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5743                         }
5744                 }
5745         }
5746 }
5747 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
5748         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
5749                 let contents = if o.result_ok {
5750                         let result = unsafe { o.contents.result };
5751                         unsafe { o.contents.result = std::ptr::null_mut() };
5752                         CResult_RouteLightningErrorZPtr { result }
5753                 } else {
5754                         let err = unsafe { o.contents.err };
5755                         unsafe { o.contents.err = std::ptr::null_mut(); }
5756                         CResult_RouteLightningErrorZPtr { err }
5757                 };
5758                 Self {
5759                         contents,
5760                         result_ok: o.result_ok,
5761                 }
5762         }
5763 }
5764 impl Clone for CResult_RouteLightningErrorZ {
5765         fn clone(&self) -> Self {
5766                 if self.result_ok {
5767                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
5768                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
5769                         } }
5770                 } else {
5771                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
5772                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5773                         } }
5774                 }
5775         }
5776 }
5777 #[no_mangle]
5778 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
5779 /// but with all dynamically-allocated buffers duplicated in new buffers.
5780 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
5781 #[repr(C)]
5782 /// The contents of CResult_NetAddressu8Z
5783 pub union CResult_NetAddressu8ZPtr {
5784         /// A pointer to the contents in the success state.
5785         /// Reading from this pointer when `result_ok` is not set is undefined.
5786         pub result: *mut crate::ln::msgs::NetAddress,
5787         /// A pointer to the contents in the error state.
5788         /// Reading from this pointer when `result_ok` is set is undefined.
5789         pub err: *mut u8,
5790 }
5791 #[repr(C)]
5792 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5793 /// containing a crate::ln::msgs::NetAddress on success and a u8 on failure.
5794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5795 pub struct CResult_NetAddressu8Z {
5796         /// The contents of this CResult_NetAddressu8Z, accessible via either
5797         /// `err` or `result` depending on the state of `result_ok`.
5798         pub contents: CResult_NetAddressu8ZPtr,
5799         /// Whether this CResult_NetAddressu8Z represents a success state.
5800         pub result_ok: bool,
5801 }
5802 #[no_mangle]
5803 /// Creates a new CResult_NetAddressu8Z in the success state.
5804 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5805         CResult_NetAddressu8Z {
5806                 contents: CResult_NetAddressu8ZPtr {
5807                         result: Box::into_raw(Box::new(o)),
5808                 },
5809                 result_ok: true,
5810         }
5811 }
5812 #[no_mangle]
5813 /// Creates a new CResult_NetAddressu8Z in the error state.
5814 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5815         CResult_NetAddressu8Z {
5816                 contents: CResult_NetAddressu8ZPtr {
5817                         err: Box::into_raw(Box::new(e)),
5818                 },
5819                 result_ok: false,
5820         }
5821 }
5822 #[no_mangle]
5823 /// Frees any resources used by the CResult_NetAddressu8Z.
5824 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5825 impl Drop for CResult_NetAddressu8Z {
5826         fn drop(&mut self) {
5827                 if self.result_ok {
5828                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5829                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5830                         }
5831                 } else {
5832                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5833                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5834                         }
5835                 }
5836         }
5837 }
5838 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5839         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
5840                 let contents = if o.result_ok {
5841                         let result = unsafe { o.contents.result };
5842                         unsafe { o.contents.result = std::ptr::null_mut() };
5843                         CResult_NetAddressu8ZPtr { result }
5844                 } else {
5845                         let err = unsafe { o.contents.err };
5846                         unsafe { o.contents.err = std::ptr::null_mut(); }
5847                         CResult_NetAddressu8ZPtr { err }
5848                 };
5849                 Self {
5850                         contents,
5851                         result_ok: o.result_ok,
5852                 }
5853         }
5854 }
5855 impl Clone for CResult_NetAddressu8Z {
5856         fn clone(&self) -> Self {
5857                 if self.result_ok {
5858                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5859                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5860                         } }
5861                 } else {
5862                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5863                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5864                         } }
5865                 }
5866         }
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5872 #[repr(C)]
5873 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5874 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5875         /// A pointer to the contents in the success state.
5876         /// Reading from this pointer when `result_ok` is not set is undefined.
5877         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
5878         /// A pointer to the contents in the error state.
5879         /// Reading from this pointer when `result_ok` is set is undefined.
5880         pub err: *mut crate::ln::msgs::DecodeError,
5881 }
5882 #[repr(C)]
5883 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5884 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::ln::msgs::DecodeError on failure.
5885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5887         /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5888         /// `err` or `result` depending on the state of `result_ok`.
5889         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5890         /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5891         pub result_ok: bool,
5892 }
5893 #[no_mangle]
5894 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5895 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5896         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5897                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5898                         result: Box::into_raw(Box::new(o)),
5899                 },
5900                 result_ok: true,
5901         }
5902 }
5903 #[no_mangle]
5904 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5905 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5906         CResult_CResult_NetAddressu8ZDecodeErrorZ {
5907                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5908                         err: Box::into_raw(Box::new(e)),
5909                 },
5910                 result_ok: false,
5911         }
5912 }
5913 #[no_mangle]
5914 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
5915 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5916 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5917         fn drop(&mut self) {
5918                 if self.result_ok {
5919                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5920                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5921                         }
5922                 } else {
5923                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5924                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5925                         }
5926                 }
5927         }
5928 }
5929 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5930         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
5931                 let contents = if o.result_ok {
5932                         let result = unsafe { o.contents.result };
5933                         unsafe { o.contents.result = std::ptr::null_mut() };
5934                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5935                 } else {
5936                         let err = unsafe { o.contents.err };
5937                         unsafe { o.contents.err = std::ptr::null_mut(); }
5938                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5939                 };
5940                 Self {
5941                         contents,
5942                         result_ok: o.result_ok,
5943                 }
5944         }
5945 }
5946 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5947         fn clone(&self) -> Self {
5948                 if self.result_ok {
5949                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5950                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5951                         } }
5952                 } else {
5953                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5954                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5955                         } }
5956                 }
5957         }
5958 }
5959 #[no_mangle]
5960 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5961 /// but with all dynamically-allocated buffers duplicated in new buffers.
5962 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5963 #[repr(C)]
5964 /// A dynamically-allocated array of crate::ln::msgs::UpdateAddHTLCs of arbitrary size.
5965 /// This corresponds to std::vector in C++
5966 pub struct CVec_UpdateAddHTLCZ {
5967         /// The elements in the array.
5968         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5969         pub data: *mut crate::ln::msgs::UpdateAddHTLC,
5970         /// The number of elements pointed to by `data`.
5971         pub datalen: usize
5972 }
5973 impl CVec_UpdateAddHTLCZ {
5974         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
5975                 if self.datalen == 0 { return Vec::new(); }
5976                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5977                 self.data = std::ptr::null_mut();
5978                 self.datalen = 0;
5979                 ret
5980         }
5981         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
5982                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5983         }
5984 }
5985 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
5986         fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
5987                 let datalen = v.len();
5988                 let data = Box::into_raw(v.into_boxed_slice());
5989                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5990         }
5991 }
5992 #[no_mangle]
5993 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5994 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
5995 impl Drop for CVec_UpdateAddHTLCZ {
5996         fn drop(&mut self) {
5997                 if self.datalen == 0 { return; }
5998                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5999         }
6000 }
6001 impl Clone for CVec_UpdateAddHTLCZ {
6002         fn clone(&self) -> Self {
6003                 let mut res = Vec::new();
6004                 if self.datalen == 0 { return Self::from(res); }
6005                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6006                 Self::from(res)
6007         }
6008 }
6009 #[repr(C)]
6010 /// A dynamically-allocated array of crate::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6011 /// This corresponds to std::vector in C++
6012 pub struct CVec_UpdateFulfillHTLCZ {
6013         /// The elements in the array.
6014         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6015         pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
6016         /// The number of elements pointed to by `data`.
6017         pub datalen: usize
6018 }
6019 impl CVec_UpdateFulfillHTLCZ {
6020         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
6021                 if self.datalen == 0 { return Vec::new(); }
6022                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6023                 self.data = std::ptr::null_mut();
6024                 self.datalen = 0;
6025                 ret
6026         }
6027         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
6028                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6029         }
6030 }
6031 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
6032         fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
6033                 let datalen = v.len();
6034                 let data = Box::into_raw(v.into_boxed_slice());
6035                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6036         }
6037 }
6038 #[no_mangle]
6039 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6040 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
6041 impl Drop for CVec_UpdateFulfillHTLCZ {
6042         fn drop(&mut self) {
6043                 if self.datalen == 0 { return; }
6044                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6045         }
6046 }
6047 impl Clone for CVec_UpdateFulfillHTLCZ {
6048         fn clone(&self) -> Self {
6049                 let mut res = Vec::new();
6050                 if self.datalen == 0 { return Self::from(res); }
6051                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6052                 Self::from(res)
6053         }
6054 }
6055 #[repr(C)]
6056 /// A dynamically-allocated array of crate::ln::msgs::UpdateFailHTLCs of arbitrary size.
6057 /// This corresponds to std::vector in C++
6058 pub struct CVec_UpdateFailHTLCZ {
6059         /// The elements in the array.
6060         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6061         pub data: *mut crate::ln::msgs::UpdateFailHTLC,
6062         /// The number of elements pointed to by `data`.
6063         pub datalen: usize
6064 }
6065 impl CVec_UpdateFailHTLCZ {
6066         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
6067                 if self.datalen == 0 { return Vec::new(); }
6068                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6069                 self.data = std::ptr::null_mut();
6070                 self.datalen = 0;
6071                 ret
6072         }
6073         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
6074                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6075         }
6076 }
6077 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
6078         fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
6079                 let datalen = v.len();
6080                 let data = Box::into_raw(v.into_boxed_slice());
6081                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6082         }
6083 }
6084 #[no_mangle]
6085 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6086 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
6087 impl Drop for CVec_UpdateFailHTLCZ {
6088         fn drop(&mut self) {
6089                 if self.datalen == 0 { return; }
6090                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6091         }
6092 }
6093 impl Clone for CVec_UpdateFailHTLCZ {
6094         fn clone(&self) -> Self {
6095                 let mut res = Vec::new();
6096                 if self.datalen == 0 { return Self::from(res); }
6097                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6098                 Self::from(res)
6099         }
6100 }
6101 #[repr(C)]
6102 /// A dynamically-allocated array of crate::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6103 /// This corresponds to std::vector in C++
6104 pub struct CVec_UpdateFailMalformedHTLCZ {
6105         /// The elements in the array.
6106         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6107         pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
6108         /// The number of elements pointed to by `data`.
6109         pub datalen: usize
6110 }
6111 impl CVec_UpdateFailMalformedHTLCZ {
6112         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
6113                 if self.datalen == 0 { return Vec::new(); }
6114                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6115                 self.data = std::ptr::null_mut();
6116                 self.datalen = 0;
6117                 ret
6118         }
6119         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
6120                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6121         }
6122 }
6123 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
6124         fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
6125                 let datalen = v.len();
6126                 let data = Box::into_raw(v.into_boxed_slice());
6127                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6128         }
6129 }
6130 #[no_mangle]
6131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6132 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
6133 impl Drop for CVec_UpdateFailMalformedHTLCZ {
6134         fn drop(&mut self) {
6135                 if self.datalen == 0 { return; }
6136                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6137         }
6138 }
6139 impl Clone for CVec_UpdateFailMalformedHTLCZ {
6140         fn clone(&self) -> Self {
6141                 let mut res = Vec::new();
6142                 if self.datalen == 0 { return Self::from(res); }
6143                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6144                 Self::from(res)
6145         }
6146 }
6147 #[repr(C)]
6148 /// The contents of CResult_AcceptChannelDecodeErrorZ
6149 pub union CResult_AcceptChannelDecodeErrorZPtr {
6150         /// A pointer to the contents in the success state.
6151         /// Reading from this pointer when `result_ok` is not set is undefined.
6152         pub result: *mut crate::ln::msgs::AcceptChannel,
6153         /// A pointer to the contents in the error state.
6154         /// Reading from this pointer when `result_ok` is set is undefined.
6155         pub err: *mut crate::ln::msgs::DecodeError,
6156 }
6157 #[repr(C)]
6158 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6159 /// containing a crate::ln::msgs::AcceptChannel on success and a crate::ln::msgs::DecodeError on failure.
6160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6161 pub struct CResult_AcceptChannelDecodeErrorZ {
6162         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6163         /// `err` or `result` depending on the state of `result_ok`.
6164         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
6165         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6166         pub result_ok: bool,
6167 }
6168 #[no_mangle]
6169 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
6170 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
6171         CResult_AcceptChannelDecodeErrorZ {
6172                 contents: CResult_AcceptChannelDecodeErrorZPtr {
6173                         result: Box::into_raw(Box::new(o)),
6174                 },
6175                 result_ok: true,
6176         }
6177 }
6178 #[no_mangle]
6179 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
6180 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
6181         CResult_AcceptChannelDecodeErrorZ {
6182                 contents: CResult_AcceptChannelDecodeErrorZPtr {
6183                         err: Box::into_raw(Box::new(e)),
6184                 },
6185                 result_ok: false,
6186         }
6187 }
6188 #[no_mangle]
6189 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
6190 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
6191 impl Drop for CResult_AcceptChannelDecodeErrorZ {
6192         fn drop(&mut self) {
6193                 if self.result_ok {
6194                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6195                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6196                         }
6197                 } else {
6198                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6199                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6200                         }
6201                 }
6202         }
6203 }
6204 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
6205         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>) -> Self {
6206                 let contents = if o.result_ok {
6207                         let result = unsafe { o.contents.result };
6208                         unsafe { o.contents.result = std::ptr::null_mut() };
6209                         CResult_AcceptChannelDecodeErrorZPtr { result }
6210                 } else {
6211                         let err = unsafe { o.contents.err };
6212                         unsafe { o.contents.err = std::ptr::null_mut(); }
6213                         CResult_AcceptChannelDecodeErrorZPtr { err }
6214                 };
6215                 Self {
6216                         contents,
6217                         result_ok: o.result_ok,
6218                 }
6219         }
6220 }
6221 impl Clone for CResult_AcceptChannelDecodeErrorZ {
6222         fn clone(&self) -> Self {
6223                 if self.result_ok {
6224                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
6225                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
6226                         } }
6227                 } else {
6228                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
6229                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6230                         } }
6231                 }
6232         }
6233 }
6234 #[no_mangle]
6235 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
6236 /// but with all dynamically-allocated buffers duplicated in new buffers.
6237 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
6238 #[repr(C)]
6239 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6240 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
6241         /// A pointer to the contents in the success state.
6242         /// Reading from this pointer when `result_ok` is not set is undefined.
6243         pub result: *mut crate::ln::msgs::AnnouncementSignatures,
6244         /// A pointer to the contents in the error state.
6245         /// Reading from this pointer when `result_ok` is set is undefined.
6246         pub err: *mut crate::ln::msgs::DecodeError,
6247 }
6248 #[repr(C)]
6249 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6250 /// containing a crate::ln::msgs::AnnouncementSignatures on success and a crate::ln::msgs::DecodeError on failure.
6251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6252 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
6253         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6254         /// `err` or `result` depending on the state of `result_ok`.
6255         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
6256         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6257         pub result_ok: bool,
6258 }
6259 #[no_mangle]
6260 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
6261 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6262         CResult_AnnouncementSignaturesDecodeErrorZ {
6263                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6264                         result: Box::into_raw(Box::new(o)),
6265                 },
6266                 result_ok: true,
6267         }
6268 }
6269 #[no_mangle]
6270 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
6271 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6272         CResult_AnnouncementSignaturesDecodeErrorZ {
6273                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6274                         err: Box::into_raw(Box::new(e)),
6275                 },
6276                 result_ok: false,
6277         }
6278 }
6279 #[no_mangle]
6280 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
6281 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
6282 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
6283         fn drop(&mut self) {
6284                 if self.result_ok {
6285                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6286                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6287                         }
6288                 } else {
6289                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6290                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6291                         }
6292                 }
6293         }
6294 }
6295 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6296         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>) -> Self {
6297                 let contents = if o.result_ok {
6298                         let result = unsafe { o.contents.result };
6299                         unsafe { o.contents.result = std::ptr::null_mut() };
6300                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6301                 } else {
6302                         let err = unsafe { o.contents.err };
6303                         unsafe { o.contents.err = std::ptr::null_mut(); }
6304                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6305                 };
6306                 Self {
6307                         contents,
6308                         result_ok: o.result_ok,
6309                 }
6310         }
6311 }
6312 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6313         fn clone(&self) -> Self {
6314                 if self.result_ok {
6315                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6316                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6317                         } }
6318                 } else {
6319                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6320                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6321                         } }
6322                 }
6323         }
6324 }
6325 #[no_mangle]
6326 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6327 /// but with all dynamically-allocated buffers duplicated in new buffers.
6328 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6329 #[repr(C)]
6330 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6331 pub union CResult_ChannelReestablishDecodeErrorZPtr {
6332         /// A pointer to the contents in the success state.
6333         /// Reading from this pointer when `result_ok` is not set is undefined.
6334         pub result: *mut crate::ln::msgs::ChannelReestablish,
6335         /// A pointer to the contents in the error state.
6336         /// Reading from this pointer when `result_ok` is set is undefined.
6337         pub err: *mut crate::ln::msgs::DecodeError,
6338 }
6339 #[repr(C)]
6340 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6341 /// containing a crate::ln::msgs::ChannelReestablish on success and a crate::ln::msgs::DecodeError on failure.
6342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6343 pub struct CResult_ChannelReestablishDecodeErrorZ {
6344         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6345         /// `err` or `result` depending on the state of `result_ok`.
6346         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6347         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6348         pub result_ok: bool,
6349 }
6350 #[no_mangle]
6351 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6352 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6353         CResult_ChannelReestablishDecodeErrorZ {
6354                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6355                         result: Box::into_raw(Box::new(o)),
6356                 },
6357                 result_ok: true,
6358         }
6359 }
6360 #[no_mangle]
6361 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6362 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6363         CResult_ChannelReestablishDecodeErrorZ {
6364                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6365                         err: Box::into_raw(Box::new(e)),
6366                 },
6367                 result_ok: false,
6368         }
6369 }
6370 #[no_mangle]
6371 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
6372 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6373 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
6374         fn drop(&mut self) {
6375                 if self.result_ok {
6376                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6377                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6378                         }
6379                 } else {
6380                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6381                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6382                         }
6383                 }
6384         }
6385 }
6386 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6387         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
6388                 let contents = if o.result_ok {
6389                         let result = unsafe { o.contents.result };
6390                         unsafe { o.contents.result = std::ptr::null_mut() };
6391                         CResult_ChannelReestablishDecodeErrorZPtr { result }
6392                 } else {
6393                         let err = unsafe { o.contents.err };
6394                         unsafe { o.contents.err = std::ptr::null_mut(); }
6395                         CResult_ChannelReestablishDecodeErrorZPtr { err }
6396                 };
6397                 Self {
6398                         contents,
6399                         result_ok: o.result_ok,
6400                 }
6401         }
6402 }
6403 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6404         fn clone(&self) -> Self {
6405                 if self.result_ok {
6406                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6407                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6408                         } }
6409                 } else {
6410                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6411                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6412                         } }
6413                 }
6414         }
6415 }
6416 #[no_mangle]
6417 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6418 /// but with all dynamically-allocated buffers duplicated in new buffers.
6419 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6420 #[repr(C)]
6421 /// The contents of CResult_ClosingSignedDecodeErrorZ
6422 pub union CResult_ClosingSignedDecodeErrorZPtr {
6423         /// A pointer to the contents in the success state.
6424         /// Reading from this pointer when `result_ok` is not set is undefined.
6425         pub result: *mut crate::ln::msgs::ClosingSigned,
6426         /// A pointer to the contents in the error state.
6427         /// Reading from this pointer when `result_ok` is set is undefined.
6428         pub err: *mut crate::ln::msgs::DecodeError,
6429 }
6430 #[repr(C)]
6431 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6432 /// containing a crate::ln::msgs::ClosingSigned on success and a crate::ln::msgs::DecodeError on failure.
6433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6434 pub struct CResult_ClosingSignedDecodeErrorZ {
6435         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6436         /// `err` or `result` depending on the state of `result_ok`.
6437         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6438         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6439         pub result_ok: bool,
6440 }
6441 #[no_mangle]
6442 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6443 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6444         CResult_ClosingSignedDecodeErrorZ {
6445                 contents: CResult_ClosingSignedDecodeErrorZPtr {
6446                         result: Box::into_raw(Box::new(o)),
6447                 },
6448                 result_ok: true,
6449         }
6450 }
6451 #[no_mangle]
6452 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6453 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6454         CResult_ClosingSignedDecodeErrorZ {
6455                 contents: CResult_ClosingSignedDecodeErrorZPtr {
6456                         err: Box::into_raw(Box::new(e)),
6457                 },
6458                 result_ok: false,
6459         }
6460 }
6461 #[no_mangle]
6462 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
6463 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6464 impl Drop for CResult_ClosingSignedDecodeErrorZ {
6465         fn drop(&mut self) {
6466                 if self.result_ok {
6467                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6468                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6469                         }
6470                 } else {
6471                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6472                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6473                         }
6474                 }
6475         }
6476 }
6477 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6478         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>) -> Self {
6479                 let contents = if o.result_ok {
6480                         let result = unsafe { o.contents.result };
6481                         unsafe { o.contents.result = std::ptr::null_mut() };
6482                         CResult_ClosingSignedDecodeErrorZPtr { result }
6483                 } else {
6484                         let err = unsafe { o.contents.err };
6485                         unsafe { o.contents.err = std::ptr::null_mut(); }
6486                         CResult_ClosingSignedDecodeErrorZPtr { err }
6487                 };
6488                 Self {
6489                         contents,
6490                         result_ok: o.result_ok,
6491                 }
6492         }
6493 }
6494 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6495         fn clone(&self) -> Self {
6496                 if self.result_ok {
6497                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6498                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6499                         } }
6500                 } else {
6501                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
6502                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6503                         } }
6504                 }
6505         }
6506 }
6507 #[no_mangle]
6508 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
6509 /// but with all dynamically-allocated buffers duplicated in new buffers.
6510 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6511 #[repr(C)]
6512 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6513 pub union CResult_CommitmentSignedDecodeErrorZPtr {
6514         /// A pointer to the contents in the success state.
6515         /// Reading from this pointer when `result_ok` is not set is undefined.
6516         pub result: *mut crate::ln::msgs::CommitmentSigned,
6517         /// A pointer to the contents in the error state.
6518         /// Reading from this pointer when `result_ok` is set is undefined.
6519         pub err: *mut crate::ln::msgs::DecodeError,
6520 }
6521 #[repr(C)]
6522 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6523 /// containing a crate::ln::msgs::CommitmentSigned on success and a crate::ln::msgs::DecodeError on failure.
6524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6525 pub struct CResult_CommitmentSignedDecodeErrorZ {
6526         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6527         /// `err` or `result` depending on the state of `result_ok`.
6528         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6529         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6530         pub result_ok: bool,
6531 }
6532 #[no_mangle]
6533 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6534 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6535         CResult_CommitmentSignedDecodeErrorZ {
6536                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6537                         result: Box::into_raw(Box::new(o)),
6538                 },
6539                 result_ok: true,
6540         }
6541 }
6542 #[no_mangle]
6543 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6545         CResult_CommitmentSignedDecodeErrorZ {
6546                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6547                         err: Box::into_raw(Box::new(e)),
6548                 },
6549                 result_ok: false,
6550         }
6551 }
6552 #[no_mangle]
6553 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
6554 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6555 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
6556         fn drop(&mut self) {
6557                 if self.result_ok {
6558                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6559                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6560                         }
6561                 } else {
6562                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6563                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6564                         }
6565                 }
6566         }
6567 }
6568 impl From<crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6569         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>) -> Self {
6570                 let contents = if o.result_ok {
6571                         let result = unsafe { o.contents.result };
6572                         unsafe { o.contents.result = std::ptr::null_mut() };
6573                         CResult_CommitmentSignedDecodeErrorZPtr { result }
6574                 } else {
6575                         let err = unsafe { o.contents.err };
6576                         unsafe { o.contents.err = std::ptr::null_mut(); }
6577                         CResult_CommitmentSignedDecodeErrorZPtr { err }
6578                 };
6579                 Self {
6580                         contents,
6581                         result_ok: o.result_ok,
6582                 }
6583         }
6584 }
6585 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6586         fn clone(&self) -> Self {
6587                 if self.result_ok {
6588                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6589                                 result: Box::into_raw(Box::new(<crate::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6590                         } }
6591                 } else {
6592                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6593                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6594                         } }
6595                 }
6596         }
6597 }
6598 #[no_mangle]
6599 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6600 /// but with all dynamically-allocated buffers duplicated in new buffers.
6601 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6602 #[repr(C)]
6603 /// The contents of CResult_FundingCreatedDecodeErrorZ
6604 pub union CResult_FundingCreatedDecodeErrorZPtr {
6605         /// A pointer to the contents in the success state.
6606         /// Reading from this pointer when `result_ok` is not set is undefined.
6607         pub result: *mut crate::ln::msgs::FundingCreated,
6608         /// A pointer to the contents in the error state.
6609         /// Reading from this pointer when `result_ok` is set is undefined.
6610         pub err: *mut crate::ln::msgs::DecodeError,
6611 }
6612 #[repr(C)]
6613 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6614 /// containing a crate::ln::msgs::FundingCreated on success and a crate::ln::msgs::DecodeError on failure.
6615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6616 pub struct CResult_FundingCreatedDecodeErrorZ {
6617         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6618         /// `err` or `result` depending on the state of `result_ok`.
6619         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6620         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6621         pub result_ok: bool,
6622 }
6623 #[no_mangle]
6624 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6625 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6626         CResult_FundingCreatedDecodeErrorZ {
6627                 contents: CResult_FundingCreatedDecodeErrorZPtr {
6628                         result: Box::into_raw(Box::new(o)),
6629                 },
6630                 result_ok: true,
6631         }
6632 }
6633 #[no_mangle]
6634 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6635 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6636         CResult_FundingCreatedDecodeErrorZ {
6637                 contents: CResult_FundingCreatedDecodeErrorZPtr {
6638                         err: Box::into_raw(Box::new(e)),
6639                 },
6640                 result_ok: false,
6641         }
6642 }
6643 #[no_mangle]
6644 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
6645 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6646 impl Drop for CResult_FundingCreatedDecodeErrorZ {
6647         fn drop(&mut self) {
6648                 if self.result_ok {
6649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6651                         }
6652                 } else {
6653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6655                         }
6656                 }
6657         }
6658 }
6659 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6660         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>) -> Self {
6661                 let contents = if o.result_ok {
6662                         let result = unsafe { o.contents.result };
6663                         unsafe { o.contents.result = std::ptr::null_mut() };
6664                         CResult_FundingCreatedDecodeErrorZPtr { result }
6665                 } else {
6666                         let err = unsafe { o.contents.err };
6667                         unsafe { o.contents.err = std::ptr::null_mut(); }
6668                         CResult_FundingCreatedDecodeErrorZPtr { err }
6669                 };
6670                 Self {
6671                         contents,
6672                         result_ok: o.result_ok,
6673                 }
6674         }
6675 }
6676 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6677         fn clone(&self) -> Self {
6678                 if self.result_ok {
6679                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6680                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6681                         } }
6682                 } else {
6683                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
6684                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6685                         } }
6686                 }
6687         }
6688 }
6689 #[no_mangle]
6690 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
6691 /// but with all dynamically-allocated buffers duplicated in new buffers.
6692 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6693 #[repr(C)]
6694 /// The contents of CResult_FundingSignedDecodeErrorZ
6695 pub union CResult_FundingSignedDecodeErrorZPtr {
6696         /// A pointer to the contents in the success state.
6697         /// Reading from this pointer when `result_ok` is not set is undefined.
6698         pub result: *mut crate::ln::msgs::FundingSigned,
6699         /// A pointer to the contents in the error state.
6700         /// Reading from this pointer when `result_ok` is set is undefined.
6701         pub err: *mut crate::ln::msgs::DecodeError,
6702 }
6703 #[repr(C)]
6704 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6705 /// containing a crate::ln::msgs::FundingSigned on success and a crate::ln::msgs::DecodeError on failure.
6706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6707 pub struct CResult_FundingSignedDecodeErrorZ {
6708         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6709         /// `err` or `result` depending on the state of `result_ok`.
6710         pub contents: CResult_FundingSignedDecodeErrorZPtr,
6711         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6712         pub result_ok: bool,
6713 }
6714 #[no_mangle]
6715 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6716 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6717         CResult_FundingSignedDecodeErrorZ {
6718                 contents: CResult_FundingSignedDecodeErrorZPtr {
6719                         result: Box::into_raw(Box::new(o)),
6720                 },
6721                 result_ok: true,
6722         }
6723 }
6724 #[no_mangle]
6725 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6726 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6727         CResult_FundingSignedDecodeErrorZ {
6728                 contents: CResult_FundingSignedDecodeErrorZPtr {
6729                         err: Box::into_raw(Box::new(e)),
6730                 },
6731                 result_ok: false,
6732         }
6733 }
6734 #[no_mangle]
6735 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
6736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6737 impl Drop for CResult_FundingSignedDecodeErrorZ {
6738         fn drop(&mut self) {
6739                 if self.result_ok {
6740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6742                         }
6743                 } else {
6744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6746                         }
6747                 }
6748         }
6749 }
6750 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6751         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>) -> Self {
6752                 let contents = if o.result_ok {
6753                         let result = unsafe { o.contents.result };
6754                         unsafe { o.contents.result = std::ptr::null_mut() };
6755                         CResult_FundingSignedDecodeErrorZPtr { result }
6756                 } else {
6757                         let err = unsafe { o.contents.err };
6758                         unsafe { o.contents.err = std::ptr::null_mut(); }
6759                         CResult_FundingSignedDecodeErrorZPtr { err }
6760                 };
6761                 Self {
6762                         contents,
6763                         result_ok: o.result_ok,
6764                 }
6765         }
6766 }
6767 impl Clone for CResult_FundingSignedDecodeErrorZ {
6768         fn clone(&self) -> Self {
6769                 if self.result_ok {
6770                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6771                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6772                         } }
6773                 } else {
6774                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
6775                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6776                         } }
6777                 }
6778         }
6779 }
6780 #[no_mangle]
6781 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
6782 /// but with all dynamically-allocated buffers duplicated in new buffers.
6783 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6784 #[repr(C)]
6785 /// The contents of CResult_FundingLockedDecodeErrorZ
6786 pub union CResult_FundingLockedDecodeErrorZPtr {
6787         /// A pointer to the contents in the success state.
6788         /// Reading from this pointer when `result_ok` is not set is undefined.
6789         pub result: *mut crate::ln::msgs::FundingLocked,
6790         /// A pointer to the contents in the error state.
6791         /// Reading from this pointer when `result_ok` is set is undefined.
6792         pub err: *mut crate::ln::msgs::DecodeError,
6793 }
6794 #[repr(C)]
6795 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6796 /// containing a crate::ln::msgs::FundingLocked on success and a crate::ln::msgs::DecodeError on failure.
6797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6798 pub struct CResult_FundingLockedDecodeErrorZ {
6799         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6800         /// `err` or `result` depending on the state of `result_ok`.
6801         pub contents: CResult_FundingLockedDecodeErrorZPtr,
6802         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6803         pub result_ok: bool,
6804 }
6805 #[no_mangle]
6806 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6807 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6808         CResult_FundingLockedDecodeErrorZ {
6809                 contents: CResult_FundingLockedDecodeErrorZPtr {
6810                         result: Box::into_raw(Box::new(o)),
6811                 },
6812                 result_ok: true,
6813         }
6814 }
6815 #[no_mangle]
6816 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6817 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6818         CResult_FundingLockedDecodeErrorZ {
6819                 contents: CResult_FundingLockedDecodeErrorZPtr {
6820                         err: Box::into_raw(Box::new(e)),
6821                 },
6822                 result_ok: false,
6823         }
6824 }
6825 #[no_mangle]
6826 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
6827 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6828 impl Drop for CResult_FundingLockedDecodeErrorZ {
6829         fn drop(&mut self) {
6830                 if self.result_ok {
6831                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6832                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6833                         }
6834                 } else {
6835                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6836                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6837                         }
6838                 }
6839         }
6840 }
6841 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6842         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>) -> Self {
6843                 let contents = if o.result_ok {
6844                         let result = unsafe { o.contents.result };
6845                         unsafe { o.contents.result = std::ptr::null_mut() };
6846                         CResult_FundingLockedDecodeErrorZPtr { result }
6847                 } else {
6848                         let err = unsafe { o.contents.err };
6849                         unsafe { o.contents.err = std::ptr::null_mut(); }
6850                         CResult_FundingLockedDecodeErrorZPtr { err }
6851                 };
6852                 Self {
6853                         contents,
6854                         result_ok: o.result_ok,
6855                 }
6856         }
6857 }
6858 impl Clone for CResult_FundingLockedDecodeErrorZ {
6859         fn clone(&self) -> Self {
6860                 if self.result_ok {
6861                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6862                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6863                         } }
6864                 } else {
6865                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
6866                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6867                         } }
6868                 }
6869         }
6870 }
6871 #[no_mangle]
6872 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
6873 /// but with all dynamically-allocated buffers duplicated in new buffers.
6874 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6875 #[repr(C)]
6876 /// The contents of CResult_InitDecodeErrorZ
6877 pub union CResult_InitDecodeErrorZPtr {
6878         /// A pointer to the contents in the success state.
6879         /// Reading from this pointer when `result_ok` is not set is undefined.
6880         pub result: *mut crate::ln::msgs::Init,
6881         /// A pointer to the contents in the error state.
6882         /// Reading from this pointer when `result_ok` is set is undefined.
6883         pub err: *mut crate::ln::msgs::DecodeError,
6884 }
6885 #[repr(C)]
6886 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6887 /// containing a crate::ln::msgs::Init on success and a crate::ln::msgs::DecodeError on failure.
6888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6889 pub struct CResult_InitDecodeErrorZ {
6890         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6891         /// `err` or `result` depending on the state of `result_ok`.
6892         pub contents: CResult_InitDecodeErrorZPtr,
6893         /// Whether this CResult_InitDecodeErrorZ represents a success state.
6894         pub result_ok: bool,
6895 }
6896 #[no_mangle]
6897 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6898 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6899         CResult_InitDecodeErrorZ {
6900                 contents: CResult_InitDecodeErrorZPtr {
6901                         result: Box::into_raw(Box::new(o)),
6902                 },
6903                 result_ok: true,
6904         }
6905 }
6906 #[no_mangle]
6907 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6908 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6909         CResult_InitDecodeErrorZ {
6910                 contents: CResult_InitDecodeErrorZPtr {
6911                         err: Box::into_raw(Box::new(e)),
6912                 },
6913                 result_ok: false,
6914         }
6915 }
6916 #[no_mangle]
6917 /// Frees any resources used by the CResult_InitDecodeErrorZ.
6918 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6919 impl Drop for CResult_InitDecodeErrorZ {
6920         fn drop(&mut self) {
6921                 if self.result_ok {
6922                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6923                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6924                         }
6925                 } else {
6926                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6927                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6928                         }
6929                 }
6930         }
6931 }
6932 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6933         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
6934                 let contents = if o.result_ok {
6935                         let result = unsafe { o.contents.result };
6936                         unsafe { o.contents.result = std::ptr::null_mut() };
6937                         CResult_InitDecodeErrorZPtr { result }
6938                 } else {
6939                         let err = unsafe { o.contents.err };
6940                         unsafe { o.contents.err = std::ptr::null_mut(); }
6941                         CResult_InitDecodeErrorZPtr { err }
6942                 };
6943                 Self {
6944                         contents,
6945                         result_ok: o.result_ok,
6946                 }
6947         }
6948 }
6949 impl Clone for CResult_InitDecodeErrorZ {
6950         fn clone(&self) -> Self {
6951                 if self.result_ok {
6952                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
6953                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
6954                         } }
6955                 } else {
6956                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
6957                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6958                         } }
6959                 }
6960         }
6961 }
6962 #[no_mangle]
6963 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
6964 /// but with all dynamically-allocated buffers duplicated in new buffers.
6965 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
6966 #[repr(C)]
6967 /// The contents of CResult_OpenChannelDecodeErrorZ
6968 pub union CResult_OpenChannelDecodeErrorZPtr {
6969         /// A pointer to the contents in the success state.
6970         /// Reading from this pointer when `result_ok` is not set is undefined.
6971         pub result: *mut crate::ln::msgs::OpenChannel,
6972         /// A pointer to the contents in the error state.
6973         /// Reading from this pointer when `result_ok` is set is undefined.
6974         pub err: *mut crate::ln::msgs::DecodeError,
6975 }
6976 #[repr(C)]
6977 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6978 /// containing a crate::ln::msgs::OpenChannel on success and a crate::ln::msgs::DecodeError on failure.
6979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6980 pub struct CResult_OpenChannelDecodeErrorZ {
6981         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6982         /// `err` or `result` depending on the state of `result_ok`.
6983         pub contents: CResult_OpenChannelDecodeErrorZPtr,
6984         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6985         pub result_ok: bool,
6986 }
6987 #[no_mangle]
6988 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
6989 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
6990         CResult_OpenChannelDecodeErrorZ {
6991                 contents: CResult_OpenChannelDecodeErrorZPtr {
6992                         result: Box::into_raw(Box::new(o)),
6993                 },
6994                 result_ok: true,
6995         }
6996 }
6997 #[no_mangle]
6998 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
6999 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
7000         CResult_OpenChannelDecodeErrorZ {
7001                 contents: CResult_OpenChannelDecodeErrorZPtr {
7002                         err: Box::into_raw(Box::new(e)),
7003                 },
7004                 result_ok: false,
7005         }
7006 }
7007 #[no_mangle]
7008 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
7009 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
7010 impl Drop for CResult_OpenChannelDecodeErrorZ {
7011         fn drop(&mut self) {
7012                 if self.result_ok {
7013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7015                         }
7016                 } else {
7017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7019                         }
7020                 }
7021         }
7022 }
7023 impl From<crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
7024         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>) -> Self {
7025                 let contents = if o.result_ok {
7026                         let result = unsafe { o.contents.result };
7027                         unsafe { o.contents.result = std::ptr::null_mut() };
7028                         CResult_OpenChannelDecodeErrorZPtr { result }
7029                 } else {
7030                         let err = unsafe { o.contents.err };
7031                         unsafe { o.contents.err = std::ptr::null_mut(); }
7032                         CResult_OpenChannelDecodeErrorZPtr { err }
7033                 };
7034                 Self {
7035                         contents,
7036                         result_ok: o.result_ok,
7037                 }
7038         }
7039 }
7040 impl Clone for CResult_OpenChannelDecodeErrorZ {
7041         fn clone(&self) -> Self {
7042                 if self.result_ok {
7043                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
7044                                 result: Box::into_raw(Box::new(<crate::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
7045                         } }
7046                 } else {
7047                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
7048                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7049                         } }
7050                 }
7051         }
7052 }
7053 #[no_mangle]
7054 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
7055 /// but with all dynamically-allocated buffers duplicated in new buffers.
7056 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
7057 #[repr(C)]
7058 /// The contents of CResult_RevokeAndACKDecodeErrorZ
7059 pub union CResult_RevokeAndACKDecodeErrorZPtr {
7060         /// A pointer to the contents in the success state.
7061         /// Reading from this pointer when `result_ok` is not set is undefined.
7062         pub result: *mut crate::ln::msgs::RevokeAndACK,
7063         /// A pointer to the contents in the error state.
7064         /// Reading from this pointer when `result_ok` is set is undefined.
7065         pub err: *mut crate::ln::msgs::DecodeError,
7066 }
7067 #[repr(C)]
7068 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
7069 /// containing a crate::ln::msgs::RevokeAndACK on success and a crate::ln::msgs::DecodeError on failure.
7070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7071 pub struct CResult_RevokeAndACKDecodeErrorZ {
7072         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
7073         /// `err` or `result` depending on the state of `result_ok`.
7074         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
7075         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
7076         pub result_ok: bool,
7077 }
7078 #[no_mangle]
7079 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
7080 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
7081         CResult_RevokeAndACKDecodeErrorZ {
7082                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7083                         result: Box::into_raw(Box::new(o)),
7084                 },
7085                 result_ok: true,
7086         }
7087 }
7088 #[no_mangle]
7089 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
7090 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
7091         CResult_RevokeAndACKDecodeErrorZ {
7092                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7093                         err: Box::into_raw(Box::new(e)),
7094                 },
7095                 result_ok: false,
7096         }
7097 }
7098 #[no_mangle]
7099 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
7100 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
7101 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
7102         fn drop(&mut self) {
7103                 if self.result_ok {
7104                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7105                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7106                         }
7107                 } else {
7108                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7109                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7110                         }
7111                 }
7112         }
7113 }
7114 impl From<crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
7115         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>) -> Self {
7116                 let contents = if o.result_ok {
7117                         let result = unsafe { o.contents.result };
7118                         unsafe { o.contents.result = std::ptr::null_mut() };
7119                         CResult_RevokeAndACKDecodeErrorZPtr { result }
7120                 } else {
7121                         let err = unsafe { o.contents.err };
7122                         unsafe { o.contents.err = std::ptr::null_mut(); }
7123                         CResult_RevokeAndACKDecodeErrorZPtr { err }
7124                 };
7125                 Self {
7126                         contents,
7127                         result_ok: o.result_ok,
7128                 }
7129         }
7130 }
7131 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
7132         fn clone(&self) -> Self {
7133                 if self.result_ok {
7134                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7135                                 result: Box::into_raw(Box::new(<crate::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
7136                         } }
7137                 } else {
7138                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7139                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7140                         } }
7141                 }
7142         }
7143 }
7144 #[no_mangle]
7145 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
7146 /// but with all dynamically-allocated buffers duplicated in new buffers.
7147 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
7148 #[repr(C)]
7149 /// The contents of CResult_ShutdownDecodeErrorZ
7150 pub union CResult_ShutdownDecodeErrorZPtr {
7151         /// A pointer to the contents in the success state.
7152         /// Reading from this pointer when `result_ok` is not set is undefined.
7153         pub result: *mut crate::ln::msgs::Shutdown,
7154         /// A pointer to the contents in the error state.
7155         /// Reading from this pointer when `result_ok` is set is undefined.
7156         pub err: *mut crate::ln::msgs::DecodeError,
7157 }
7158 #[repr(C)]
7159 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7160 /// containing a crate::ln::msgs::Shutdown on success and a crate::ln::msgs::DecodeError on failure.
7161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7162 pub struct CResult_ShutdownDecodeErrorZ {
7163         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7164         /// `err` or `result` depending on the state of `result_ok`.
7165         pub contents: CResult_ShutdownDecodeErrorZPtr,
7166         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7167         pub result_ok: bool,
7168 }
7169 #[no_mangle]
7170 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
7171 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
7172         CResult_ShutdownDecodeErrorZ {
7173                 contents: CResult_ShutdownDecodeErrorZPtr {
7174                         result: Box::into_raw(Box::new(o)),
7175                 },
7176                 result_ok: true,
7177         }
7178 }
7179 #[no_mangle]
7180 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
7181 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
7182         CResult_ShutdownDecodeErrorZ {
7183                 contents: CResult_ShutdownDecodeErrorZPtr {
7184                         err: Box::into_raw(Box::new(e)),
7185                 },
7186                 result_ok: false,
7187         }
7188 }
7189 #[no_mangle]
7190 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
7191 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
7192 impl Drop for CResult_ShutdownDecodeErrorZ {
7193         fn drop(&mut self) {
7194                 if self.result_ok {
7195                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7196                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7197                         }
7198                 } else {
7199                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7200                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7201                         }
7202                 }
7203         }
7204 }
7205 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
7206         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>) -> Self {
7207                 let contents = if o.result_ok {
7208                         let result = unsafe { o.contents.result };
7209                         unsafe { o.contents.result = std::ptr::null_mut() };
7210                         CResult_ShutdownDecodeErrorZPtr { result }
7211                 } else {
7212                         let err = unsafe { o.contents.err };
7213                         unsafe { o.contents.err = std::ptr::null_mut(); }
7214                         CResult_ShutdownDecodeErrorZPtr { err }
7215                 };
7216                 Self {
7217                         contents,
7218                         result_ok: o.result_ok,
7219                 }
7220         }
7221 }
7222 impl Clone for CResult_ShutdownDecodeErrorZ {
7223         fn clone(&self) -> Self {
7224                 if self.result_ok {
7225                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
7226                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
7227                         } }
7228                 } else {
7229                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
7230                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7231                         } }
7232                 }
7233         }
7234 }
7235 #[no_mangle]
7236 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
7237 /// but with all dynamically-allocated buffers duplicated in new buffers.
7238 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
7239 #[repr(C)]
7240 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
7241 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
7242         /// A pointer to the contents in the success state.
7243         /// Reading from this pointer when `result_ok` is not set is undefined.
7244         pub result: *mut crate::ln::msgs::UpdateFailHTLC,
7245         /// A pointer to the contents in the error state.
7246         /// Reading from this pointer when `result_ok` is set is undefined.
7247         pub err: *mut crate::ln::msgs::DecodeError,
7248 }
7249 #[repr(C)]
7250 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7251 /// containing a crate::ln::msgs::UpdateFailHTLC on success and a crate::ln::msgs::DecodeError on failure.
7252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7253 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
7254         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7255         /// `err` or `result` depending on the state of `result_ok`.
7256         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
7257         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7258         pub result_ok: bool,
7259 }
7260 #[no_mangle]
7261 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
7262 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
7263         CResult_UpdateFailHTLCDecodeErrorZ {
7264                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7265                         result: Box::into_raw(Box::new(o)),
7266                 },
7267                 result_ok: true,
7268         }
7269 }
7270 #[no_mangle]
7271 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
7272 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
7273         CResult_UpdateFailHTLCDecodeErrorZ {
7274                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7275                         err: Box::into_raw(Box::new(e)),
7276                 },
7277                 result_ok: false,
7278         }
7279 }
7280 #[no_mangle]
7281 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
7282 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
7283 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
7284         fn drop(&mut self) {
7285                 if self.result_ok {
7286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7288                         }
7289                 } else {
7290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7292                         }
7293                 }
7294         }
7295 }
7296 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7297         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>) -> Self {
7298                 let contents = if o.result_ok {
7299                         let result = unsafe { o.contents.result };
7300                         unsafe { o.contents.result = std::ptr::null_mut() };
7301                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
7302                 } else {
7303                         let err = unsafe { o.contents.err };
7304                         unsafe { o.contents.err = std::ptr::null_mut(); }
7305                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7306                 };
7307                 Self {
7308                         contents,
7309                         result_ok: o.result_ok,
7310                 }
7311         }
7312 }
7313 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7314         fn clone(&self) -> Self {
7315                 if self.result_ok {
7316                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7317                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7318                         } }
7319                 } else {
7320                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7321                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7322                         } }
7323                 }
7324         }
7325 }
7326 #[no_mangle]
7327 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7328 /// but with all dynamically-allocated buffers duplicated in new buffers.
7329 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7330 #[repr(C)]
7331 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7332 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7333         /// A pointer to the contents in the success state.
7334         /// Reading from this pointer when `result_ok` is not set is undefined.
7335         pub result: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
7336         /// A pointer to the contents in the error state.
7337         /// Reading from this pointer when `result_ok` is set is undefined.
7338         pub err: *mut crate::ln::msgs::DecodeError,
7339 }
7340 #[repr(C)]
7341 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7342 /// containing a crate::ln::msgs::UpdateFailMalformedHTLC on success and a crate::ln::msgs::DecodeError on failure.
7343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7344 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7345         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7346         /// `err` or `result` depending on the state of `result_ok`.
7347         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7348         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7349         pub result_ok: bool,
7350 }
7351 #[no_mangle]
7352 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7353 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7354         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7355                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7356                         result: Box::into_raw(Box::new(o)),
7357                 },
7358                 result_ok: true,
7359         }
7360 }
7361 #[no_mangle]
7362 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7363 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7364         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7365                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7366                         err: Box::into_raw(Box::new(e)),
7367                 },
7368                 result_ok: false,
7369         }
7370 }
7371 #[no_mangle]
7372 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
7373 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7374 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7375         fn drop(&mut self) {
7376                 if self.result_ok {
7377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7379                         }
7380                 } else {
7381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7383                         }
7384                 }
7385         }
7386 }
7387 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7388         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>) -> Self {
7389                 let contents = if o.result_ok {
7390                         let result = unsafe { o.contents.result };
7391                         unsafe { o.contents.result = std::ptr::null_mut() };
7392                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7393                 } else {
7394                         let err = unsafe { o.contents.err };
7395                         unsafe { o.contents.err = std::ptr::null_mut(); }
7396                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7397                 };
7398                 Self {
7399                         contents,
7400                         result_ok: o.result_ok,
7401                 }
7402         }
7403 }
7404 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7405         fn clone(&self) -> Self {
7406                 if self.result_ok {
7407                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7408                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7409                         } }
7410                 } else {
7411                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7412                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7413                         } }
7414                 }
7415         }
7416 }
7417 #[no_mangle]
7418 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7419 /// but with all dynamically-allocated buffers duplicated in new buffers.
7420 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7421 #[repr(C)]
7422 /// The contents of CResult_UpdateFeeDecodeErrorZ
7423 pub union CResult_UpdateFeeDecodeErrorZPtr {
7424         /// A pointer to the contents in the success state.
7425         /// Reading from this pointer when `result_ok` is not set is undefined.
7426         pub result: *mut crate::ln::msgs::UpdateFee,
7427         /// A pointer to the contents in the error state.
7428         /// Reading from this pointer when `result_ok` is set is undefined.
7429         pub err: *mut crate::ln::msgs::DecodeError,
7430 }
7431 #[repr(C)]
7432 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7433 /// containing a crate::ln::msgs::UpdateFee on success and a crate::ln::msgs::DecodeError on failure.
7434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7435 pub struct CResult_UpdateFeeDecodeErrorZ {
7436         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7437         /// `err` or `result` depending on the state of `result_ok`.
7438         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7439         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7440         pub result_ok: bool,
7441 }
7442 #[no_mangle]
7443 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7444 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7445         CResult_UpdateFeeDecodeErrorZ {
7446                 contents: CResult_UpdateFeeDecodeErrorZPtr {
7447                         result: Box::into_raw(Box::new(o)),
7448                 },
7449                 result_ok: true,
7450         }
7451 }
7452 #[no_mangle]
7453 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7454 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7455         CResult_UpdateFeeDecodeErrorZ {
7456                 contents: CResult_UpdateFeeDecodeErrorZPtr {
7457                         err: Box::into_raw(Box::new(e)),
7458                 },
7459                 result_ok: false,
7460         }
7461 }
7462 #[no_mangle]
7463 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
7464 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7465 impl Drop for CResult_UpdateFeeDecodeErrorZ {
7466         fn drop(&mut self) {
7467                 if self.result_ok {
7468                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7469                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7470                         }
7471                 } else {
7472                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7473                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7474                         }
7475                 }
7476         }
7477 }
7478 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7479         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>) -> Self {
7480                 let contents = if o.result_ok {
7481                         let result = unsafe { o.contents.result };
7482                         unsafe { o.contents.result = std::ptr::null_mut() };
7483                         CResult_UpdateFeeDecodeErrorZPtr { result }
7484                 } else {
7485                         let err = unsafe { o.contents.err };
7486                         unsafe { o.contents.err = std::ptr::null_mut(); }
7487                         CResult_UpdateFeeDecodeErrorZPtr { err }
7488                 };
7489                 Self {
7490                         contents,
7491                         result_ok: o.result_ok,
7492                 }
7493         }
7494 }
7495 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7496         fn clone(&self) -> Self {
7497                 if self.result_ok {
7498                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7499                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7500                         } }
7501                 } else {
7502                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
7503                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7504                         } }
7505                 }
7506         }
7507 }
7508 #[no_mangle]
7509 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
7510 /// but with all dynamically-allocated buffers duplicated in new buffers.
7511 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7512 #[repr(C)]
7513 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7514 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7515         /// A pointer to the contents in the success state.
7516         /// Reading from this pointer when `result_ok` is not set is undefined.
7517         pub result: *mut crate::ln::msgs::UpdateFulfillHTLC,
7518         /// A pointer to the contents in the error state.
7519         /// Reading from this pointer when `result_ok` is set is undefined.
7520         pub err: *mut crate::ln::msgs::DecodeError,
7521 }
7522 #[repr(C)]
7523 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7524 /// containing a crate::ln::msgs::UpdateFulfillHTLC on success and a crate::ln::msgs::DecodeError on failure.
7525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7526 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
7527         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7528         /// `err` or `result` depending on the state of `result_ok`.
7529         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7530         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7531         pub result_ok: bool,
7532 }
7533 #[no_mangle]
7534 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7535 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7536         CResult_UpdateFulfillHTLCDecodeErrorZ {
7537                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7538                         result: Box::into_raw(Box::new(o)),
7539                 },
7540                 result_ok: true,
7541         }
7542 }
7543 #[no_mangle]
7544 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7545 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7546         CResult_UpdateFulfillHTLCDecodeErrorZ {
7547                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7548                         err: Box::into_raw(Box::new(e)),
7549                 },
7550                 result_ok: false,
7551         }
7552 }
7553 #[no_mangle]
7554 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
7555 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7556 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
7557         fn drop(&mut self) {
7558                 if self.result_ok {
7559                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7560                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7561                         }
7562                 } else {
7563                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7564                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7565                         }
7566                 }
7567         }
7568 }
7569 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7570         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>) -> Self {
7571                 let contents = if o.result_ok {
7572                         let result = unsafe { o.contents.result };
7573                         unsafe { o.contents.result = std::ptr::null_mut() };
7574                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
7575                 } else {
7576                         let err = unsafe { o.contents.err };
7577                         unsafe { o.contents.err = std::ptr::null_mut(); }
7578                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7579                 };
7580                 Self {
7581                         contents,
7582                         result_ok: o.result_ok,
7583                 }
7584         }
7585 }
7586 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7587         fn clone(&self) -> Self {
7588                 if self.result_ok {
7589                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7590                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7591                         } }
7592                 } else {
7593                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7594                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7595                         } }
7596                 }
7597         }
7598 }
7599 #[no_mangle]
7600 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7601 /// but with all dynamically-allocated buffers duplicated in new buffers.
7602 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7603 #[repr(C)]
7604 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7605 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
7606         /// A pointer to the contents in the success state.
7607         /// Reading from this pointer when `result_ok` is not set is undefined.
7608         pub result: *mut crate::ln::msgs::UpdateAddHTLC,
7609         /// A pointer to the contents in the error state.
7610         /// Reading from this pointer when `result_ok` is set is undefined.
7611         pub err: *mut crate::ln::msgs::DecodeError,
7612 }
7613 #[repr(C)]
7614 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7615 /// containing a crate::ln::msgs::UpdateAddHTLC on success and a crate::ln::msgs::DecodeError on failure.
7616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7617 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
7618         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7619         /// `err` or `result` depending on the state of `result_ok`.
7620         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7621         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7622         pub result_ok: bool,
7623 }
7624 #[no_mangle]
7625 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7626 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7627         CResult_UpdateAddHTLCDecodeErrorZ {
7628                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7629                         result: Box::into_raw(Box::new(o)),
7630                 },
7631                 result_ok: true,
7632         }
7633 }
7634 #[no_mangle]
7635 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7636 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7637         CResult_UpdateAddHTLCDecodeErrorZ {
7638                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7639                         err: Box::into_raw(Box::new(e)),
7640                 },
7641                 result_ok: false,
7642         }
7643 }
7644 #[no_mangle]
7645 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
7646 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7647 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
7648         fn drop(&mut self) {
7649                 if self.result_ok {
7650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7652                         }
7653                 } else {
7654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7656                         }
7657                 }
7658         }
7659 }
7660 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7661         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>) -> Self {
7662                 let contents = if o.result_ok {
7663                         let result = unsafe { o.contents.result };
7664                         unsafe { o.contents.result = std::ptr::null_mut() };
7665                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
7666                 } else {
7667                         let err = unsafe { o.contents.err };
7668                         unsafe { o.contents.err = std::ptr::null_mut(); }
7669                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7670                 };
7671                 Self {
7672                         contents,
7673                         result_ok: o.result_ok,
7674                 }
7675         }
7676 }
7677 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7678         fn clone(&self) -> Self {
7679                 if self.result_ok {
7680                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7681                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7682                         } }
7683                 } else {
7684                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7685                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7686                         } }
7687                 }
7688         }
7689 }
7690 #[no_mangle]
7691 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7692 /// but with all dynamically-allocated buffers duplicated in new buffers.
7693 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7694 #[repr(C)]
7695 /// The contents of CResult_PingDecodeErrorZ
7696 pub union CResult_PingDecodeErrorZPtr {
7697         /// A pointer to the contents in the success state.
7698         /// Reading from this pointer when `result_ok` is not set is undefined.
7699         pub result: *mut crate::ln::msgs::Ping,
7700         /// A pointer to the contents in the error state.
7701         /// Reading from this pointer when `result_ok` is set is undefined.
7702         pub err: *mut crate::ln::msgs::DecodeError,
7703 }
7704 #[repr(C)]
7705 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7706 /// containing a crate::ln::msgs::Ping on success and a crate::ln::msgs::DecodeError on failure.
7707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7708 pub struct CResult_PingDecodeErrorZ {
7709         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7710         /// `err` or `result` depending on the state of `result_ok`.
7711         pub contents: CResult_PingDecodeErrorZPtr,
7712         /// Whether this CResult_PingDecodeErrorZ represents a success state.
7713         pub result_ok: bool,
7714 }
7715 #[no_mangle]
7716 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7717 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7718         CResult_PingDecodeErrorZ {
7719                 contents: CResult_PingDecodeErrorZPtr {
7720                         result: Box::into_raw(Box::new(o)),
7721                 },
7722                 result_ok: true,
7723         }
7724 }
7725 #[no_mangle]
7726 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7727 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7728         CResult_PingDecodeErrorZ {
7729                 contents: CResult_PingDecodeErrorZPtr {
7730                         err: Box::into_raw(Box::new(e)),
7731                 },
7732                 result_ok: false,
7733         }
7734 }
7735 #[no_mangle]
7736 /// Frees any resources used by the CResult_PingDecodeErrorZ.
7737 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7738 impl Drop for CResult_PingDecodeErrorZ {
7739         fn drop(&mut self) {
7740                 if self.result_ok {
7741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7743                         }
7744                 } else {
7745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7747                         }
7748                 }
7749         }
7750 }
7751 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7752         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
7753                 let contents = if o.result_ok {
7754                         let result = unsafe { o.contents.result };
7755                         unsafe { o.contents.result = std::ptr::null_mut() };
7756                         CResult_PingDecodeErrorZPtr { result }
7757                 } else {
7758                         let err = unsafe { o.contents.err };
7759                         unsafe { o.contents.err = std::ptr::null_mut(); }
7760                         CResult_PingDecodeErrorZPtr { err }
7761                 };
7762                 Self {
7763                         contents,
7764                         result_ok: o.result_ok,
7765                 }
7766         }
7767 }
7768 impl Clone for CResult_PingDecodeErrorZ {
7769         fn clone(&self) -> Self {
7770                 if self.result_ok {
7771                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7772                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7773                         } }
7774                 } else {
7775                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
7776                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7777                         } }
7778                 }
7779         }
7780 }
7781 #[no_mangle]
7782 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
7783 /// but with all dynamically-allocated buffers duplicated in new buffers.
7784 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7785 #[repr(C)]
7786 /// The contents of CResult_PongDecodeErrorZ
7787 pub union CResult_PongDecodeErrorZPtr {
7788         /// A pointer to the contents in the success state.
7789         /// Reading from this pointer when `result_ok` is not set is undefined.
7790         pub result: *mut crate::ln::msgs::Pong,
7791         /// A pointer to the contents in the error state.
7792         /// Reading from this pointer when `result_ok` is set is undefined.
7793         pub err: *mut crate::ln::msgs::DecodeError,
7794 }
7795 #[repr(C)]
7796 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7797 /// containing a crate::ln::msgs::Pong on success and a crate::ln::msgs::DecodeError on failure.
7798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7799 pub struct CResult_PongDecodeErrorZ {
7800         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7801         /// `err` or `result` depending on the state of `result_ok`.
7802         pub contents: CResult_PongDecodeErrorZPtr,
7803         /// Whether this CResult_PongDecodeErrorZ represents a success state.
7804         pub result_ok: bool,
7805 }
7806 #[no_mangle]
7807 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7808 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7809         CResult_PongDecodeErrorZ {
7810                 contents: CResult_PongDecodeErrorZPtr {
7811                         result: Box::into_raw(Box::new(o)),
7812                 },
7813                 result_ok: true,
7814         }
7815 }
7816 #[no_mangle]
7817 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7818 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7819         CResult_PongDecodeErrorZ {
7820                 contents: CResult_PongDecodeErrorZPtr {
7821                         err: Box::into_raw(Box::new(e)),
7822                 },
7823                 result_ok: false,
7824         }
7825 }
7826 #[no_mangle]
7827 /// Frees any resources used by the CResult_PongDecodeErrorZ.
7828 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7829 impl Drop for CResult_PongDecodeErrorZ {
7830         fn drop(&mut self) {
7831                 if self.result_ok {
7832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7834                         }
7835                 } else {
7836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7838                         }
7839                 }
7840         }
7841 }
7842 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7843         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
7844                 let contents = if o.result_ok {
7845                         let result = unsafe { o.contents.result };
7846                         unsafe { o.contents.result = std::ptr::null_mut() };
7847                         CResult_PongDecodeErrorZPtr { result }
7848                 } else {
7849                         let err = unsafe { o.contents.err };
7850                         unsafe { o.contents.err = std::ptr::null_mut(); }
7851                         CResult_PongDecodeErrorZPtr { err }
7852                 };
7853                 Self {
7854                         contents,
7855                         result_ok: o.result_ok,
7856                 }
7857         }
7858 }
7859 impl Clone for CResult_PongDecodeErrorZ {
7860         fn clone(&self) -> Self {
7861                 if self.result_ok {
7862                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7863                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7864                         } }
7865                 } else {
7866                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
7867                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7868                         } }
7869                 }
7870         }
7871 }
7872 #[no_mangle]
7873 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
7874 /// but with all dynamically-allocated buffers duplicated in new buffers.
7875 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7876 #[repr(C)]
7877 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7878 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7879         /// A pointer to the contents in the success state.
7880         /// Reading from this pointer when `result_ok` is not set is undefined.
7881         pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
7882         /// A pointer to the contents in the error state.
7883         /// Reading from this pointer when `result_ok` is set is undefined.
7884         pub err: *mut crate::ln::msgs::DecodeError,
7885 }
7886 #[repr(C)]
7887 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7888 /// containing a crate::ln::msgs::UnsignedChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
7889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7890 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7891         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7892         /// `err` or `result` depending on the state of `result_ok`.
7893         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7894         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7895         pub result_ok: bool,
7896 }
7897 #[no_mangle]
7898 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7899 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7900         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7901                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7902                         result: Box::into_raw(Box::new(o)),
7903                 },
7904                 result_ok: true,
7905         }
7906 }
7907 #[no_mangle]
7908 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7909 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7910         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7911                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7912                         err: Box::into_raw(Box::new(e)),
7913                 },
7914                 result_ok: false,
7915         }
7916 }
7917 #[no_mangle]
7918 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
7919 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7920 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7921         fn drop(&mut self) {
7922                 if self.result_ok {
7923                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7924                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7925                         }
7926                 } else {
7927                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7928                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7929                         }
7930                 }
7931         }
7932 }
7933 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7934         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
7935                 let contents = if o.result_ok {
7936                         let result = unsafe { o.contents.result };
7937                         unsafe { o.contents.result = std::ptr::null_mut() };
7938                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
7939                 } else {
7940                         let err = unsafe { o.contents.err };
7941                         unsafe { o.contents.err = std::ptr::null_mut(); }
7942                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
7943                 };
7944                 Self {
7945                         contents,
7946                         result_ok: o.result_ok,
7947                 }
7948         }
7949 }
7950 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7951         fn clone(&self) -> Self {
7952                 if self.result_ok {
7953                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7954                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7955                         } }
7956                 } else {
7957                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7958                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7959                         } }
7960                 }
7961         }
7962 }
7963 #[no_mangle]
7964 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7965 /// but with all dynamically-allocated buffers duplicated in new buffers.
7966 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
7967 #[repr(C)]
7968 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
7969 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
7970         /// A pointer to the contents in the success state.
7971         /// Reading from this pointer when `result_ok` is not set is undefined.
7972         pub result: *mut crate::ln::msgs::ChannelAnnouncement,
7973         /// A pointer to the contents in the error state.
7974         /// Reading from this pointer when `result_ok` is set is undefined.
7975         pub err: *mut crate::ln::msgs::DecodeError,
7976 }
7977 #[repr(C)]
7978 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7979 /// containing a crate::ln::msgs::ChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
7980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7981 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
7982         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7983         /// `err` or `result` depending on the state of `result_ok`.
7984         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
7985         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7986         pub result_ok: bool,
7987 }
7988 #[no_mangle]
7989 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
7990 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
7991         CResult_ChannelAnnouncementDecodeErrorZ {
7992                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7993                         result: Box::into_raw(Box::new(o)),
7994                 },
7995                 result_ok: true,
7996         }
7997 }
7998 #[no_mangle]
7999 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
8000 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
8001         CResult_ChannelAnnouncementDecodeErrorZ {
8002                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8003                         err: Box::into_raw(Box::new(e)),
8004                 },
8005                 result_ok: false,
8006         }
8007 }
8008 #[no_mangle]
8009 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
8010 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
8011 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
8012         fn drop(&mut self) {
8013                 if self.result_ok {
8014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8016                         }
8017                 } else {
8018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8020                         }
8021                 }
8022         }
8023 }
8024 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
8025         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8026                 let contents = if o.result_ok {
8027                         let result = unsafe { o.contents.result };
8028                         unsafe { o.contents.result = std::ptr::null_mut() };
8029                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
8030                 } else {
8031                         let err = unsafe { o.contents.err };
8032                         unsafe { o.contents.err = std::ptr::null_mut(); }
8033                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
8034                 };
8035                 Self {
8036                         contents,
8037                         result_ok: o.result_ok,
8038                 }
8039         }
8040 }
8041 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
8042         fn clone(&self) -> Self {
8043                 if self.result_ok {
8044                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8045                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
8046                         } }
8047                 } else {
8048                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8049                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8050                         } }
8051                 }
8052         }
8053 }
8054 #[no_mangle]
8055 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8056 /// but with all dynamically-allocated buffers duplicated in new buffers.
8057 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
8058 #[repr(C)]
8059 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8060 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8061         /// A pointer to the contents in the success state.
8062         /// Reading from this pointer when `result_ok` is not set is undefined.
8063         pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
8064         /// A pointer to the contents in the error state.
8065         /// Reading from this pointer when `result_ok` is set is undefined.
8066         pub err: *mut crate::ln::msgs::DecodeError,
8067 }
8068 #[repr(C)]
8069 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8070 /// containing a crate::ln::msgs::UnsignedChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
8071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8072 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
8073         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8074         /// `err` or `result` depending on the state of `result_ok`.
8075         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
8076         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8077         pub result_ok: bool,
8078 }
8079 #[no_mangle]
8080 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
8081 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8082         CResult_UnsignedChannelUpdateDecodeErrorZ {
8083                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8084                         result: Box::into_raw(Box::new(o)),
8085                 },
8086                 result_ok: true,
8087         }
8088 }
8089 #[no_mangle]
8090 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
8091 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8092         CResult_UnsignedChannelUpdateDecodeErrorZ {
8093                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8094                         err: Box::into_raw(Box::new(e)),
8095                 },
8096                 result_ok: false,
8097         }
8098 }
8099 #[no_mangle]
8100 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
8101 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
8102 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
8103         fn drop(&mut self) {
8104                 if self.result_ok {
8105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8107                         }
8108                 } else {
8109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8111                         }
8112                 }
8113         }
8114 }
8115 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
8116         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
8117                 let contents = if o.result_ok {
8118                         let result = unsafe { o.contents.result };
8119                         unsafe { o.contents.result = std::ptr::null_mut() };
8120                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
8121                 } else {
8122                         let err = unsafe { o.contents.err };
8123                         unsafe { o.contents.err = std::ptr::null_mut(); }
8124                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
8125                 };
8126                 Self {
8127                         contents,
8128                         result_ok: o.result_ok,
8129                 }
8130         }
8131 }
8132 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
8133         fn clone(&self) -> Self {
8134                 if self.result_ok {
8135                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8136                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
8137                         } }
8138                 } else {
8139                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8140                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8141                         } }
8142                 }
8143         }
8144 }
8145 #[no_mangle]
8146 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
8147 /// but with all dynamically-allocated buffers duplicated in new buffers.
8148 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
8149 #[repr(C)]
8150 /// The contents of CResult_ChannelUpdateDecodeErrorZ
8151 pub union CResult_ChannelUpdateDecodeErrorZPtr {
8152         /// A pointer to the contents in the success state.
8153         /// Reading from this pointer when `result_ok` is not set is undefined.
8154         pub result: *mut crate::ln::msgs::ChannelUpdate,
8155         /// A pointer to the contents in the error state.
8156         /// Reading from this pointer when `result_ok` is set is undefined.
8157         pub err: *mut crate::ln::msgs::DecodeError,
8158 }
8159 #[repr(C)]
8160 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8161 /// containing a crate::ln::msgs::ChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
8162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8163 pub struct CResult_ChannelUpdateDecodeErrorZ {
8164         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8165         /// `err` or `result` depending on the state of `result_ok`.
8166         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
8167         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8168         pub result_ok: bool,
8169 }
8170 #[no_mangle]
8171 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
8172 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
8173         CResult_ChannelUpdateDecodeErrorZ {
8174                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8175                         result: Box::into_raw(Box::new(o)),
8176                 },
8177                 result_ok: true,
8178         }
8179 }
8180 #[no_mangle]
8181 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
8182 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
8183         CResult_ChannelUpdateDecodeErrorZ {
8184                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8185                         err: Box::into_raw(Box::new(e)),
8186                 },
8187                 result_ok: false,
8188         }
8189 }
8190 #[no_mangle]
8191 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
8192 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
8193 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
8194         fn drop(&mut self) {
8195                 if self.result_ok {
8196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8198                         }
8199                 } else {
8200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8202                         }
8203                 }
8204         }
8205 }
8206 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
8207         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
8208                 let contents = if o.result_ok {
8209                         let result = unsafe { o.contents.result };
8210                         unsafe { o.contents.result = std::ptr::null_mut() };
8211                         CResult_ChannelUpdateDecodeErrorZPtr { result }
8212                 } else {
8213                         let err = unsafe { o.contents.err };
8214                         unsafe { o.contents.err = std::ptr::null_mut(); }
8215                         CResult_ChannelUpdateDecodeErrorZPtr { err }
8216                 };
8217                 Self {
8218                         contents,
8219                         result_ok: o.result_ok,
8220                 }
8221         }
8222 }
8223 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
8224         fn clone(&self) -> Self {
8225                 if self.result_ok {
8226                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8227                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
8228                         } }
8229                 } else {
8230                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8231                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8232                         } }
8233                 }
8234         }
8235 }
8236 #[no_mangle]
8237 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
8238 /// but with all dynamically-allocated buffers duplicated in new buffers.
8239 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
8240 #[repr(C)]
8241 /// The contents of CResult_ErrorMessageDecodeErrorZ
8242 pub union CResult_ErrorMessageDecodeErrorZPtr {
8243         /// A pointer to the contents in the success state.
8244         /// Reading from this pointer when `result_ok` is not set is undefined.
8245         pub result: *mut crate::ln::msgs::ErrorMessage,
8246         /// A pointer to the contents in the error state.
8247         /// Reading from this pointer when `result_ok` is set is undefined.
8248         pub err: *mut crate::ln::msgs::DecodeError,
8249 }
8250 #[repr(C)]
8251 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8252 /// containing a crate::ln::msgs::ErrorMessage on success and a crate::ln::msgs::DecodeError on failure.
8253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8254 pub struct CResult_ErrorMessageDecodeErrorZ {
8255         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8256         /// `err` or `result` depending on the state of `result_ok`.
8257         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
8258         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8259         pub result_ok: bool,
8260 }
8261 #[no_mangle]
8262 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
8263 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
8264         CResult_ErrorMessageDecodeErrorZ {
8265                 contents: CResult_ErrorMessageDecodeErrorZPtr {
8266                         result: Box::into_raw(Box::new(o)),
8267                 },
8268                 result_ok: true,
8269         }
8270 }
8271 #[no_mangle]
8272 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
8273 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
8274         CResult_ErrorMessageDecodeErrorZ {
8275                 contents: CResult_ErrorMessageDecodeErrorZPtr {
8276                         err: Box::into_raw(Box::new(e)),
8277                 },
8278                 result_ok: false,
8279         }
8280 }
8281 #[no_mangle]
8282 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
8283 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
8284 impl Drop for CResult_ErrorMessageDecodeErrorZ {
8285         fn drop(&mut self) {
8286                 if self.result_ok {
8287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8289                         }
8290                 } else {
8291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8293                         }
8294                 }
8295         }
8296 }
8297 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8298         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
8299                 let contents = if o.result_ok {
8300                         let result = unsafe { o.contents.result };
8301                         unsafe { o.contents.result = std::ptr::null_mut() };
8302                         CResult_ErrorMessageDecodeErrorZPtr { result }
8303                 } else {
8304                         let err = unsafe { o.contents.err };
8305                         unsafe { o.contents.err = std::ptr::null_mut(); }
8306                         CResult_ErrorMessageDecodeErrorZPtr { err }
8307                 };
8308                 Self {
8309                         contents,
8310                         result_ok: o.result_ok,
8311                 }
8312         }
8313 }
8314 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8315         fn clone(&self) -> Self {
8316                 if self.result_ok {
8317                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8318                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8319                         } }
8320                 } else {
8321                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
8322                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8323                         } }
8324                 }
8325         }
8326 }
8327 #[no_mangle]
8328 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
8329 /// but with all dynamically-allocated buffers duplicated in new buffers.
8330 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8331 #[repr(C)]
8332 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8333 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8334         /// A pointer to the contents in the success state.
8335         /// Reading from this pointer when `result_ok` is not set is undefined.
8336         pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
8337         /// A pointer to the contents in the error state.
8338         /// Reading from this pointer when `result_ok` is set is undefined.
8339         pub err: *mut crate::ln::msgs::DecodeError,
8340 }
8341 #[repr(C)]
8342 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8343 /// containing a crate::ln::msgs::UnsignedNodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
8344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8345 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8346         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8347         /// `err` or `result` depending on the state of `result_ok`.
8348         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8349         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8350         pub result_ok: bool,
8351 }
8352 #[no_mangle]
8353 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8354 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8355         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8356                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8357                         result: Box::into_raw(Box::new(o)),
8358                 },
8359                 result_ok: true,
8360         }
8361 }
8362 #[no_mangle]
8363 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8364 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8365         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8366                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8367                         err: Box::into_raw(Box::new(e)),
8368                 },
8369                 result_ok: false,
8370         }
8371 }
8372 #[no_mangle]
8373 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
8374 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8375 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8376         fn drop(&mut self) {
8377                 if self.result_ok {
8378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8380                         }
8381                 } else {
8382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8384                         }
8385                 }
8386         }
8387 }
8388 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8389         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8390                 let contents = if o.result_ok {
8391                         let result = unsafe { o.contents.result };
8392                         unsafe { o.contents.result = std::ptr::null_mut() };
8393                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8394                 } else {
8395                         let err = unsafe { o.contents.err };
8396                         unsafe { o.contents.err = std::ptr::null_mut(); }
8397                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8398                 };
8399                 Self {
8400                         contents,
8401                         result_ok: o.result_ok,
8402                 }
8403         }
8404 }
8405 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8406         fn clone(&self) -> Self {
8407                 if self.result_ok {
8408                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8409                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8410                         } }
8411                 } else {
8412                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8413                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8414                         } }
8415                 }
8416         }
8417 }
8418 #[no_mangle]
8419 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8420 /// but with all dynamically-allocated buffers duplicated in new buffers.
8421 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8422 #[repr(C)]
8423 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8424 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
8425         /// A pointer to the contents in the success state.
8426         /// Reading from this pointer when `result_ok` is not set is undefined.
8427         pub result: *mut crate::ln::msgs::NodeAnnouncement,
8428         /// A pointer to the contents in the error state.
8429         /// Reading from this pointer when `result_ok` is set is undefined.
8430         pub err: *mut crate::ln::msgs::DecodeError,
8431 }
8432 #[repr(C)]
8433 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8434 /// containing a crate::ln::msgs::NodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
8435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8436 pub struct CResult_NodeAnnouncementDecodeErrorZ {
8437         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8438         /// `err` or `result` depending on the state of `result_ok`.
8439         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8440         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8441         pub result_ok: bool,
8442 }
8443 #[no_mangle]
8444 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8445 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8446         CResult_NodeAnnouncementDecodeErrorZ {
8447                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8448                         result: Box::into_raw(Box::new(o)),
8449                 },
8450                 result_ok: true,
8451         }
8452 }
8453 #[no_mangle]
8454 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8455 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8456         CResult_NodeAnnouncementDecodeErrorZ {
8457                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8458                         err: Box::into_raw(Box::new(e)),
8459                 },
8460                 result_ok: false,
8461         }
8462 }
8463 #[no_mangle]
8464 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
8465 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8466 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
8467         fn drop(&mut self) {
8468                 if self.result_ok {
8469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8471                         }
8472                 } else {
8473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8475                         }
8476                 }
8477         }
8478 }
8479 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8480         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8481                 let contents = if o.result_ok {
8482                         let result = unsafe { o.contents.result };
8483                         unsafe { o.contents.result = std::ptr::null_mut() };
8484                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
8485                 } else {
8486                         let err = unsafe { o.contents.err };
8487                         unsafe { o.contents.err = std::ptr::null_mut(); }
8488                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
8489                 };
8490                 Self {
8491                         contents,
8492                         result_ok: o.result_ok,
8493                 }
8494         }
8495 }
8496 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8497         fn clone(&self) -> Self {
8498                 if self.result_ok {
8499                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8500                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8501                         } }
8502                 } else {
8503                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8504                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8505                         } }
8506                 }
8507         }
8508 }
8509 #[no_mangle]
8510 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8511 /// but with all dynamically-allocated buffers duplicated in new buffers.
8512 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8513 #[repr(C)]
8514 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8515 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
8516         /// A pointer to the contents in the success state.
8517         /// Reading from this pointer when `result_ok` is not set is undefined.
8518         pub result: *mut crate::ln::msgs::QueryShortChannelIds,
8519         /// A pointer to the contents in the error state.
8520         /// Reading from this pointer when `result_ok` is set is undefined.
8521         pub err: *mut crate::ln::msgs::DecodeError,
8522 }
8523 #[repr(C)]
8524 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8525 /// containing a crate::ln::msgs::QueryShortChannelIds on success and a crate::ln::msgs::DecodeError on failure.
8526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8527 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
8528         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8529         /// `err` or `result` depending on the state of `result_ok`.
8530         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8531         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8532         pub result_ok: bool,
8533 }
8534 #[no_mangle]
8535 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8536 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8537         CResult_QueryShortChannelIdsDecodeErrorZ {
8538                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8539                         result: Box::into_raw(Box::new(o)),
8540                 },
8541                 result_ok: true,
8542         }
8543 }
8544 #[no_mangle]
8545 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8546 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8547         CResult_QueryShortChannelIdsDecodeErrorZ {
8548                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8549                         err: Box::into_raw(Box::new(e)),
8550                 },
8551                 result_ok: false,
8552         }
8553 }
8554 #[no_mangle]
8555 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
8556 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8557 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
8558         fn drop(&mut self) {
8559                 if self.result_ok {
8560                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8561                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8562                         }
8563                 } else {
8564                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8565                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8566                         }
8567                 }
8568         }
8569 }
8570 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8571         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
8572                 let contents = if o.result_ok {
8573                         let result = unsafe { o.contents.result };
8574                         unsafe { o.contents.result = std::ptr::null_mut() };
8575                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
8576                 } else {
8577                         let err = unsafe { o.contents.err };
8578                         unsafe { o.contents.err = std::ptr::null_mut(); }
8579                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8580                 };
8581                 Self {
8582                         contents,
8583                         result_ok: o.result_ok,
8584                 }
8585         }
8586 }
8587 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8588         fn clone(&self) -> Self {
8589                 if self.result_ok {
8590                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8591                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8592                         } }
8593                 } else {
8594                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8595                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8596                         } }
8597                 }
8598         }
8599 }
8600 #[no_mangle]
8601 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8602 /// but with all dynamically-allocated buffers duplicated in new buffers.
8603 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8604 #[repr(C)]
8605 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8606 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8607         /// A pointer to the contents in the success state.
8608         /// Reading from this pointer when `result_ok` is not set is undefined.
8609         pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
8610         /// A pointer to the contents in the error state.
8611         /// Reading from this pointer when `result_ok` is set is undefined.
8612         pub err: *mut crate::ln::msgs::DecodeError,
8613 }
8614 #[repr(C)]
8615 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8616 /// containing a crate::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::ln::msgs::DecodeError on failure.
8617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8618 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8619         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8620         /// `err` or `result` depending on the state of `result_ok`.
8621         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8622         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8623         pub result_ok: bool,
8624 }
8625 #[no_mangle]
8626 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8627 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8628         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8629                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8630                         result: Box::into_raw(Box::new(o)),
8631                 },
8632                 result_ok: true,
8633         }
8634 }
8635 #[no_mangle]
8636 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8637 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8638         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8639                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8640                         err: Box::into_raw(Box::new(e)),
8641                 },
8642                 result_ok: false,
8643         }
8644 }
8645 #[no_mangle]
8646 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
8647 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8648 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8649         fn drop(&mut self) {
8650                 if self.result_ok {
8651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8653                         }
8654                 } else {
8655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8657                         }
8658                 }
8659         }
8660 }
8661 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8662         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
8663                 let contents = if o.result_ok {
8664                         let result = unsafe { o.contents.result };
8665                         unsafe { o.contents.result = std::ptr::null_mut() };
8666                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8667                 } else {
8668                         let err = unsafe { o.contents.err };
8669                         unsafe { o.contents.err = std::ptr::null_mut(); }
8670                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8671                 };
8672                 Self {
8673                         contents,
8674                         result_ok: o.result_ok,
8675                 }
8676         }
8677 }
8678 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8679         fn clone(&self) -> Self {
8680                 if self.result_ok {
8681                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8682                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8683                         } }
8684                 } else {
8685                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8686                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8687                         } }
8688                 }
8689         }
8690 }
8691 #[no_mangle]
8692 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8693 /// but with all dynamically-allocated buffers duplicated in new buffers.
8694 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8695 #[repr(C)]
8696 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8697 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
8698         /// A pointer to the contents in the success state.
8699         /// Reading from this pointer when `result_ok` is not set is undefined.
8700         pub result: *mut crate::ln::msgs::QueryChannelRange,
8701         /// A pointer to the contents in the error state.
8702         /// Reading from this pointer when `result_ok` is set is undefined.
8703         pub err: *mut crate::ln::msgs::DecodeError,
8704 }
8705 #[repr(C)]
8706 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8707 /// containing a crate::ln::msgs::QueryChannelRange on success and a crate::ln::msgs::DecodeError on failure.
8708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8709 pub struct CResult_QueryChannelRangeDecodeErrorZ {
8710         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8711         /// `err` or `result` depending on the state of `result_ok`.
8712         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8713         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8714         pub result_ok: bool,
8715 }
8716 #[no_mangle]
8717 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8718 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8719         CResult_QueryChannelRangeDecodeErrorZ {
8720                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8721                         result: Box::into_raw(Box::new(o)),
8722                 },
8723                 result_ok: true,
8724         }
8725 }
8726 #[no_mangle]
8727 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8728 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8729         CResult_QueryChannelRangeDecodeErrorZ {
8730                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8731                         err: Box::into_raw(Box::new(e)),
8732                 },
8733                 result_ok: false,
8734         }
8735 }
8736 #[no_mangle]
8737 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
8738 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8739 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
8740         fn drop(&mut self) {
8741                 if self.result_ok {
8742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8744                         }
8745                 } else {
8746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8748                         }
8749                 }
8750         }
8751 }
8752 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8753         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
8754                 let contents = if o.result_ok {
8755                         let result = unsafe { o.contents.result };
8756                         unsafe { o.contents.result = std::ptr::null_mut() };
8757                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
8758                 } else {
8759                         let err = unsafe { o.contents.err };
8760                         unsafe { o.contents.err = std::ptr::null_mut(); }
8761                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
8762                 };
8763                 Self {
8764                         contents,
8765                         result_ok: o.result_ok,
8766                 }
8767         }
8768 }
8769 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8770         fn clone(&self) -> Self {
8771                 if self.result_ok {
8772                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8773                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8774                         } }
8775                 } else {
8776                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8777                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8778                         } }
8779                 }
8780         }
8781 }
8782 #[no_mangle]
8783 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8784 /// but with all dynamically-allocated buffers duplicated in new buffers.
8785 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8786 #[repr(C)]
8787 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8788 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
8789         /// A pointer to the contents in the success state.
8790         /// Reading from this pointer when `result_ok` is not set is undefined.
8791         pub result: *mut crate::ln::msgs::ReplyChannelRange,
8792         /// A pointer to the contents in the error state.
8793         /// Reading from this pointer when `result_ok` is set is undefined.
8794         pub err: *mut crate::ln::msgs::DecodeError,
8795 }
8796 #[repr(C)]
8797 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8798 /// containing a crate::ln::msgs::ReplyChannelRange on success and a crate::ln::msgs::DecodeError on failure.
8799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8800 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
8801         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8802         /// `err` or `result` depending on the state of `result_ok`.
8803         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8804         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8805         pub result_ok: bool,
8806 }
8807 #[no_mangle]
8808 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8809 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8810         CResult_ReplyChannelRangeDecodeErrorZ {
8811                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8812                         result: Box::into_raw(Box::new(o)),
8813                 },
8814                 result_ok: true,
8815         }
8816 }
8817 #[no_mangle]
8818 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8819 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8820         CResult_ReplyChannelRangeDecodeErrorZ {
8821                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8822                         err: Box::into_raw(Box::new(e)),
8823                 },
8824                 result_ok: false,
8825         }
8826 }
8827 #[no_mangle]
8828 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
8829 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8830 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
8831         fn drop(&mut self) {
8832                 if self.result_ok {
8833                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8834                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8835                         }
8836                 } else {
8837                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8838                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8839                         }
8840                 }
8841         }
8842 }
8843 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8844         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
8845                 let contents = if o.result_ok {
8846                         let result = unsafe { o.contents.result };
8847                         unsafe { o.contents.result = std::ptr::null_mut() };
8848                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
8849                 } else {
8850                         let err = unsafe { o.contents.err };
8851                         unsafe { o.contents.err = std::ptr::null_mut(); }
8852                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8853                 };
8854                 Self {
8855                         contents,
8856                         result_ok: o.result_ok,
8857                 }
8858         }
8859 }
8860 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8861         fn clone(&self) -> Self {
8862                 if self.result_ok {
8863                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8864                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8865                         } }
8866                 } else {
8867                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8868                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8869                         } }
8870                 }
8871         }
8872 }
8873 #[no_mangle]
8874 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8875 /// but with all dynamically-allocated buffers duplicated in new buffers.
8876 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8877 #[repr(C)]
8878 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8879 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
8880         /// A pointer to the contents in the success state.
8881         /// Reading from this pointer when `result_ok` is not set is undefined.
8882         pub result: *mut crate::ln::msgs::GossipTimestampFilter,
8883         /// A pointer to the contents in the error state.
8884         /// Reading from this pointer when `result_ok` is set is undefined.
8885         pub err: *mut crate::ln::msgs::DecodeError,
8886 }
8887 #[repr(C)]
8888 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8889 /// containing a crate::ln::msgs::GossipTimestampFilter on success and a crate::ln::msgs::DecodeError on failure.
8890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8891 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
8892         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8893         /// `err` or `result` depending on the state of `result_ok`.
8894         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8895         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8896         pub result_ok: bool,
8897 }
8898 #[no_mangle]
8899 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8900 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8901         CResult_GossipTimestampFilterDecodeErrorZ {
8902                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8903                         result: Box::into_raw(Box::new(o)),
8904                 },
8905                 result_ok: true,
8906         }
8907 }
8908 #[no_mangle]
8909 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8910 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8911         CResult_GossipTimestampFilterDecodeErrorZ {
8912                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8913                         err: Box::into_raw(Box::new(e)),
8914                 },
8915                 result_ok: false,
8916         }
8917 }
8918 #[no_mangle]
8919 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
8920 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8921 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
8922         fn drop(&mut self) {
8923                 if self.result_ok {
8924                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8925                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8926                         }
8927                 } else {
8928                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8929                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8930                         }
8931                 }
8932         }
8933 }
8934 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
8935         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
8936                 let contents = if o.result_ok {
8937                         let result = unsafe { o.contents.result };
8938                         unsafe { o.contents.result = std::ptr::null_mut() };
8939                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
8940                 } else {
8941                         let err = unsafe { o.contents.err };
8942                         unsafe { o.contents.err = std::ptr::null_mut(); }
8943                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
8944                 };
8945                 Self {
8946                         contents,
8947                         result_ok: o.result_ok,
8948                 }
8949         }
8950 }
8951 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
8952         fn clone(&self) -> Self {
8953                 if self.result_ok {
8954                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8955                                 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
8956                         } }
8957                 } else {
8958                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8959                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8960                         } }
8961                 }
8962         }
8963 }
8964 #[no_mangle]
8965 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
8966 /// but with all dynamically-allocated buffers duplicated in new buffers.
8967 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }