Update auto-generated bindings
[rust-lightning] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 pub struct CVec_SpendableOutputDescriptorZ {
3         pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
4         pub datalen: usize
5 }
6 impl CVec_SpendableOutputDescriptorZ {
7         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
8                 if self.datalen == 0 { return Vec::new(); }
9                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10                 self.data = std::ptr::null_mut();
11                 self.datalen = 0;
12                 ret
13         }
14         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
15                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
16         }
17 }
18 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
19         fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
20                 let datalen = v.len();
21                 let data = Box::into_raw(v.into_boxed_slice());
22                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23         }
24 }
25 #[no_mangle]
26 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
27 impl Drop for CVec_SpendableOutputDescriptorZ {
28         fn drop(&mut self) {
29                 if self.datalen == 0 { return; }
30                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
31         }
32 }
33 impl Clone for CVec_SpendableOutputDescriptorZ {
34         fn clone(&self) -> Self {
35                 let mut res = Vec::new();
36                 if self.datalen == 0 { return Self::from(res); }
37                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
38                 Self::from(res)
39         }
40 }
41 #[repr(C)]
42 pub struct CVec_MessageSendEventZ {
43         pub data: *mut crate::util::events::MessageSendEvent,
44         pub datalen: usize
45 }
46 impl CVec_MessageSendEventZ {
47         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
48                 if self.datalen == 0 { return Vec::new(); }
49                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
50                 self.data = std::ptr::null_mut();
51                 self.datalen = 0;
52                 ret
53         }
54         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::MessageSendEvent] {
55                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
56         }
57 }
58 impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
59         fn from(v: Vec<crate::util::events::MessageSendEvent>) -> Self {
60                 let datalen = v.len();
61                 let data = Box::into_raw(v.into_boxed_slice());
62                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
63         }
64 }
65 #[no_mangle]
66 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
67 impl Drop for CVec_MessageSendEventZ {
68         fn drop(&mut self) {
69                 if self.datalen == 0 { return; }
70                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
71         }
72 }
73 impl Clone for CVec_MessageSendEventZ {
74         fn clone(&self) -> Self {
75                 let mut res = Vec::new();
76                 if self.datalen == 0 { return Self::from(res); }
77                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
78                 Self::from(res)
79         }
80 }
81 #[repr(C)]
82 pub struct CVec_EventZ {
83         pub data: *mut crate::util::events::Event,
84         pub datalen: usize
85 }
86 impl CVec_EventZ {
87         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
88                 if self.datalen == 0 { return Vec::new(); }
89                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
90                 self.data = std::ptr::null_mut();
91                 self.datalen = 0;
92                 ret
93         }
94         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
95                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
96         }
97 }
98 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
99         fn from(v: Vec<crate::util::events::Event>) -> Self {
100                 let datalen = v.len();
101                 let data = Box::into_raw(v.into_boxed_slice());
102                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
103         }
104 }
105 #[no_mangle]
106 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
107 impl Drop for CVec_EventZ {
108         fn drop(&mut self) {
109                 if self.datalen == 0 { return; }
110                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
111         }
112 }
113 impl Clone for CVec_EventZ {
114         fn clone(&self) -> Self {
115                 let mut res = Vec::new();
116                 if self.datalen == 0 { return Self::from(res); }
117                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
118                 Self::from(res)
119         }
120 }
121 #[repr(C)]
122 pub struct C2Tuple_usizeTransactionZ {
123         pub a: usize,
124         pub b: crate::c_types::Transaction,
125 }
126 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
127         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
128                 Self {
129                         a: tup.0,
130                         b: tup.1,
131                 }
132         }
133 }
134 impl C2Tuple_usizeTransactionZ {
135         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
136                 (self.a, self.b)
137         }
138 }
139 #[no_mangle]
140 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
141         C2Tuple_usizeTransactionZ { a, b, }
142 }
143
144 #[no_mangle]
145 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
146 #[repr(C)]
147 pub struct CVec_C2Tuple_usizeTransactionZZ {
148         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
149         pub datalen: usize
150 }
151 impl CVec_C2Tuple_usizeTransactionZZ {
152         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
153                 if self.datalen == 0 { return Vec::new(); }
154                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
155                 self.data = std::ptr::null_mut();
156                 self.datalen = 0;
157                 ret
158         }
159         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
160                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
161         }
162 }
163 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
164         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
165                 let datalen = v.len();
166                 let data = Box::into_raw(v.into_boxed_slice());
167                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
168         }
169 }
170 #[no_mangle]
171 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
172 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
173         fn drop(&mut self) {
174                 if self.datalen == 0 { return; }
175                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
176         }
177 }
178 #[repr(C)]
179 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
180         /// Note that this value is always NULL, as there are no contents in the OK variant
181         pub result: *mut std::ffi::c_void,
182         pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
183 }
184 #[repr(C)]
185 pub struct CResult_NoneChannelMonitorUpdateErrZ {
186         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
187         pub result_ok: bool,
188 }
189 #[no_mangle]
190 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
191         CResult_NoneChannelMonitorUpdateErrZ {
192                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
193                         result: std::ptr::null_mut(),
194                 },
195                 result_ok: true,
196         }
197 }
198 #[no_mangle]
199 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
200         CResult_NoneChannelMonitorUpdateErrZ {
201                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
202                         err: Box::into_raw(Box::new(e)),
203                 },
204                 result_ok: false,
205         }
206 }
207 #[no_mangle]
208 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
209 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
210         fn drop(&mut self) {
211                 if self.result_ok {
212                 } else {
213                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
214                                 let _ = unsafe { Box::from_raw(self.contents.err) };
215                         }
216                 }
217         }
218 }
219 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
220         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
221                 let contents = if o.result_ok {
222                         let _ = unsafe { Box::from_raw(o.contents.result) };
223                         o.contents.result = std::ptr::null_mut();
224                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
225                 } else {
226                         let err = unsafe { o.contents.err };
227                         unsafe { o.contents.err = std::ptr::null_mut(); }
228                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
229                 };
230                 Self {
231                         contents,
232                         result_ok: o.result_ok,
233                 }
234         }
235 }
236 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
237         fn clone(&self) -> Self {
238                 if self.result_ok {
239                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
240                                 result: std::ptr::null_mut()
241                         } }
242                 } else {
243                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
244                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
245                         } }
246                 }
247         }
248 }
249 #[no_mangle]
250 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
251 #[repr(C)]
252 pub struct CVec_MonitorEventZ {
253         pub data: *mut crate::chain::channelmonitor::MonitorEvent,
254         pub datalen: usize
255 }
256 impl CVec_MonitorEventZ {
257         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
258                 if self.datalen == 0 { return Vec::new(); }
259                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
260                 self.data = std::ptr::null_mut();
261                 self.datalen = 0;
262                 ret
263         }
264         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
265                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
266         }
267 }
268 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
269         fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
270                 let datalen = v.len();
271                 let data = Box::into_raw(v.into_boxed_slice());
272                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
273         }
274 }
275 #[no_mangle]
276 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
277 impl Drop for CVec_MonitorEventZ {
278         fn drop(&mut self) {
279                 if self.datalen == 0 { return; }
280                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
281         }
282 }
283 impl Clone for CVec_MonitorEventZ {
284         fn clone(&self) -> Self {
285                 let mut res = Vec::new();
286                 if self.datalen == 0 { return Self::from(res); }
287                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
288                 Self::from(res)
289         }
290 }
291 #[repr(C)]
292 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
293         pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
294         pub err: *mut crate::ln::msgs::DecodeError,
295 }
296 #[repr(C)]
297 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
298         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
299         pub result_ok: bool,
300 }
301 #[no_mangle]
302 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
303         CResult_ChannelMonitorUpdateDecodeErrorZ {
304                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
305                         result: Box::into_raw(Box::new(o)),
306                 },
307                 result_ok: true,
308         }
309 }
310 #[no_mangle]
311 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
312         CResult_ChannelMonitorUpdateDecodeErrorZ {
313                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
314                         err: Box::into_raw(Box::new(e)),
315                 },
316                 result_ok: false,
317         }
318 }
319 #[no_mangle]
320 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
321 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
322         fn drop(&mut self) {
323                 if self.result_ok {
324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
326                         }
327                 } else {
328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
330                         }
331                 }
332         }
333 }
334 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
335         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
336                 let contents = if o.result_ok {
337                         let result = unsafe { o.contents.result };
338                         unsafe { o.contents.result = std::ptr::null_mut() };
339                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
340                 } else {
341                         let err = unsafe { o.contents.err };
342                         unsafe { o.contents.err = std::ptr::null_mut(); }
343                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
344                 };
345                 Self {
346                         contents,
347                         result_ok: o.result_ok,
348                 }
349         }
350 }
351 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
352         fn clone(&self) -> Self {
353                 if self.result_ok {
354                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
355                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
356                         } }
357                 } else {
358                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
359                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
360                         } }
361                 }
362         }
363 }
364 #[no_mangle]
365 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
366 #[repr(C)]
367 pub union CResult_NoneMonitorUpdateErrorZPtr {
368         /// Note that this value is always NULL, as there are no contents in the OK variant
369         pub result: *mut std::ffi::c_void,
370         pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
371 }
372 #[repr(C)]
373 pub struct CResult_NoneMonitorUpdateErrorZ {
374         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
375         pub result_ok: bool,
376 }
377 #[no_mangle]
378 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
379         CResult_NoneMonitorUpdateErrorZ {
380                 contents: CResult_NoneMonitorUpdateErrorZPtr {
381                         result: std::ptr::null_mut(),
382                 },
383                 result_ok: true,
384         }
385 }
386 #[no_mangle]
387 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
388         CResult_NoneMonitorUpdateErrorZ {
389                 contents: CResult_NoneMonitorUpdateErrorZPtr {
390                         err: Box::into_raw(Box::new(e)),
391                 },
392                 result_ok: false,
393         }
394 }
395 #[no_mangle]
396 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
397 impl Drop for CResult_NoneMonitorUpdateErrorZ {
398         fn drop(&mut self) {
399                 if self.result_ok {
400                 } else {
401                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
402                                 let _ = unsafe { Box::from_raw(self.contents.err) };
403                         }
404                 }
405         }
406 }
407 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
408         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
409                 let contents = if o.result_ok {
410                         let _ = unsafe { Box::from_raw(o.contents.result) };
411                         o.contents.result = std::ptr::null_mut();
412                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
413                 } else {
414                         let err = unsafe { o.contents.err };
415                         unsafe { o.contents.err = std::ptr::null_mut(); }
416                         CResult_NoneMonitorUpdateErrorZPtr { err }
417                 };
418                 Self {
419                         contents,
420                         result_ok: o.result_ok,
421                 }
422         }
423 }
424 impl Clone for CResult_NoneMonitorUpdateErrorZ {
425         fn clone(&self) -> Self {
426                 if self.result_ok {
427                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
428                                 result: std::ptr::null_mut()
429                         } }
430                 } else {
431                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
432                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
433                         } }
434                 }
435         }
436 }
437 #[no_mangle]
438 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
439 #[repr(C)]
440 pub struct C2Tuple_OutPointScriptZ {
441         pub a: crate::chain::transaction::OutPoint,
442         pub b: crate::c_types::derived::CVec_u8Z,
443 }
444 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
445         fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
446                 Self {
447                         a: tup.0,
448                         b: tup.1,
449                 }
450         }
451 }
452 impl C2Tuple_OutPointScriptZ {
453         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
454                 (self.a, self.b)
455         }
456 }
457 #[no_mangle]
458 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
459         C2Tuple_OutPointScriptZ { a, b, }
460 }
461
462 #[no_mangle]
463 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
464 #[repr(C)]
465 pub struct CVec_TransactionZ {
466         pub data: *mut crate::c_types::Transaction,
467         pub datalen: usize
468 }
469 impl CVec_TransactionZ {
470         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
471                 if self.datalen == 0 { return Vec::new(); }
472                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
473                 self.data = std::ptr::null_mut();
474                 self.datalen = 0;
475                 ret
476         }
477         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
478                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
479         }
480 }
481 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
482         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
483                 let datalen = v.len();
484                 let data = Box::into_raw(v.into_boxed_slice());
485                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
486         }
487 }
488 #[no_mangle]
489 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
490 impl Drop for CVec_TransactionZ {
491         fn drop(&mut self) {
492                 if self.datalen == 0 { return; }
493                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
494         }
495 }
496 #[repr(C)]
497 pub struct C2Tuple_u32TxOutZ {
498         pub a: u32,
499         pub b: crate::c_types::TxOut,
500 }
501 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
502         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
503                 Self {
504                         a: tup.0,
505                         b: tup.1,
506                 }
507         }
508 }
509 impl C2Tuple_u32TxOutZ {
510         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
511                 (self.a, self.b)
512         }
513 }
514 impl Clone for C2Tuple_u32TxOutZ {
515         fn clone(&self) -> Self {
516                 Self {
517                         a: self.a.clone(),
518                         b: self.b.clone(),
519                 }
520         }
521 }
522 #[no_mangle]
523 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
524 #[no_mangle]
525 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
526         C2Tuple_u32TxOutZ { a, b, }
527 }
528
529 #[no_mangle]
530 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
531 #[repr(C)]
532 pub struct CVec_C2Tuple_u32TxOutZZ {
533         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
534         pub datalen: usize
535 }
536 impl CVec_C2Tuple_u32TxOutZZ {
537         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
538                 if self.datalen == 0 { return Vec::new(); }
539                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
540                 self.data = std::ptr::null_mut();
541                 self.datalen = 0;
542                 ret
543         }
544         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
545                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
546         }
547 }
548 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
549         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
550                 let datalen = v.len();
551                 let data = Box::into_raw(v.into_boxed_slice());
552                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
553         }
554 }
555 #[no_mangle]
556 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
557 impl Drop for CVec_C2Tuple_u32TxOutZZ {
558         fn drop(&mut self) {
559                 if self.datalen == 0 { return; }
560                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
561         }
562 }
563 impl Clone for CVec_C2Tuple_u32TxOutZZ {
564         fn clone(&self) -> Self {
565                 let mut res = Vec::new();
566                 if self.datalen == 0 { return Self::from(res); }
567                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
568                 Self::from(res)
569         }
570 }
571 #[repr(C)]
572 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
573         pub a: crate::c_types::ThirtyTwoBytes,
574         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
575 }
576 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
577         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
578                 Self {
579                         a: tup.0,
580                         b: tup.1,
581                 }
582         }
583 }
584 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
585         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
586                 (self.a, self.b)
587         }
588 }
589 #[no_mangle]
590 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 {
591         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
592 }
593
594 #[no_mangle]
595 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
596 #[repr(C)]
597 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
598         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
599         pub datalen: usize
600 }
601 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
602         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
603                 if self.datalen == 0 { return Vec::new(); }
604                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
605                 self.data = std::ptr::null_mut();
606                 self.datalen = 0;
607                 ret
608         }
609         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
610                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
611         }
612 }
613 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
614         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
615                 let datalen = v.len();
616                 let data = Box::into_raw(v.into_boxed_slice());
617                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
618         }
619 }
620 #[no_mangle]
621 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) { }
622 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
623         fn drop(&mut self) {
624                 if self.datalen == 0 { return; }
625                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
626         }
627 }
628 #[repr(C)]
629 pub struct C2Tuple_BlockHashChannelMonitorZ {
630         pub a: crate::c_types::ThirtyTwoBytes,
631         pub b: crate::chain::channelmonitor::ChannelMonitor,
632 }
633 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
634         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
635                 Self {
636                         a: tup.0,
637                         b: tup.1,
638                 }
639         }
640 }
641 impl C2Tuple_BlockHashChannelMonitorZ {
642         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
643                 (self.a, self.b)
644         }
645 }
646 #[no_mangle]
647 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
648         C2Tuple_BlockHashChannelMonitorZ { a, b, }
649 }
650
651 #[no_mangle]
652 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
653 #[repr(C)]
654 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
655         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
656         pub err: *mut crate::ln::msgs::DecodeError,
657 }
658 #[repr(C)]
659 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
660         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
661         pub result_ok: bool,
662 }
663 #[no_mangle]
664 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
665         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
666                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
667                         result: Box::into_raw(Box::new(o)),
668                 },
669                 result_ok: true,
670         }
671 }
672 #[no_mangle]
673 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
674         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
675                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
676                         err: Box::into_raw(Box::new(e)),
677                 },
678                 result_ok: false,
679         }
680 }
681 #[no_mangle]
682 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
683 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
684         fn drop(&mut self) {
685                 if self.result_ok {
686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
688                         }
689                 } else {
690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
692                         }
693                 }
694         }
695 }
696 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
697         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
698                 let contents = if o.result_ok {
699                         let result = unsafe { o.contents.result };
700                         unsafe { o.contents.result = std::ptr::null_mut() };
701                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
702                 } else {
703                         let err = unsafe { o.contents.err };
704                         unsafe { o.contents.err = std::ptr::null_mut(); }
705                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
706                 };
707                 Self {
708                         contents,
709                         result_ok: o.result_ok,
710                 }
711         }
712 }
713 #[repr(C)]
714 pub struct C2Tuple_u64u64Z {
715         pub a: u64,
716         pub b: u64,
717 }
718 impl From<(u64, u64)> for C2Tuple_u64u64Z {
719         fn from (tup: (u64, u64)) -> Self {
720                 Self {
721                         a: tup.0,
722                         b: tup.1,
723                 }
724         }
725 }
726 impl C2Tuple_u64u64Z {
727         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
728                 (self.a, self.b)
729         }
730 }
731 impl Clone for C2Tuple_u64u64Z {
732         fn clone(&self) -> Self {
733                 Self {
734                         a: self.a.clone(),
735                         b: self.b.clone(),
736                 }
737         }
738 }
739 #[no_mangle]
740 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { orig.clone() }
741 #[no_mangle]
742 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
743         C2Tuple_u64u64Z { a, b, }
744 }
745
746 #[no_mangle]
747 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
748 #[repr(C)]
749 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
750         pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
751         pub err: *mut crate::ln::msgs::DecodeError,
752 }
753 #[repr(C)]
754 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
755         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
756         pub result_ok: bool,
757 }
758 #[no_mangle]
759 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
760         CResult_SpendableOutputDescriptorDecodeErrorZ {
761                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
762                         result: Box::into_raw(Box::new(o)),
763                 },
764                 result_ok: true,
765         }
766 }
767 #[no_mangle]
768 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
769         CResult_SpendableOutputDescriptorDecodeErrorZ {
770                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
771                         err: Box::into_raw(Box::new(e)),
772                 },
773                 result_ok: false,
774         }
775 }
776 #[no_mangle]
777 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
778 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
779         fn drop(&mut self) {
780                 if self.result_ok {
781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
783                         }
784                 } else {
785                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
786                                 let _ = unsafe { Box::from_raw(self.contents.err) };
787                         }
788                 }
789         }
790 }
791 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
792         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
793                 let contents = if o.result_ok {
794                         let result = unsafe { o.contents.result };
795                         unsafe { o.contents.result = std::ptr::null_mut() };
796                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
797                 } else {
798                         let err = unsafe { o.contents.err };
799                         unsafe { o.contents.err = std::ptr::null_mut(); }
800                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
801                 };
802                 Self {
803                         contents,
804                         result_ok: o.result_ok,
805                 }
806         }
807 }
808 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
809         fn clone(&self) -> Self {
810                 if self.result_ok {
811                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
812                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
813                         } }
814                 } else {
815                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
816                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
817                         } }
818                 }
819         }
820 }
821 #[no_mangle]
822 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
823 #[repr(C)]
824 pub struct CVec_SignatureZ {
825         pub data: *mut crate::c_types::Signature,
826         pub datalen: usize
827 }
828 impl CVec_SignatureZ {
829         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
830                 if self.datalen == 0 { return Vec::new(); }
831                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
832                 self.data = std::ptr::null_mut();
833                 self.datalen = 0;
834                 ret
835         }
836         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
837                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
838         }
839 }
840 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
841         fn from(v: Vec<crate::c_types::Signature>) -> Self {
842                 let datalen = v.len();
843                 let data = Box::into_raw(v.into_boxed_slice());
844                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
845         }
846 }
847 #[no_mangle]
848 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
849 impl Drop for CVec_SignatureZ {
850         fn drop(&mut self) {
851                 if self.datalen == 0 { return; }
852                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
853         }
854 }
855 impl Clone for CVec_SignatureZ {
856         fn clone(&self) -> Self {
857                 let mut res = Vec::new();
858                 if self.datalen == 0 { return Self::from(res); }
859                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
860                 Self::from(res)
861         }
862 }
863 #[repr(C)]
864 pub struct C2Tuple_SignatureCVec_SignatureZZ {
865         pub a: crate::c_types::Signature,
866         pub b: crate::c_types::derived::CVec_SignatureZ,
867 }
868 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
869         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
870                 Self {
871                         a: tup.0,
872                         b: tup.1,
873                 }
874         }
875 }
876 impl C2Tuple_SignatureCVec_SignatureZZ {
877         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
878                 (self.a, self.b)
879         }
880 }
881 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
882         fn clone(&self) -> Self {
883                 Self {
884                         a: self.a.clone(),
885                         b: self.b.clone(),
886                 }
887         }
888 }
889 #[no_mangle]
890 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
891 #[no_mangle]
892 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
893         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
894 }
895
896 #[no_mangle]
897 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
898 #[repr(C)]
899 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
900         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
901         /// Note that this value is always NULL, as there are no contents in the Err variant
902         pub err: *mut std::ffi::c_void,
903 }
904 #[repr(C)]
905 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
906         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
907         pub result_ok: bool,
908 }
909 #[no_mangle]
910 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
911         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
912                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
913                         result: Box::into_raw(Box::new(o)),
914                 },
915                 result_ok: true,
916         }
917 }
918 #[no_mangle]
919 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
920         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
921                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
922                         err: std::ptr::null_mut(),
923                 },
924                 result_ok: false,
925         }
926 }
927 #[no_mangle]
928 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
929 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
930         fn drop(&mut self) {
931                 if self.result_ok {
932                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
933                                 let _ = unsafe { Box::from_raw(self.contents.result) };
934                         }
935                 } else {
936                 }
937         }
938 }
939 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
940         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
941                 let contents = if o.result_ok {
942                         let result = unsafe { o.contents.result };
943                         unsafe { o.contents.result = std::ptr::null_mut() };
944                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
945                 } else {
946                         let _ = unsafe { Box::from_raw(o.contents.err) };
947                         o.contents.err = std::ptr::null_mut();
948                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
949                 };
950                 Self {
951                         contents,
952                         result_ok: o.result_ok,
953                 }
954         }
955 }
956 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
957         fn clone(&self) -> Self {
958                 if self.result_ok {
959                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
960                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
961                         } }
962                 } else {
963                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
964                                 err: std::ptr::null_mut()
965                         } }
966                 }
967         }
968 }
969 #[no_mangle]
970 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
971 #[repr(C)]
972 pub union CResult_SignatureNoneZPtr {
973         pub result: *mut crate::c_types::Signature,
974         /// Note that this value is always NULL, as there are no contents in the Err variant
975         pub err: *mut std::ffi::c_void,
976 }
977 #[repr(C)]
978 pub struct CResult_SignatureNoneZ {
979         pub contents: CResult_SignatureNoneZPtr,
980         pub result_ok: bool,
981 }
982 #[no_mangle]
983 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
984         CResult_SignatureNoneZ {
985                 contents: CResult_SignatureNoneZPtr {
986                         result: Box::into_raw(Box::new(o)),
987                 },
988                 result_ok: true,
989         }
990 }
991 #[no_mangle]
992 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
993         CResult_SignatureNoneZ {
994                 contents: CResult_SignatureNoneZPtr {
995                         err: std::ptr::null_mut(),
996                 },
997                 result_ok: false,
998         }
999 }
1000 #[no_mangle]
1001 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
1002 impl Drop for CResult_SignatureNoneZ {
1003         fn drop(&mut self) {
1004                 if self.result_ok {
1005                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1006                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1007                         }
1008                 } else {
1009                 }
1010         }
1011 }
1012 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
1013         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
1014                 let contents = if o.result_ok {
1015                         let result = unsafe { o.contents.result };
1016                         unsafe { o.contents.result = std::ptr::null_mut() };
1017                         CResult_SignatureNoneZPtr { result }
1018                 } else {
1019                         let _ = unsafe { Box::from_raw(o.contents.err) };
1020                         o.contents.err = std::ptr::null_mut();
1021                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
1022                 };
1023                 Self {
1024                         contents,
1025                         result_ok: o.result_ok,
1026                 }
1027         }
1028 }
1029 impl Clone for CResult_SignatureNoneZ {
1030         fn clone(&self) -> Self {
1031                 if self.result_ok {
1032                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
1033                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
1034                         } }
1035                 } else {
1036                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
1037                                 err: std::ptr::null_mut()
1038                         } }
1039                 }
1040         }
1041 }
1042 #[no_mangle]
1043 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
1044 #[repr(C)]
1045 pub union CResult_ChanKeySignerDecodeErrorZPtr {
1046         pub result: *mut crate::chain::keysinterface::ChannelKeys,
1047         pub err: *mut crate::ln::msgs::DecodeError,
1048 }
1049 #[repr(C)]
1050 pub struct CResult_ChanKeySignerDecodeErrorZ {
1051         pub contents: CResult_ChanKeySignerDecodeErrorZPtr,
1052         pub result_ok: bool,
1053 }
1054 #[no_mangle]
1055 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::ChannelKeys) -> CResult_ChanKeySignerDecodeErrorZ {
1056         CResult_ChanKeySignerDecodeErrorZ {
1057                 contents: CResult_ChanKeySignerDecodeErrorZPtr {
1058                         result: Box::into_raw(Box::new(o)),
1059                 },
1060                 result_ok: true,
1061         }
1062 }
1063 #[no_mangle]
1064 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChanKeySignerDecodeErrorZ {
1065         CResult_ChanKeySignerDecodeErrorZ {
1066                 contents: CResult_ChanKeySignerDecodeErrorZPtr {
1067                         err: Box::into_raw(Box::new(e)),
1068                 },
1069                 result_ok: false,
1070         }
1071 }
1072 #[no_mangle]
1073 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_free(_res: CResult_ChanKeySignerDecodeErrorZ) { }
1074 impl Drop for CResult_ChanKeySignerDecodeErrorZ {
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                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1082                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1083                         }
1084                 }
1085         }
1086 }
1087 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>> for CResult_ChanKeySignerDecodeErrorZ {
1088         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
1089                 let contents = if o.result_ok {
1090                         let result = unsafe { o.contents.result };
1091                         unsafe { o.contents.result = std::ptr::null_mut() };
1092                         CResult_ChanKeySignerDecodeErrorZPtr { result }
1093                 } else {
1094                         let err = unsafe { o.contents.err };
1095                         unsafe { o.contents.err = std::ptr::null_mut(); }
1096                         CResult_ChanKeySignerDecodeErrorZPtr { err }
1097                 };
1098                 Self {
1099                         contents,
1100                         result_ok: o.result_ok,
1101                 }
1102         }
1103 }
1104 impl Clone for CResult_ChanKeySignerDecodeErrorZ {
1105         fn clone(&self) -> Self {
1106                 if self.result_ok {
1107                         Self { result_ok: true, contents: CResult_ChanKeySignerDecodeErrorZPtr {
1108                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::ChannelKeys>::clone(unsafe { &*self.contents.result })))
1109                         } }
1110                 } else {
1111                         Self { result_ok: false, contents: CResult_ChanKeySignerDecodeErrorZPtr {
1112                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1113                         } }
1114                 }
1115         }
1116 }
1117 #[no_mangle]
1118 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_clone(orig: &CResult_ChanKeySignerDecodeErrorZ) -> CResult_ChanKeySignerDecodeErrorZ { orig.clone() }
1119 #[repr(C)]
1120 pub union CResult_InMemoryChannelKeysDecodeErrorZPtr {
1121         pub result: *mut crate::chain::keysinterface::InMemoryChannelKeys,
1122         pub err: *mut crate::ln::msgs::DecodeError,
1123 }
1124 #[repr(C)]
1125 pub struct CResult_InMemoryChannelKeysDecodeErrorZ {
1126         pub contents: CResult_InMemoryChannelKeysDecodeErrorZPtr,
1127         pub result_ok: bool,
1128 }
1129 #[no_mangle]
1130 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemoryChannelKeys) -> CResult_InMemoryChannelKeysDecodeErrorZ {
1131         CResult_InMemoryChannelKeysDecodeErrorZ {
1132                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1133                         result: Box::into_raw(Box::new(o)),
1134                 },
1135                 result_ok: true,
1136         }
1137 }
1138 #[no_mangle]
1139 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemoryChannelKeysDecodeErrorZ {
1140         CResult_InMemoryChannelKeysDecodeErrorZ {
1141                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1142                         err: Box::into_raw(Box::new(e)),
1143                 },
1144                 result_ok: false,
1145         }
1146 }
1147 #[no_mangle]
1148 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_free(_res: CResult_InMemoryChannelKeysDecodeErrorZ) { }
1149 impl Drop for CResult_InMemoryChannelKeysDecodeErrorZ {
1150         fn drop(&mut self) {
1151                 if self.result_ok {
1152                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1153                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1154                         }
1155                 } else {
1156                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1157                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1158                         }
1159                 }
1160         }
1161 }
1162 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>> for CResult_InMemoryChannelKeysDecodeErrorZ {
1163         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
1164                 let contents = if o.result_ok {
1165                         let result = unsafe { o.contents.result };
1166                         unsafe { o.contents.result = std::ptr::null_mut() };
1167                         CResult_InMemoryChannelKeysDecodeErrorZPtr { result }
1168                 } else {
1169                         let err = unsafe { o.contents.err };
1170                         unsafe { o.contents.err = std::ptr::null_mut(); }
1171                         CResult_InMemoryChannelKeysDecodeErrorZPtr { err }
1172                 };
1173                 Self {
1174                         contents,
1175                         result_ok: o.result_ok,
1176                 }
1177         }
1178 }
1179 impl Clone for CResult_InMemoryChannelKeysDecodeErrorZ {
1180         fn clone(&self) -> Self {
1181                 if self.result_ok {
1182                         Self { result_ok: true, contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1183                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemoryChannelKeys>::clone(unsafe { &*self.contents.result })))
1184                         } }
1185                 } else {
1186                         Self { result_ok: false, contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1187                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1188                         } }
1189                 }
1190         }
1191 }
1192 #[no_mangle]
1193 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig: &CResult_InMemoryChannelKeysDecodeErrorZ) -> CResult_InMemoryChannelKeysDecodeErrorZ { orig.clone() }
1194 #[repr(C)]
1195 pub union CResult_TxOutAccessErrorZPtr {
1196         pub result: *mut crate::c_types::TxOut,
1197         pub err: *mut crate::chain::AccessError,
1198 }
1199 #[repr(C)]
1200 pub struct CResult_TxOutAccessErrorZ {
1201         pub contents: CResult_TxOutAccessErrorZPtr,
1202         pub result_ok: bool,
1203 }
1204 #[no_mangle]
1205 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
1206         CResult_TxOutAccessErrorZ {
1207                 contents: CResult_TxOutAccessErrorZPtr {
1208                         result: Box::into_raw(Box::new(o)),
1209                 },
1210                 result_ok: true,
1211         }
1212 }
1213 #[no_mangle]
1214 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
1215         CResult_TxOutAccessErrorZ {
1216                 contents: CResult_TxOutAccessErrorZPtr {
1217                         err: Box::into_raw(Box::new(e)),
1218                 },
1219                 result_ok: false,
1220         }
1221 }
1222 #[no_mangle]
1223 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
1224 impl Drop for CResult_TxOutAccessErrorZ {
1225         fn drop(&mut self) {
1226                 if self.result_ok {
1227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1229                         }
1230                 } else {
1231                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1232                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1233                         }
1234                 }
1235         }
1236 }
1237 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
1238         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
1239                 let contents = if o.result_ok {
1240                         let result = unsafe { o.contents.result };
1241                         unsafe { o.contents.result = std::ptr::null_mut() };
1242                         CResult_TxOutAccessErrorZPtr { result }
1243                 } else {
1244                         let err = unsafe { o.contents.err };
1245                         unsafe { o.contents.err = std::ptr::null_mut(); }
1246                         CResult_TxOutAccessErrorZPtr { err }
1247                 };
1248                 Self {
1249                         contents,
1250                         result_ok: o.result_ok,
1251                 }
1252         }
1253 }
1254 impl Clone for CResult_TxOutAccessErrorZ {
1255         fn clone(&self) -> Self {
1256                 if self.result_ok {
1257                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
1258                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
1259                         } }
1260                 } else {
1261                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
1262                                 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
1263                         } }
1264                 }
1265         }
1266 }
1267 #[no_mangle]
1268 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
1269 #[repr(C)]
1270 pub union CResult_NoneAPIErrorZPtr {
1271         /// Note that this value is always NULL, as there are no contents in the OK variant
1272         pub result: *mut std::ffi::c_void,
1273         pub err: *mut crate::util::errors::APIError,
1274 }
1275 #[repr(C)]
1276 pub struct CResult_NoneAPIErrorZ {
1277         pub contents: CResult_NoneAPIErrorZPtr,
1278         pub result_ok: bool,
1279 }
1280 #[no_mangle]
1281 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
1282         CResult_NoneAPIErrorZ {
1283                 contents: CResult_NoneAPIErrorZPtr {
1284                         result: std::ptr::null_mut(),
1285                 },
1286                 result_ok: true,
1287         }
1288 }
1289 #[no_mangle]
1290 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
1291         CResult_NoneAPIErrorZ {
1292                 contents: CResult_NoneAPIErrorZPtr {
1293                         err: Box::into_raw(Box::new(e)),
1294                 },
1295                 result_ok: false,
1296         }
1297 }
1298 #[no_mangle]
1299 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
1300 impl Drop for CResult_NoneAPIErrorZ {
1301         fn drop(&mut self) {
1302                 if self.result_ok {
1303                 } else {
1304                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1305                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1306                         }
1307                 }
1308         }
1309 }
1310 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
1311         fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
1312                 let contents = if o.result_ok {
1313                         let _ = unsafe { Box::from_raw(o.contents.result) };
1314                         o.contents.result = std::ptr::null_mut();
1315                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
1316                 } else {
1317                         let err = unsafe { o.contents.err };
1318                         unsafe { o.contents.err = std::ptr::null_mut(); }
1319                         CResult_NoneAPIErrorZPtr { err }
1320                 };
1321                 Self {
1322                         contents,
1323                         result_ok: o.result_ok,
1324                 }
1325         }
1326 }
1327 impl Clone for CResult_NoneAPIErrorZ {
1328         fn clone(&self) -> Self {
1329                 if self.result_ok {
1330                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
1331                                 result: std::ptr::null_mut()
1332                         } }
1333                 } else {
1334                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
1335                                 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
1336                         } }
1337                 }
1338         }
1339 }
1340 #[no_mangle]
1341 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
1342 #[repr(C)]
1343 pub struct CVec_ChannelDetailsZ {
1344         pub data: *mut crate::ln::channelmanager::ChannelDetails,
1345         pub datalen: usize
1346 }
1347 impl CVec_ChannelDetailsZ {
1348         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
1349                 if self.datalen == 0 { return Vec::new(); }
1350                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1351                 self.data = std::ptr::null_mut();
1352                 self.datalen = 0;
1353                 ret
1354         }
1355         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
1356                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1357         }
1358 }
1359 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1360         fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
1361                 let datalen = v.len();
1362                 let data = Box::into_raw(v.into_boxed_slice());
1363                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1364         }
1365 }
1366 #[no_mangle]
1367 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1368 impl Drop for CVec_ChannelDetailsZ {
1369         fn drop(&mut self) {
1370                 if self.datalen == 0 { return; }
1371                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1372         }
1373 }
1374 impl Clone for CVec_ChannelDetailsZ {
1375         fn clone(&self) -> Self {
1376                 let mut res = Vec::new();
1377                 if self.datalen == 0 { return Self::from(res); }
1378                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1379                 Self::from(res)
1380         }
1381 }
1382 #[repr(C)]
1383 pub union CResult_NonePaymentSendFailureZPtr {
1384         /// Note that this value is always NULL, as there are no contents in the OK variant
1385         pub result: *mut std::ffi::c_void,
1386         pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
1387 }
1388 #[repr(C)]
1389 pub struct CResult_NonePaymentSendFailureZ {
1390         pub contents: CResult_NonePaymentSendFailureZPtr,
1391         pub result_ok: bool,
1392 }
1393 #[no_mangle]
1394 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
1395         CResult_NonePaymentSendFailureZ {
1396                 contents: CResult_NonePaymentSendFailureZPtr {
1397                         result: std::ptr::null_mut(),
1398                 },
1399                 result_ok: true,
1400         }
1401 }
1402 #[no_mangle]
1403 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
1404         CResult_NonePaymentSendFailureZ {
1405                 contents: CResult_NonePaymentSendFailureZPtr {
1406                         err: Box::into_raw(Box::new(e)),
1407                 },
1408                 result_ok: false,
1409         }
1410 }
1411 #[no_mangle]
1412 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
1413 impl Drop for CResult_NonePaymentSendFailureZ {
1414         fn drop(&mut self) {
1415                 if self.result_ok {
1416                 } else {
1417                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1418                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1419                         }
1420                 }
1421         }
1422 }
1423 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
1424         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
1425                 let contents = if o.result_ok {
1426                         let _ = unsafe { Box::from_raw(o.contents.result) };
1427                         o.contents.result = std::ptr::null_mut();
1428                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
1429                 } else {
1430                         let err = unsafe { o.contents.err };
1431                         unsafe { o.contents.err = std::ptr::null_mut(); }
1432                         CResult_NonePaymentSendFailureZPtr { err }
1433                 };
1434                 Self {
1435                         contents,
1436                         result_ok: o.result_ok,
1437                 }
1438         }
1439 }
1440 impl Clone for CResult_NonePaymentSendFailureZ {
1441         fn clone(&self) -> Self {
1442                 if self.result_ok {
1443                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
1444                                 result: std::ptr::null_mut()
1445                         } }
1446                 } else {
1447                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
1448                                 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
1449                         } }
1450                 }
1451         }
1452 }
1453 #[no_mangle]
1454 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
1455 #[repr(C)]
1456 pub struct CVec_NetAddressZ {
1457         pub data: *mut crate::ln::msgs::NetAddress,
1458         pub datalen: usize
1459 }
1460 impl CVec_NetAddressZ {
1461         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NetAddress> {
1462                 if self.datalen == 0 { return Vec::new(); }
1463                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1464                 self.data = std::ptr::null_mut();
1465                 self.datalen = 0;
1466                 ret
1467         }
1468         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NetAddress] {
1469                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1470         }
1471 }
1472 impl From<Vec<crate::ln::msgs::NetAddress>> for CVec_NetAddressZ {
1473         fn from(v: Vec<crate::ln::msgs::NetAddress>) -> Self {
1474                 let datalen = v.len();
1475                 let data = Box::into_raw(v.into_boxed_slice());
1476                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1477         }
1478 }
1479 #[no_mangle]
1480 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
1481 impl Drop for CVec_NetAddressZ {
1482         fn drop(&mut self) {
1483                 if self.datalen == 0 { return; }
1484                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1485         }
1486 }
1487 impl Clone for CVec_NetAddressZ {
1488         fn clone(&self) -> Self {
1489                 let mut res = Vec::new();
1490                 if self.datalen == 0 { return Self::from(res); }
1491                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1492                 Self::from(res)
1493         }
1494 }
1495 #[repr(C)]
1496 pub struct CVec_ChannelMonitorZ {
1497         pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
1498         pub datalen: usize
1499 }
1500 impl CVec_ChannelMonitorZ {
1501         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
1502                 if self.datalen == 0 { return Vec::new(); }
1503                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1504                 self.data = std::ptr::null_mut();
1505                 self.datalen = 0;
1506                 ret
1507         }
1508         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
1509                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1510         }
1511 }
1512 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
1513         fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
1514                 let datalen = v.len();
1515                 let data = Box::into_raw(v.into_boxed_slice());
1516                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1517         }
1518 }
1519 #[no_mangle]
1520 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
1521 impl Drop for CVec_ChannelMonitorZ {
1522         fn drop(&mut self) {
1523                 if self.datalen == 0 { return; }
1524                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1525         }
1526 }
1527 #[repr(C)]
1528 pub struct C2Tuple_BlockHashChannelManagerZ {
1529         pub a: crate::c_types::ThirtyTwoBytes,
1530         pub b: crate::ln::channelmanager::ChannelManager,
1531 }
1532 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
1533         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
1534                 Self {
1535                         a: tup.0,
1536                         b: tup.1,
1537                 }
1538         }
1539 }
1540 impl C2Tuple_BlockHashChannelManagerZ {
1541         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
1542                 (self.a, self.b)
1543         }
1544 }
1545 #[no_mangle]
1546 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
1547         C2Tuple_BlockHashChannelManagerZ { a, b, }
1548 }
1549
1550 #[no_mangle]
1551 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
1552 #[repr(C)]
1553 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1554         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
1555         pub err: *mut crate::ln::msgs::DecodeError,
1556 }
1557 #[repr(C)]
1558 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1559         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
1560         pub result_ok: bool,
1561 }
1562 #[no_mangle]
1563 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1564         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1565                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1566                         result: Box::into_raw(Box::new(o)),
1567                 },
1568                 result_ok: true,
1569         }
1570 }
1571 #[no_mangle]
1572 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1573         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1574                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1575                         err: Box::into_raw(Box::new(e)),
1576                 },
1577                 result_ok: false,
1578         }
1579 }
1580 #[no_mangle]
1581 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
1582 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1583         fn drop(&mut self) {
1584                 if self.result_ok {
1585                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1586                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1587                         }
1588                 } else {
1589                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1590                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1591                         }
1592                 }
1593         }
1594 }
1595 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1596         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
1597                 let contents = if o.result_ok {
1598                         let result = unsafe { o.contents.result };
1599                         unsafe { o.contents.result = std::ptr::null_mut() };
1600                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
1601                 } else {
1602                         let err = unsafe { o.contents.err };
1603                         unsafe { o.contents.err = std::ptr::null_mut(); }
1604                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
1605                 };
1606                 Self {
1607                         contents,
1608                         result_ok: o.result_ok,
1609                 }
1610         }
1611 }
1612 #[repr(C)]
1613 pub union CResult_NetAddressu8ZPtr {
1614         pub result: *mut crate::ln::msgs::NetAddress,
1615         pub err: *mut u8,
1616 }
1617 #[repr(C)]
1618 pub struct CResult_NetAddressu8Z {
1619         pub contents: CResult_NetAddressu8ZPtr,
1620         pub result_ok: bool,
1621 }
1622 #[no_mangle]
1623 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
1624         CResult_NetAddressu8Z {
1625                 contents: CResult_NetAddressu8ZPtr {
1626                         result: Box::into_raw(Box::new(o)),
1627                 },
1628                 result_ok: true,
1629         }
1630 }
1631 #[no_mangle]
1632 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
1633         CResult_NetAddressu8Z {
1634                 contents: CResult_NetAddressu8ZPtr {
1635                         err: Box::into_raw(Box::new(e)),
1636                 },
1637                 result_ok: false,
1638         }
1639 }
1640 #[no_mangle]
1641 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
1642 impl Drop for CResult_NetAddressu8Z {
1643         fn drop(&mut self) {
1644                 if self.result_ok {
1645                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1646                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1647                         }
1648                 } else {
1649                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1650                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1651                         }
1652                 }
1653         }
1654 }
1655 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
1656         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
1657                 let contents = if o.result_ok {
1658                         let result = unsafe { o.contents.result };
1659                         unsafe { o.contents.result = std::ptr::null_mut() };
1660                         CResult_NetAddressu8ZPtr { result }
1661                 } else {
1662                         let err = unsafe { o.contents.err };
1663                         unsafe { o.contents.err = std::ptr::null_mut(); }
1664                         CResult_NetAddressu8ZPtr { err }
1665                 };
1666                 Self {
1667                         contents,
1668                         result_ok: o.result_ok,
1669                 }
1670         }
1671 }
1672 impl Clone for CResult_NetAddressu8Z {
1673         fn clone(&self) -> Self {
1674                 if self.result_ok {
1675                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
1676                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
1677                         } }
1678                 } else {
1679                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
1680                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
1681                         } }
1682                 }
1683         }
1684 }
1685 #[no_mangle]
1686 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
1687 #[repr(C)]
1688 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1689         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
1690         pub err: *mut crate::ln::msgs::DecodeError,
1691 }
1692 #[repr(C)]
1693 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
1694         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
1695         pub result_ok: bool,
1696 }
1697 #[no_mangle]
1698 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1699         CResult_CResult_NetAddressu8ZDecodeErrorZ {
1700                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1701                         result: Box::into_raw(Box::new(o)),
1702                 },
1703                 result_ok: true,
1704         }
1705 }
1706 #[no_mangle]
1707 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1708         CResult_CResult_NetAddressu8ZDecodeErrorZ {
1709                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1710                         err: Box::into_raw(Box::new(e)),
1711                 },
1712                 result_ok: false,
1713         }
1714 }
1715 #[no_mangle]
1716 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
1717 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1718         fn drop(&mut self) {
1719                 if self.result_ok {
1720                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1721                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1722                         }
1723                 } else {
1724                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1725                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1726                         }
1727                 }
1728         }
1729 }
1730 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1731         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
1732                 let contents = if o.result_ok {
1733                         let result = unsafe { o.contents.result };
1734                         unsafe { o.contents.result = std::ptr::null_mut() };
1735                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
1736                 } else {
1737                         let err = unsafe { o.contents.err };
1738                         unsafe { o.contents.err = std::ptr::null_mut(); }
1739                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
1740                 };
1741                 Self {
1742                         contents,
1743                         result_ok: o.result_ok,
1744                 }
1745         }
1746 }
1747 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1748         fn clone(&self) -> Self {
1749                 if self.result_ok {
1750                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1751                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
1752                         } }
1753                 } else {
1754                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1755                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1756                         } }
1757                 }
1758         }
1759 }
1760 #[no_mangle]
1761 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
1762 #[repr(C)]
1763 pub struct CVec_u64Z {
1764         pub data: *mut u64,
1765         pub datalen: usize
1766 }
1767 impl CVec_u64Z {
1768         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
1769                 if self.datalen == 0 { return Vec::new(); }
1770                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1771                 self.data = std::ptr::null_mut();
1772                 self.datalen = 0;
1773                 ret
1774         }
1775         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
1776                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1777         }
1778 }
1779 impl From<Vec<u64>> for CVec_u64Z {
1780         fn from(v: Vec<u64>) -> Self {
1781                 let datalen = v.len();
1782                 let data = Box::into_raw(v.into_boxed_slice());
1783                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1784         }
1785 }
1786 #[no_mangle]
1787 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
1788 impl Drop for CVec_u64Z {
1789         fn drop(&mut self) {
1790                 if self.datalen == 0 { return; }
1791                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1792         }
1793 }
1794 impl Clone for CVec_u64Z {
1795         fn clone(&self) -> Self {
1796                 let mut res = Vec::new();
1797                 if self.datalen == 0 { return Self::from(res); }
1798                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1799                 Self::from(res)
1800         }
1801 }
1802 #[repr(C)]
1803 pub struct CVec_UpdateAddHTLCZ {
1804         pub data: *mut crate::ln::msgs::UpdateAddHTLC,
1805         pub datalen: usize
1806 }
1807 impl CVec_UpdateAddHTLCZ {
1808         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
1809                 if self.datalen == 0 { return Vec::new(); }
1810                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1811                 self.data = std::ptr::null_mut();
1812                 self.datalen = 0;
1813                 ret
1814         }
1815         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
1816                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1817         }
1818 }
1819 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
1820         fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
1821                 let datalen = v.len();
1822                 let data = Box::into_raw(v.into_boxed_slice());
1823                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1824         }
1825 }
1826 #[no_mangle]
1827 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
1828 impl Drop for CVec_UpdateAddHTLCZ {
1829         fn drop(&mut self) {
1830                 if self.datalen == 0 { return; }
1831                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1832         }
1833 }
1834 impl Clone for CVec_UpdateAddHTLCZ {
1835         fn clone(&self) -> Self {
1836                 let mut res = Vec::new();
1837                 if self.datalen == 0 { return Self::from(res); }
1838                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1839                 Self::from(res)
1840         }
1841 }
1842 #[repr(C)]
1843 pub struct CVec_UpdateFulfillHTLCZ {
1844         pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
1845         pub datalen: usize
1846 }
1847 impl CVec_UpdateFulfillHTLCZ {
1848         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
1849                 if self.datalen == 0 { return Vec::new(); }
1850                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1851                 self.data = std::ptr::null_mut();
1852                 self.datalen = 0;
1853                 ret
1854         }
1855         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
1856                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1857         }
1858 }
1859 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
1860         fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
1861                 let datalen = v.len();
1862                 let data = Box::into_raw(v.into_boxed_slice());
1863                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1864         }
1865 }
1866 #[no_mangle]
1867 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
1868 impl Drop for CVec_UpdateFulfillHTLCZ {
1869         fn drop(&mut self) {
1870                 if self.datalen == 0 { return; }
1871                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1872         }
1873 }
1874 impl Clone for CVec_UpdateFulfillHTLCZ {
1875         fn clone(&self) -> Self {
1876                 let mut res = Vec::new();
1877                 if self.datalen == 0 { return Self::from(res); }
1878                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1879                 Self::from(res)
1880         }
1881 }
1882 #[repr(C)]
1883 pub struct CVec_UpdateFailHTLCZ {
1884         pub data: *mut crate::ln::msgs::UpdateFailHTLC,
1885         pub datalen: usize
1886 }
1887 impl CVec_UpdateFailHTLCZ {
1888         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
1889                 if self.datalen == 0 { return Vec::new(); }
1890                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1891                 self.data = std::ptr::null_mut();
1892                 self.datalen = 0;
1893                 ret
1894         }
1895         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
1896                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1897         }
1898 }
1899 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
1900         fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
1901                 let datalen = v.len();
1902                 let data = Box::into_raw(v.into_boxed_slice());
1903                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1904         }
1905 }
1906 #[no_mangle]
1907 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
1908 impl Drop for CVec_UpdateFailHTLCZ {
1909         fn drop(&mut self) {
1910                 if self.datalen == 0 { return; }
1911                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1912         }
1913 }
1914 impl Clone for CVec_UpdateFailHTLCZ {
1915         fn clone(&self) -> Self {
1916                 let mut res = Vec::new();
1917                 if self.datalen == 0 { return Self::from(res); }
1918                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1919                 Self::from(res)
1920         }
1921 }
1922 #[repr(C)]
1923 pub struct CVec_UpdateFailMalformedHTLCZ {
1924         pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
1925         pub datalen: usize
1926 }
1927 impl CVec_UpdateFailMalformedHTLCZ {
1928         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
1929                 if self.datalen == 0 { return Vec::new(); }
1930                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1931                 self.data = std::ptr::null_mut();
1932                 self.datalen = 0;
1933                 ret
1934         }
1935         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
1936                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1937         }
1938 }
1939 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
1940         fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
1941                 let datalen = v.len();
1942                 let data = Box::into_raw(v.into_boxed_slice());
1943                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1944         }
1945 }
1946 #[no_mangle]
1947 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
1948 impl Drop for CVec_UpdateFailMalformedHTLCZ {
1949         fn drop(&mut self) {
1950                 if self.datalen == 0 { return; }
1951                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1952         }
1953 }
1954 impl Clone for CVec_UpdateFailMalformedHTLCZ {
1955         fn clone(&self) -> Self {
1956                 let mut res = Vec::new();
1957                 if self.datalen == 0 { return Self::from(res); }
1958                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1959                 Self::from(res)
1960         }
1961 }
1962 #[repr(C)]
1963 pub union CResult_boolLightningErrorZPtr {
1964         pub result: *mut bool,
1965         pub err: *mut crate::ln::msgs::LightningError,
1966 }
1967 #[repr(C)]
1968 pub struct CResult_boolLightningErrorZ {
1969         pub contents: CResult_boolLightningErrorZPtr,
1970         pub result_ok: bool,
1971 }
1972 #[no_mangle]
1973 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1974         CResult_boolLightningErrorZ {
1975                 contents: CResult_boolLightningErrorZPtr {
1976                         result: Box::into_raw(Box::new(o)),
1977                 },
1978                 result_ok: true,
1979         }
1980 }
1981 #[no_mangle]
1982 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1983         CResult_boolLightningErrorZ {
1984                 contents: CResult_boolLightningErrorZPtr {
1985                         err: Box::into_raw(Box::new(e)),
1986                 },
1987                 result_ok: false,
1988         }
1989 }
1990 #[no_mangle]
1991 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1992 impl Drop for CResult_boolLightningErrorZ {
1993         fn drop(&mut self) {
1994                 if self.result_ok {
1995                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1996                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1997                         }
1998                 } else {
1999                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2000                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2001                         }
2002                 }
2003         }
2004 }
2005 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
2006         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
2007                 let contents = if o.result_ok {
2008                         let result = unsafe { o.contents.result };
2009                         unsafe { o.contents.result = std::ptr::null_mut() };
2010                         CResult_boolLightningErrorZPtr { result }
2011                 } else {
2012                         let err = unsafe { o.contents.err };
2013                         unsafe { o.contents.err = std::ptr::null_mut(); }
2014                         CResult_boolLightningErrorZPtr { err }
2015                 };
2016                 Self {
2017                         contents,
2018                         result_ok: o.result_ok,
2019                 }
2020         }
2021 }
2022 impl Clone for CResult_boolLightningErrorZ {
2023         fn clone(&self) -> Self {
2024                 if self.result_ok {
2025                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
2026                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
2027                         } }
2028                 } else {
2029                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
2030                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2031                         } }
2032                 }
2033         }
2034 }
2035 #[no_mangle]
2036 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
2037 #[repr(C)]
2038 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2039         pub a: crate::ln::msgs::ChannelAnnouncement,
2040         pub b: crate::ln::msgs::ChannelUpdate,
2041         pub c: crate::ln::msgs::ChannelUpdate,
2042 }
2043 impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2044         fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
2045                 Self {
2046                         a: tup.0,
2047                         b: tup.1,
2048                         c: tup.2,
2049                 }
2050         }
2051 }
2052 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2053         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
2054                 (self.a, self.b, self.c)
2055         }
2056 }
2057 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2058         fn clone(&self) -> Self {
2059                 Self {
2060                         a: self.a.clone(),
2061                         b: self.b.clone(),
2062                         c: self.c.clone(),
2063                 }
2064         }
2065 }
2066 #[no_mangle]
2067 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
2068 #[no_mangle]
2069 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2070         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
2071 }
2072
2073 #[no_mangle]
2074 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
2075 #[repr(C)]
2076 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2077         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
2078         pub datalen: usize
2079 }
2080 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2081         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
2082                 if self.datalen == 0 { return Vec::new(); }
2083                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2084                 self.data = std::ptr::null_mut();
2085                 self.datalen = 0;
2086                 ret
2087         }
2088         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
2089                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2090         }
2091 }
2092 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2093         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
2094                 let datalen = v.len();
2095                 let data = Box::into_raw(v.into_boxed_slice());
2096                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2097         }
2098 }
2099 #[no_mangle]
2100 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
2101 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2102         fn drop(&mut self) {
2103                 if self.datalen == 0 { return; }
2104                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2105         }
2106 }
2107 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2108         fn clone(&self) -> Self {
2109                 let mut res = Vec::new();
2110                 if self.datalen == 0 { return Self::from(res); }
2111                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2112                 Self::from(res)
2113         }
2114 }
2115 #[repr(C)]
2116 pub struct CVec_NodeAnnouncementZ {
2117         pub data: *mut crate::ln::msgs::NodeAnnouncement,
2118         pub datalen: usize
2119 }
2120 impl CVec_NodeAnnouncementZ {
2121         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
2122                 if self.datalen == 0 { return Vec::new(); }
2123                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2124                 self.data = std::ptr::null_mut();
2125                 self.datalen = 0;
2126                 ret
2127         }
2128         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
2129                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2130         }
2131 }
2132 impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
2133         fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
2134                 let datalen = v.len();
2135                 let data = Box::into_raw(v.into_boxed_slice());
2136                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2137         }
2138 }
2139 #[no_mangle]
2140 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
2141 impl Drop for CVec_NodeAnnouncementZ {
2142         fn drop(&mut self) {
2143                 if self.datalen == 0 { return; }
2144                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2145         }
2146 }
2147 impl Clone for CVec_NodeAnnouncementZ {
2148         fn clone(&self) -> Self {
2149                 let mut res = Vec::new();
2150                 if self.datalen == 0 { return Self::from(res); }
2151                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2152                 Self::from(res)
2153         }
2154 }
2155 #[repr(C)]
2156 pub union CResult_NoneLightningErrorZPtr {
2157         /// Note that this value is always NULL, as there are no contents in the OK variant
2158         pub result: *mut std::ffi::c_void,
2159         pub err: *mut crate::ln::msgs::LightningError,
2160 }
2161 #[repr(C)]
2162 pub struct CResult_NoneLightningErrorZ {
2163         pub contents: CResult_NoneLightningErrorZPtr,
2164         pub result_ok: bool,
2165 }
2166 #[no_mangle]
2167 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
2168         CResult_NoneLightningErrorZ {
2169                 contents: CResult_NoneLightningErrorZPtr {
2170                         result: std::ptr::null_mut(),
2171                 },
2172                 result_ok: true,
2173         }
2174 }
2175 #[no_mangle]
2176 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
2177         CResult_NoneLightningErrorZ {
2178                 contents: CResult_NoneLightningErrorZPtr {
2179                         err: Box::into_raw(Box::new(e)),
2180                 },
2181                 result_ok: false,
2182         }
2183 }
2184 #[no_mangle]
2185 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
2186 impl Drop for CResult_NoneLightningErrorZ {
2187         fn drop(&mut self) {
2188                 if self.result_ok {
2189                 } else {
2190                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2191                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2192                         }
2193                 }
2194         }
2195 }
2196 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
2197         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
2198                 let contents = if o.result_ok {
2199                         let _ = unsafe { Box::from_raw(o.contents.result) };
2200                         o.contents.result = std::ptr::null_mut();
2201                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
2202                 } else {
2203                         let err = unsafe { o.contents.err };
2204                         unsafe { o.contents.err = std::ptr::null_mut(); }
2205                         CResult_NoneLightningErrorZPtr { err }
2206                 };
2207                 Self {
2208                         contents,
2209                         result_ok: o.result_ok,
2210                 }
2211         }
2212 }
2213 impl Clone for CResult_NoneLightningErrorZ {
2214         fn clone(&self) -> Self {
2215                 if self.result_ok {
2216                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
2217                                 result: std::ptr::null_mut()
2218                         } }
2219                 } else {
2220                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
2221                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2222                         } }
2223                 }
2224         }
2225 }
2226 #[no_mangle]
2227 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
2228 #[repr(C)]
2229 pub union CResult_ChannelReestablishDecodeErrorZPtr {
2230         pub result: *mut crate::ln::msgs::ChannelReestablish,
2231         pub err: *mut crate::ln::msgs::DecodeError,
2232 }
2233 #[repr(C)]
2234 pub struct CResult_ChannelReestablishDecodeErrorZ {
2235         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
2236         pub result_ok: bool,
2237 }
2238 #[no_mangle]
2239 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
2240         CResult_ChannelReestablishDecodeErrorZ {
2241                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
2242                         result: Box::into_raw(Box::new(o)),
2243                 },
2244                 result_ok: true,
2245         }
2246 }
2247 #[no_mangle]
2248 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
2249         CResult_ChannelReestablishDecodeErrorZ {
2250                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
2251                         err: Box::into_raw(Box::new(e)),
2252                 },
2253                 result_ok: false,
2254         }
2255 }
2256 #[no_mangle]
2257 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
2258 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
2259         fn drop(&mut self) {
2260                 if self.result_ok {
2261                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2262                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2263                         }
2264                 } else {
2265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2267                         }
2268                 }
2269         }
2270 }
2271 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
2272         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
2273                 let contents = if o.result_ok {
2274                         let result = unsafe { o.contents.result };
2275                         unsafe { o.contents.result = std::ptr::null_mut() };
2276                         CResult_ChannelReestablishDecodeErrorZPtr { result }
2277                 } else {
2278                         let err = unsafe { o.contents.err };
2279                         unsafe { o.contents.err = std::ptr::null_mut(); }
2280                         CResult_ChannelReestablishDecodeErrorZPtr { err }
2281                 };
2282                 Self {
2283                         contents,
2284                         result_ok: o.result_ok,
2285                 }
2286         }
2287 }
2288 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
2289         fn clone(&self) -> Self {
2290                 if self.result_ok {
2291                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
2292                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
2293                         } }
2294                 } else {
2295                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
2296                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2297                         } }
2298                 }
2299         }
2300 }
2301 #[no_mangle]
2302 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
2303 #[repr(C)]
2304 pub union CResult_InitDecodeErrorZPtr {
2305         pub result: *mut crate::ln::msgs::Init,
2306         pub err: *mut crate::ln::msgs::DecodeError,
2307 }
2308 #[repr(C)]
2309 pub struct CResult_InitDecodeErrorZ {
2310         pub contents: CResult_InitDecodeErrorZPtr,
2311         pub result_ok: bool,
2312 }
2313 #[no_mangle]
2314 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
2315         CResult_InitDecodeErrorZ {
2316                 contents: CResult_InitDecodeErrorZPtr {
2317                         result: Box::into_raw(Box::new(o)),
2318                 },
2319                 result_ok: true,
2320         }
2321 }
2322 #[no_mangle]
2323 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
2324         CResult_InitDecodeErrorZ {
2325                 contents: CResult_InitDecodeErrorZPtr {
2326                         err: Box::into_raw(Box::new(e)),
2327                 },
2328                 result_ok: false,
2329         }
2330 }
2331 #[no_mangle]
2332 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
2333 impl Drop for CResult_InitDecodeErrorZ {
2334         fn drop(&mut self) {
2335                 if self.result_ok {
2336                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2337                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2338                         }
2339                 } else {
2340                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2341                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2342                         }
2343                 }
2344         }
2345 }
2346 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
2347         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
2348                 let contents = if o.result_ok {
2349                         let result = unsafe { o.contents.result };
2350                         unsafe { o.contents.result = std::ptr::null_mut() };
2351                         CResult_InitDecodeErrorZPtr { result }
2352                 } else {
2353                         let err = unsafe { o.contents.err };
2354                         unsafe { o.contents.err = std::ptr::null_mut(); }
2355                         CResult_InitDecodeErrorZPtr { err }
2356                 };
2357                 Self {
2358                         contents,
2359                         result_ok: o.result_ok,
2360                 }
2361         }
2362 }
2363 impl Clone for CResult_InitDecodeErrorZ {
2364         fn clone(&self) -> Self {
2365                 if self.result_ok {
2366                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
2367                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
2368                         } }
2369                 } else {
2370                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
2371                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2372                         } }
2373                 }
2374         }
2375 }
2376 #[no_mangle]
2377 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
2378 #[repr(C)]
2379 pub union CResult_PingDecodeErrorZPtr {
2380         pub result: *mut crate::ln::msgs::Ping,
2381         pub err: *mut crate::ln::msgs::DecodeError,
2382 }
2383 #[repr(C)]
2384 pub struct CResult_PingDecodeErrorZ {
2385         pub contents: CResult_PingDecodeErrorZPtr,
2386         pub result_ok: bool,
2387 }
2388 #[no_mangle]
2389 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
2390         CResult_PingDecodeErrorZ {
2391                 contents: CResult_PingDecodeErrorZPtr {
2392                         result: Box::into_raw(Box::new(o)),
2393                 },
2394                 result_ok: true,
2395         }
2396 }
2397 #[no_mangle]
2398 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
2399         CResult_PingDecodeErrorZ {
2400                 contents: CResult_PingDecodeErrorZPtr {
2401                         err: Box::into_raw(Box::new(e)),
2402                 },
2403                 result_ok: false,
2404         }
2405 }
2406 #[no_mangle]
2407 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
2408 impl Drop for CResult_PingDecodeErrorZ {
2409         fn drop(&mut self) {
2410                 if self.result_ok {
2411                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2412                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2413                         }
2414                 } else {
2415                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2416                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2417                         }
2418                 }
2419         }
2420 }
2421 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
2422         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
2423                 let contents = if o.result_ok {
2424                         let result = unsafe { o.contents.result };
2425                         unsafe { o.contents.result = std::ptr::null_mut() };
2426                         CResult_PingDecodeErrorZPtr { result }
2427                 } else {
2428                         let err = unsafe { o.contents.err };
2429                         unsafe { o.contents.err = std::ptr::null_mut(); }
2430                         CResult_PingDecodeErrorZPtr { err }
2431                 };
2432                 Self {
2433                         contents,
2434                         result_ok: o.result_ok,
2435                 }
2436         }
2437 }
2438 impl Clone for CResult_PingDecodeErrorZ {
2439         fn clone(&self) -> Self {
2440                 if self.result_ok {
2441                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
2442                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
2443                         } }
2444                 } else {
2445                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
2446                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2447                         } }
2448                 }
2449         }
2450 }
2451 #[no_mangle]
2452 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
2453 #[repr(C)]
2454 pub union CResult_PongDecodeErrorZPtr {
2455         pub result: *mut crate::ln::msgs::Pong,
2456         pub err: *mut crate::ln::msgs::DecodeError,
2457 }
2458 #[repr(C)]
2459 pub struct CResult_PongDecodeErrorZ {
2460         pub contents: CResult_PongDecodeErrorZPtr,
2461         pub result_ok: bool,
2462 }
2463 #[no_mangle]
2464 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
2465         CResult_PongDecodeErrorZ {
2466                 contents: CResult_PongDecodeErrorZPtr {
2467                         result: Box::into_raw(Box::new(o)),
2468                 },
2469                 result_ok: true,
2470         }
2471 }
2472 #[no_mangle]
2473 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
2474         CResult_PongDecodeErrorZ {
2475                 contents: CResult_PongDecodeErrorZPtr {
2476                         err: Box::into_raw(Box::new(e)),
2477                 },
2478                 result_ok: false,
2479         }
2480 }
2481 #[no_mangle]
2482 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
2483 impl Drop for CResult_PongDecodeErrorZ {
2484         fn drop(&mut self) {
2485                 if self.result_ok {
2486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2488                         }
2489                 } else {
2490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2492                         }
2493                 }
2494         }
2495 }
2496 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
2497         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
2498                 let contents = if o.result_ok {
2499                         let result = unsafe { o.contents.result };
2500                         unsafe { o.contents.result = std::ptr::null_mut() };
2501                         CResult_PongDecodeErrorZPtr { result }
2502                 } else {
2503                         let err = unsafe { o.contents.err };
2504                         unsafe { o.contents.err = std::ptr::null_mut(); }
2505                         CResult_PongDecodeErrorZPtr { err }
2506                 };
2507                 Self {
2508                         contents,
2509                         result_ok: o.result_ok,
2510                 }
2511         }
2512 }
2513 impl Clone for CResult_PongDecodeErrorZ {
2514         fn clone(&self) -> Self {
2515                 if self.result_ok {
2516                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
2517                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
2518                         } }
2519                 } else {
2520                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
2521                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2522                         } }
2523                 }
2524         }
2525 }
2526 #[no_mangle]
2527 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
2528 #[repr(C)]
2529 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2530         pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
2531         pub err: *mut crate::ln::msgs::DecodeError,
2532 }
2533 #[repr(C)]
2534 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2535         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
2536         pub result_ok: bool,
2537 }
2538 #[no_mangle]
2539 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2540         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2541                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2542                         result: Box::into_raw(Box::new(o)),
2543                 },
2544                 result_ok: true,
2545         }
2546 }
2547 #[no_mangle]
2548 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2549         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2550                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2551                         err: Box::into_raw(Box::new(e)),
2552                 },
2553                 result_ok: false,
2554         }
2555 }
2556 #[no_mangle]
2557 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
2558 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2559         fn drop(&mut self) {
2560                 if self.result_ok {
2561                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2562                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2563                         }
2564                 } else {
2565                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2566                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2567                         }
2568                 }
2569         }
2570 }
2571 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2572         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
2573                 let contents = if o.result_ok {
2574                         let result = unsafe { o.contents.result };
2575                         unsafe { o.contents.result = std::ptr::null_mut() };
2576                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
2577                 } else {
2578                         let err = unsafe { o.contents.err };
2579                         unsafe { o.contents.err = std::ptr::null_mut(); }
2580                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
2581                 };
2582                 Self {
2583                         contents,
2584                         result_ok: o.result_ok,
2585                 }
2586         }
2587 }
2588 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2589         fn clone(&self) -> Self {
2590                 if self.result_ok {
2591                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2592                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
2593                         } }
2594                 } else {
2595                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2596                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2597                         } }
2598                 }
2599         }
2600 }
2601 #[no_mangle]
2602 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
2603 #[repr(C)]
2604 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2605         pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
2606         pub err: *mut crate::ln::msgs::DecodeError,
2607 }
2608 #[repr(C)]
2609 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
2610         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
2611         pub result_ok: bool,
2612 }
2613 #[no_mangle]
2614 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
2615         CResult_UnsignedChannelUpdateDecodeErrorZ {
2616                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2617                         result: Box::into_raw(Box::new(o)),
2618                 },
2619                 result_ok: true,
2620         }
2621 }
2622 #[no_mangle]
2623 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
2624         CResult_UnsignedChannelUpdateDecodeErrorZ {
2625                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2626                         err: Box::into_raw(Box::new(e)),
2627                 },
2628                 result_ok: false,
2629         }
2630 }
2631 #[no_mangle]
2632 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
2633 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
2634         fn drop(&mut self) {
2635                 if self.result_ok {
2636                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2637                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2638                         }
2639                 } else {
2640                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2641                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2642                         }
2643                 }
2644         }
2645 }
2646 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
2647         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
2648                 let contents = if o.result_ok {
2649                         let result = unsafe { o.contents.result };
2650                         unsafe { o.contents.result = std::ptr::null_mut() };
2651                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
2652                 } else {
2653                         let err = unsafe { o.contents.err };
2654                         unsafe { o.contents.err = std::ptr::null_mut(); }
2655                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
2656                 };
2657                 Self {
2658                         contents,
2659                         result_ok: o.result_ok,
2660                 }
2661         }
2662 }
2663 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
2664         fn clone(&self) -> Self {
2665                 if self.result_ok {
2666                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2667                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
2668                         } }
2669                 } else {
2670                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2671                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2672                         } }
2673                 }
2674         }
2675 }
2676 #[no_mangle]
2677 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
2678 #[repr(C)]
2679 pub union CResult_ErrorMessageDecodeErrorZPtr {
2680         pub result: *mut crate::ln::msgs::ErrorMessage,
2681         pub err: *mut crate::ln::msgs::DecodeError,
2682 }
2683 #[repr(C)]
2684 pub struct CResult_ErrorMessageDecodeErrorZ {
2685         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
2686         pub result_ok: bool,
2687 }
2688 #[no_mangle]
2689 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
2690         CResult_ErrorMessageDecodeErrorZ {
2691                 contents: CResult_ErrorMessageDecodeErrorZPtr {
2692                         result: Box::into_raw(Box::new(o)),
2693                 },
2694                 result_ok: true,
2695         }
2696 }
2697 #[no_mangle]
2698 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
2699         CResult_ErrorMessageDecodeErrorZ {
2700                 contents: CResult_ErrorMessageDecodeErrorZPtr {
2701                         err: Box::into_raw(Box::new(e)),
2702                 },
2703                 result_ok: false,
2704         }
2705 }
2706 #[no_mangle]
2707 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
2708 impl Drop for CResult_ErrorMessageDecodeErrorZ {
2709         fn drop(&mut self) {
2710                 if self.result_ok {
2711                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2712                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2713                         }
2714                 } else {
2715                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2716                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2717                         }
2718                 }
2719         }
2720 }
2721 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
2722         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
2723                 let contents = if o.result_ok {
2724                         let result = unsafe { o.contents.result };
2725                         unsafe { o.contents.result = std::ptr::null_mut() };
2726                         CResult_ErrorMessageDecodeErrorZPtr { result }
2727                 } else {
2728                         let err = unsafe { o.contents.err };
2729                         unsafe { o.contents.err = std::ptr::null_mut(); }
2730                         CResult_ErrorMessageDecodeErrorZPtr { err }
2731                 };
2732                 Self {
2733                         contents,
2734                         result_ok: o.result_ok,
2735                 }
2736         }
2737 }
2738 impl Clone for CResult_ErrorMessageDecodeErrorZ {
2739         fn clone(&self) -> Self {
2740                 if self.result_ok {
2741                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
2742                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
2743                         } }
2744                 } else {
2745                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
2746                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2747                         } }
2748                 }
2749         }
2750 }
2751 #[no_mangle]
2752 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
2753 #[repr(C)]
2754 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2755         pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
2756         pub err: *mut crate::ln::msgs::DecodeError,
2757 }
2758 #[repr(C)]
2759 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2760         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
2761         pub result_ok: bool,
2762 }
2763 #[no_mangle]
2764 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2765         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2766                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2767                         result: Box::into_raw(Box::new(o)),
2768                 },
2769                 result_ok: true,
2770         }
2771 }
2772 #[no_mangle]
2773 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2774         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2775                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2776                         err: Box::into_raw(Box::new(e)),
2777                 },
2778                 result_ok: false,
2779         }
2780 }
2781 #[no_mangle]
2782 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
2783 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2784         fn drop(&mut self) {
2785                 if self.result_ok {
2786                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2787                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2788                         }
2789                 } else {
2790                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2791                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2792                         }
2793                 }
2794         }
2795 }
2796 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2797         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
2798                 let contents = if o.result_ok {
2799                         let result = unsafe { o.contents.result };
2800                         unsafe { o.contents.result = std::ptr::null_mut() };
2801                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
2802                 } else {
2803                         let err = unsafe { o.contents.err };
2804                         unsafe { o.contents.err = std::ptr::null_mut(); }
2805                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
2806                 };
2807                 Self {
2808                         contents,
2809                         result_ok: o.result_ok,
2810                 }
2811         }
2812 }
2813 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2814         fn clone(&self) -> Self {
2815                 if self.result_ok {
2816                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2817                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
2818                         } }
2819                 } else {
2820                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2821                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2822                         } }
2823                 }
2824         }
2825 }
2826 #[no_mangle]
2827 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
2828 #[repr(C)]
2829 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
2830         pub result: *mut crate::ln::msgs::QueryShortChannelIds,
2831         pub err: *mut crate::ln::msgs::DecodeError,
2832 }
2833 #[repr(C)]
2834 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
2835         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
2836         pub result_ok: bool,
2837 }
2838 #[no_mangle]
2839 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
2840         CResult_QueryShortChannelIdsDecodeErrorZ {
2841                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2842                         result: Box::into_raw(Box::new(o)),
2843                 },
2844                 result_ok: true,
2845         }
2846 }
2847 #[no_mangle]
2848 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
2849         CResult_QueryShortChannelIdsDecodeErrorZ {
2850                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2851                         err: Box::into_raw(Box::new(e)),
2852                 },
2853                 result_ok: false,
2854         }
2855 }
2856 #[no_mangle]
2857 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
2858 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
2859         fn drop(&mut self) {
2860                 if self.result_ok {
2861                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2862                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2863                         }
2864                 } else {
2865                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2866                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2867                         }
2868                 }
2869         }
2870 }
2871 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
2872         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
2873                 let contents = if o.result_ok {
2874                         let result = unsafe { o.contents.result };
2875                         unsafe { o.contents.result = std::ptr::null_mut() };
2876                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
2877                 } else {
2878                         let err = unsafe { o.contents.err };
2879                         unsafe { o.contents.err = std::ptr::null_mut(); }
2880                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
2881                 };
2882                 Self {
2883                         contents,
2884                         result_ok: o.result_ok,
2885                 }
2886         }
2887 }
2888 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
2889         fn clone(&self) -> Self {
2890                 if self.result_ok {
2891                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2892                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
2893                         } }
2894                 } else {
2895                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2896                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2897                         } }
2898                 }
2899         }
2900 }
2901 #[no_mangle]
2902 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
2903 #[repr(C)]
2904 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2905         pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
2906         pub err: *mut crate::ln::msgs::DecodeError,
2907 }
2908 #[repr(C)]
2909 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2910         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
2911         pub result_ok: bool,
2912 }
2913 #[no_mangle]
2914 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2915         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2916                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2917                         result: Box::into_raw(Box::new(o)),
2918                 },
2919                 result_ok: true,
2920         }
2921 }
2922 #[no_mangle]
2923 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2924         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2925                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2926                         err: Box::into_raw(Box::new(e)),
2927                 },
2928                 result_ok: false,
2929         }
2930 }
2931 #[no_mangle]
2932 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
2933 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2934         fn drop(&mut self) {
2935                 if self.result_ok {
2936                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2937                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2938                         }
2939                 } else {
2940                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2941                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2942                         }
2943                 }
2944         }
2945 }
2946 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2947         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
2948                 let contents = if o.result_ok {
2949                         let result = unsafe { o.contents.result };
2950                         unsafe { o.contents.result = std::ptr::null_mut() };
2951                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
2952                 } else {
2953                         let err = unsafe { o.contents.err };
2954                         unsafe { o.contents.err = std::ptr::null_mut(); }
2955                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
2956                 };
2957                 Self {
2958                         contents,
2959                         result_ok: o.result_ok,
2960                 }
2961         }
2962 }
2963 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2964         fn clone(&self) -> Self {
2965                 if self.result_ok {
2966                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2967                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
2968                         } }
2969                 } else {
2970                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2971                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2972                         } }
2973                 }
2974         }
2975 }
2976 #[no_mangle]
2977 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
2978 #[repr(C)]
2979 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
2980         pub result: *mut crate::ln::msgs::QueryChannelRange,
2981         pub err: *mut crate::ln::msgs::DecodeError,
2982 }
2983 #[repr(C)]
2984 pub struct CResult_QueryChannelRangeDecodeErrorZ {
2985         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
2986         pub result_ok: bool,
2987 }
2988 #[no_mangle]
2989 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
2990         CResult_QueryChannelRangeDecodeErrorZ {
2991                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
2992                         result: Box::into_raw(Box::new(o)),
2993                 },
2994                 result_ok: true,
2995         }
2996 }
2997 #[no_mangle]
2998 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
2999         CResult_QueryChannelRangeDecodeErrorZ {
3000                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
3001                         err: Box::into_raw(Box::new(e)),
3002                 },
3003                 result_ok: false,
3004         }
3005 }
3006 #[no_mangle]
3007 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
3008 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
3009         fn drop(&mut self) {
3010                 if self.result_ok {
3011                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3012                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3013                         }
3014                 } else {
3015                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3016                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3017                         }
3018                 }
3019         }
3020 }
3021 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
3022         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
3023                 let contents = if o.result_ok {
3024                         let result = unsafe { o.contents.result };
3025                         unsafe { o.contents.result = std::ptr::null_mut() };
3026                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
3027                 } else {
3028                         let err = unsafe { o.contents.err };
3029                         unsafe { o.contents.err = std::ptr::null_mut(); }
3030                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
3031                 };
3032                 Self {
3033                         contents,
3034                         result_ok: o.result_ok,
3035                 }
3036         }
3037 }
3038 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
3039         fn clone(&self) -> Self {
3040                 if self.result_ok {
3041                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
3042                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
3043                         } }
3044                 } else {
3045                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
3046                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3047                         } }
3048                 }
3049         }
3050 }
3051 #[no_mangle]
3052 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
3053 #[repr(C)]
3054 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
3055         pub result: *mut crate::ln::msgs::ReplyChannelRange,
3056         pub err: *mut crate::ln::msgs::DecodeError,
3057 }
3058 #[repr(C)]
3059 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
3060         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
3061         pub result_ok: bool,
3062 }
3063 #[no_mangle]
3064 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
3065         CResult_ReplyChannelRangeDecodeErrorZ {
3066                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3067                         result: Box::into_raw(Box::new(o)),
3068                 },
3069                 result_ok: true,
3070         }
3071 }
3072 #[no_mangle]
3073 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
3074         CResult_ReplyChannelRangeDecodeErrorZ {
3075                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3076                         err: Box::into_raw(Box::new(e)),
3077                 },
3078                 result_ok: false,
3079         }
3080 }
3081 #[no_mangle]
3082 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
3083 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
3084         fn drop(&mut self) {
3085                 if self.result_ok {
3086                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3087                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3088                         }
3089                 } else {
3090                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3091                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3092                         }
3093                 }
3094         }
3095 }
3096 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
3097         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
3098                 let contents = if o.result_ok {
3099                         let result = unsafe { o.contents.result };
3100                         unsafe { o.contents.result = std::ptr::null_mut() };
3101                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
3102                 } else {
3103                         let err = unsafe { o.contents.err };
3104                         unsafe { o.contents.err = std::ptr::null_mut(); }
3105                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
3106                 };
3107                 Self {
3108                         contents,
3109                         result_ok: o.result_ok,
3110                 }
3111         }
3112 }
3113 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
3114         fn clone(&self) -> Self {
3115                 if self.result_ok {
3116                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3117                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
3118                         } }
3119                 } else {
3120                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3121                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3122                         } }
3123                 }
3124         }
3125 }
3126 #[no_mangle]
3127 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
3128 #[repr(C)]
3129 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
3130         pub result: *mut crate::ln::msgs::GossipTimestampFilter,
3131         pub err: *mut crate::ln::msgs::DecodeError,
3132 }
3133 #[repr(C)]
3134 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
3135         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
3136         pub result_ok: bool,
3137 }
3138 #[no_mangle]
3139 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
3140         CResult_GossipTimestampFilterDecodeErrorZ {
3141                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3142                         result: Box::into_raw(Box::new(o)),
3143                 },
3144                 result_ok: true,
3145         }
3146 }
3147 #[no_mangle]
3148 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
3149         CResult_GossipTimestampFilterDecodeErrorZ {
3150                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3151                         err: Box::into_raw(Box::new(e)),
3152                 },
3153                 result_ok: false,
3154         }
3155 }
3156 #[no_mangle]
3157 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
3158 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
3159         fn drop(&mut self) {
3160                 if self.result_ok {
3161                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3162                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3163                         }
3164                 } else {
3165                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3166                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3167                         }
3168                 }
3169         }
3170 }
3171 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
3172         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
3173                 let contents = if o.result_ok {
3174                         let result = unsafe { o.contents.result };
3175                         unsafe { o.contents.result = std::ptr::null_mut() };
3176                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
3177                 } else {
3178                         let err = unsafe { o.contents.err };
3179                         unsafe { o.contents.err = std::ptr::null_mut(); }
3180                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
3181                 };
3182                 Self {
3183                         contents,
3184                         result_ok: o.result_ok,
3185                 }
3186         }
3187 }
3188 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
3189         fn clone(&self) -> Self {
3190                 if self.result_ok {
3191                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3192                                 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
3193                         } }
3194                 } else {
3195                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3196                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3197                         } }
3198                 }
3199         }
3200 }
3201 #[no_mangle]
3202 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
3203 #[repr(C)]
3204 pub struct CVec_PublicKeyZ {
3205         pub data: *mut crate::c_types::PublicKey,
3206         pub datalen: usize
3207 }
3208 impl CVec_PublicKeyZ {
3209         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3210                 if self.datalen == 0 { return Vec::new(); }
3211                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3212                 self.data = std::ptr::null_mut();
3213                 self.datalen = 0;
3214                 ret
3215         }
3216         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3217                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3218         }
3219 }
3220 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3221         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3222                 let datalen = v.len();
3223                 let data = Box::into_raw(v.into_boxed_slice());
3224                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3225         }
3226 }
3227 #[no_mangle]
3228 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3229 impl Drop for CVec_PublicKeyZ {
3230         fn drop(&mut self) {
3231                 if self.datalen == 0 { return; }
3232                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3233         }
3234 }
3235 #[repr(C)]
3236 pub struct CVec_u8Z {
3237         pub data: *mut u8,
3238         pub datalen: usize
3239 }
3240 impl CVec_u8Z {
3241         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3242                 if self.datalen == 0 { return Vec::new(); }
3243                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3244                 self.data = std::ptr::null_mut();
3245                 self.datalen = 0;
3246                 ret
3247         }
3248         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3249                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3250         }
3251 }
3252 impl From<Vec<u8>> for CVec_u8Z {
3253         fn from(v: Vec<u8>) -> Self {
3254                 let datalen = v.len();
3255                 let data = Box::into_raw(v.into_boxed_slice());
3256                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3257         }
3258 }
3259 #[no_mangle]
3260 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3261 impl Drop for CVec_u8Z {
3262         fn drop(&mut self) {
3263                 if self.datalen == 0 { return; }
3264                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3265         }
3266 }
3267 impl Clone for CVec_u8Z {
3268         fn clone(&self) -> Self {
3269                 let mut res = Vec::new();
3270                 if self.datalen == 0 { return Self::from(res); }
3271                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3272                 Self::from(res)
3273         }
3274 }
3275 #[repr(C)]
3276 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
3277         pub result: *mut crate::c_types::derived::CVec_u8Z,
3278         pub err: *mut crate::ln::peer_handler::PeerHandleError,
3279 }
3280 #[repr(C)]
3281 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
3282         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
3283         pub result_ok: bool,
3284 }
3285 #[no_mangle]
3286 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
3287         CResult_CVec_u8ZPeerHandleErrorZ {
3288                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3289                         result: Box::into_raw(Box::new(o)),
3290                 },
3291                 result_ok: true,
3292         }
3293 }
3294 #[no_mangle]
3295 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
3296         CResult_CVec_u8ZPeerHandleErrorZ {
3297                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3298                         err: Box::into_raw(Box::new(e)),
3299                 },
3300                 result_ok: false,
3301         }
3302 }
3303 #[no_mangle]
3304 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
3305 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
3306         fn drop(&mut self) {
3307                 if self.result_ok {
3308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3310                         }
3311                 } else {
3312                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3313                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3314                         }
3315                 }
3316         }
3317 }
3318 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
3319         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
3320                 let contents = if o.result_ok {
3321                         let result = unsafe { o.contents.result };
3322                         unsafe { o.contents.result = std::ptr::null_mut() };
3323                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
3324                 } else {
3325                         let err = unsafe { o.contents.err };
3326                         unsafe { o.contents.err = std::ptr::null_mut(); }
3327                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
3328                 };
3329                 Self {
3330                         contents,
3331                         result_ok: o.result_ok,
3332                 }
3333         }
3334 }
3335 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
3336         fn clone(&self) -> Self {
3337                 if self.result_ok {
3338                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3339                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3340                         } }
3341                 } else {
3342                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3343                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3344                         } }
3345                 }
3346         }
3347 }
3348 #[no_mangle]
3349 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
3350 #[repr(C)]
3351 pub union CResult_NonePeerHandleErrorZPtr {
3352         /// Note that this value is always NULL, as there are no contents in the OK variant
3353         pub result: *mut std::ffi::c_void,
3354         pub err: *mut crate::ln::peer_handler::PeerHandleError,
3355 }
3356 #[repr(C)]
3357 pub struct CResult_NonePeerHandleErrorZ {
3358         pub contents: CResult_NonePeerHandleErrorZPtr,
3359         pub result_ok: bool,
3360 }
3361 #[no_mangle]
3362 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
3363         CResult_NonePeerHandleErrorZ {
3364                 contents: CResult_NonePeerHandleErrorZPtr {
3365                         result: std::ptr::null_mut(),
3366                 },
3367                 result_ok: true,
3368         }
3369 }
3370 #[no_mangle]
3371 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
3372         CResult_NonePeerHandleErrorZ {
3373                 contents: CResult_NonePeerHandleErrorZPtr {
3374                         err: Box::into_raw(Box::new(e)),
3375                 },
3376                 result_ok: false,
3377         }
3378 }
3379 #[no_mangle]
3380 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
3381 impl Drop for CResult_NonePeerHandleErrorZ {
3382         fn drop(&mut self) {
3383                 if self.result_ok {
3384                 } else {
3385                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3386                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3387                         }
3388                 }
3389         }
3390 }
3391 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
3392         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
3393                 let contents = if o.result_ok {
3394                         let _ = unsafe { Box::from_raw(o.contents.result) };
3395                         o.contents.result = std::ptr::null_mut();
3396                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
3397                 } else {
3398                         let err = unsafe { o.contents.err };
3399                         unsafe { o.contents.err = std::ptr::null_mut(); }
3400                         CResult_NonePeerHandleErrorZPtr { err }
3401                 };
3402                 Self {
3403                         contents,
3404                         result_ok: o.result_ok,
3405                 }
3406         }
3407 }
3408 impl Clone for CResult_NonePeerHandleErrorZ {
3409         fn clone(&self) -> Self {
3410                 if self.result_ok {
3411                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
3412                                 result: std::ptr::null_mut()
3413                         } }
3414                 } else {
3415                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
3416                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3417                         } }
3418                 }
3419         }
3420 }
3421 #[no_mangle]
3422 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
3423 #[repr(C)]
3424 pub union CResult_boolPeerHandleErrorZPtr {
3425         pub result: *mut bool,
3426         pub err: *mut crate::ln::peer_handler::PeerHandleError,
3427 }
3428 #[repr(C)]
3429 pub struct CResult_boolPeerHandleErrorZ {
3430         pub contents: CResult_boolPeerHandleErrorZPtr,
3431         pub result_ok: bool,
3432 }
3433 #[no_mangle]
3434 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
3435         CResult_boolPeerHandleErrorZ {
3436                 contents: CResult_boolPeerHandleErrorZPtr {
3437                         result: Box::into_raw(Box::new(o)),
3438                 },
3439                 result_ok: true,
3440         }
3441 }
3442 #[no_mangle]
3443 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
3444         CResult_boolPeerHandleErrorZ {
3445                 contents: CResult_boolPeerHandleErrorZPtr {
3446                         err: Box::into_raw(Box::new(e)),
3447                 },
3448                 result_ok: false,
3449         }
3450 }
3451 #[no_mangle]
3452 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
3453 impl Drop for CResult_boolPeerHandleErrorZ {
3454         fn drop(&mut self) {
3455                 if self.result_ok {
3456                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3457                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3458                         }
3459                 } else {
3460                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3461                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3462                         }
3463                 }
3464         }
3465 }
3466 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
3467         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
3468                 let contents = if o.result_ok {
3469                         let result = unsafe { o.contents.result };
3470                         unsafe { o.contents.result = std::ptr::null_mut() };
3471                         CResult_boolPeerHandleErrorZPtr { result }
3472                 } else {
3473                         let err = unsafe { o.contents.err };
3474                         unsafe { o.contents.err = std::ptr::null_mut(); }
3475                         CResult_boolPeerHandleErrorZPtr { err }
3476                 };
3477                 Self {
3478                         contents,
3479                         result_ok: o.result_ok,
3480                 }
3481         }
3482 }
3483 impl Clone for CResult_boolPeerHandleErrorZ {
3484         fn clone(&self) -> Self {
3485                 if self.result_ok {
3486                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
3487                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
3488                         } }
3489                 } else {
3490                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
3491                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3492                         } }
3493                 }
3494         }
3495 }
3496 #[no_mangle]
3497 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
3498 #[repr(C)]
3499 pub union CResult_SecretKeySecpErrorZPtr {
3500         pub result: *mut crate::c_types::SecretKey,
3501         pub err: *mut crate::c_types::Secp256k1Error,
3502 }
3503 #[repr(C)]
3504 pub struct CResult_SecretKeySecpErrorZ {
3505         pub contents: CResult_SecretKeySecpErrorZPtr,
3506         pub result_ok: bool,
3507 }
3508 #[no_mangle]
3509 pub extern "C" fn CResult_SecretKeySecpErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeySecpErrorZ {
3510         CResult_SecretKeySecpErrorZ {
3511                 contents: CResult_SecretKeySecpErrorZPtr {
3512                         result: Box::into_raw(Box::new(o)),
3513                 },
3514                 result_ok: true,
3515         }
3516 }
3517 #[no_mangle]
3518 pub extern "C" fn CResult_SecretKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeySecpErrorZ {
3519         CResult_SecretKeySecpErrorZ {
3520                 contents: CResult_SecretKeySecpErrorZPtr {
3521                         err: Box::into_raw(Box::new(e)),
3522                 },
3523                 result_ok: false,
3524         }
3525 }
3526 #[no_mangle]
3527 pub extern "C" fn CResult_SecretKeySecpErrorZ_free(_res: CResult_SecretKeySecpErrorZ) { }
3528 impl Drop for CResult_SecretKeySecpErrorZ {
3529         fn drop(&mut self) {
3530                 if self.result_ok {
3531                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3532                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3533                         }
3534                 } else {
3535                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3536                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3537                         }
3538                 }
3539         }
3540 }
3541 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeySecpErrorZ {
3542         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
3543                 let contents = if o.result_ok {
3544                         let result = unsafe { o.contents.result };
3545                         unsafe { o.contents.result = std::ptr::null_mut() };
3546                         CResult_SecretKeySecpErrorZPtr { result }
3547                 } else {
3548                         let err = unsafe { o.contents.err };
3549                         unsafe { o.contents.err = std::ptr::null_mut(); }
3550                         CResult_SecretKeySecpErrorZPtr { err }
3551                 };
3552                 Self {
3553                         contents,
3554                         result_ok: o.result_ok,
3555                 }
3556         }
3557 }
3558 #[repr(C)]
3559 pub union CResult_PublicKeySecpErrorZPtr {
3560         pub result: *mut crate::c_types::PublicKey,
3561         pub err: *mut crate::c_types::Secp256k1Error,
3562 }
3563 #[repr(C)]
3564 pub struct CResult_PublicKeySecpErrorZ {
3565         pub contents: CResult_PublicKeySecpErrorZPtr,
3566         pub result_ok: bool,
3567 }
3568 #[no_mangle]
3569 pub extern "C" fn CResult_PublicKeySecpErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecpErrorZ {
3570         CResult_PublicKeySecpErrorZ {
3571                 contents: CResult_PublicKeySecpErrorZPtr {
3572                         result: Box::into_raw(Box::new(o)),
3573                 },
3574                 result_ok: true,
3575         }
3576 }
3577 #[no_mangle]
3578 pub extern "C" fn CResult_PublicKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecpErrorZ {
3579         CResult_PublicKeySecpErrorZ {
3580                 contents: CResult_PublicKeySecpErrorZPtr {
3581                         err: Box::into_raw(Box::new(e)),
3582                 },
3583                 result_ok: false,
3584         }
3585 }
3586 #[no_mangle]
3587 pub extern "C" fn CResult_PublicKeySecpErrorZ_free(_res: CResult_PublicKeySecpErrorZ) { }
3588 impl Drop for CResult_PublicKeySecpErrorZ {
3589         fn drop(&mut self) {
3590                 if self.result_ok {
3591                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3592                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3593                         }
3594                 } else {
3595                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3596                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3597                         }
3598                 }
3599         }
3600 }
3601 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecpErrorZ {
3602         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
3603                 let contents = if o.result_ok {
3604                         let result = unsafe { o.contents.result };
3605                         unsafe { o.contents.result = std::ptr::null_mut() };
3606                         CResult_PublicKeySecpErrorZPtr { result }
3607                 } else {
3608                         let err = unsafe { o.contents.err };
3609                         unsafe { o.contents.err = std::ptr::null_mut(); }
3610                         CResult_PublicKeySecpErrorZPtr { err }
3611                 };
3612                 Self {
3613                         contents,
3614                         result_ok: o.result_ok,
3615                 }
3616         }
3617 }
3618 #[repr(C)]
3619 pub union CResult_TxCreationKeysSecpErrorZPtr {
3620         pub result: *mut crate::ln::chan_utils::TxCreationKeys,
3621         pub err: *mut crate::c_types::Secp256k1Error,
3622 }
3623 #[repr(C)]
3624 pub struct CResult_TxCreationKeysSecpErrorZ {
3625         pub contents: CResult_TxCreationKeysSecpErrorZPtr,
3626         pub result_ok: bool,
3627 }
3628 #[no_mangle]
3629 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysSecpErrorZ {
3630         CResult_TxCreationKeysSecpErrorZ {
3631                 contents: CResult_TxCreationKeysSecpErrorZPtr {
3632                         result: Box::into_raw(Box::new(o)),
3633                 },
3634                 result_ok: true,
3635         }
3636 }
3637 #[no_mangle]
3638 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysSecpErrorZ {
3639         CResult_TxCreationKeysSecpErrorZ {
3640                 contents: CResult_TxCreationKeysSecpErrorZPtr {
3641                         err: Box::into_raw(Box::new(e)),
3642                 },
3643                 result_ok: false,
3644         }
3645 }
3646 #[no_mangle]
3647 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_free(_res: CResult_TxCreationKeysSecpErrorZ) { }
3648 impl Drop for CResult_TxCreationKeysSecpErrorZ {
3649         fn drop(&mut self) {
3650                 if self.result_ok {
3651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3653                         }
3654                 } else {
3655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3657                         }
3658                 }
3659         }
3660 }
3661 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysSecpErrorZ {
3662         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
3663                 let contents = if o.result_ok {
3664                         let result = unsafe { o.contents.result };
3665                         unsafe { o.contents.result = std::ptr::null_mut() };
3666                         CResult_TxCreationKeysSecpErrorZPtr { result }
3667                 } else {
3668                         let err = unsafe { o.contents.err };
3669                         unsafe { o.contents.err = std::ptr::null_mut(); }
3670                         CResult_TxCreationKeysSecpErrorZPtr { err }
3671                 };
3672                 Self {
3673                         contents,
3674                         result_ok: o.result_ok,
3675                 }
3676         }
3677 }
3678 #[repr(C)]
3679 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
3680         pub result: *mut crate::ln::chan_utils::TrustedCommitmentTransaction,
3681         /// Note that this value is always NULL, as there are no contents in the Err variant
3682         pub err: *mut std::ffi::c_void,
3683 }
3684 #[repr(C)]
3685 pub struct CResult_TrustedCommitmentTransactionNoneZ {
3686         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
3687         pub result_ok: bool,
3688 }
3689 #[no_mangle]
3690 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
3691         CResult_TrustedCommitmentTransactionNoneZ {
3692                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
3693                         result: Box::into_raw(Box::new(o)),
3694                 },
3695                 result_ok: true,
3696         }
3697 }
3698 #[no_mangle]
3699 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
3700         CResult_TrustedCommitmentTransactionNoneZ {
3701                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
3702                         err: std::ptr::null_mut(),
3703                 },
3704                 result_ok: false,
3705         }
3706 }
3707 #[no_mangle]
3708 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
3709 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
3710         fn drop(&mut self) {
3711                 if self.result_ok {
3712                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3713                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3714                         }
3715                 } else {
3716                 }
3717         }
3718 }
3719 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
3720         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> Self {
3721                 let contents = if o.result_ok {
3722                         let result = unsafe { o.contents.result };
3723                         unsafe { o.contents.result = std::ptr::null_mut() };
3724                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
3725                 } else {
3726                         let _ = unsafe { Box::from_raw(o.contents.err) };
3727                         o.contents.err = std::ptr::null_mut();
3728                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
3729                 };
3730                 Self {
3731                         contents,
3732                         result_ok: o.result_ok,
3733                 }
3734         }
3735 }
3736 #[repr(C)]
3737 pub union CResult_CVec_SignatureZNoneZPtr {
3738         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
3739         /// Note that this value is always NULL, as there are no contents in the Err variant
3740         pub err: *mut std::ffi::c_void,
3741 }
3742 #[repr(C)]
3743 pub struct CResult_CVec_SignatureZNoneZ {
3744         pub contents: CResult_CVec_SignatureZNoneZPtr,
3745         pub result_ok: bool,
3746 }
3747 #[no_mangle]
3748 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
3749         CResult_CVec_SignatureZNoneZ {
3750                 contents: CResult_CVec_SignatureZNoneZPtr {
3751                         result: Box::into_raw(Box::new(o)),
3752                 },
3753                 result_ok: true,
3754         }
3755 }
3756 #[no_mangle]
3757 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
3758         CResult_CVec_SignatureZNoneZ {
3759                 contents: CResult_CVec_SignatureZNoneZPtr {
3760                         err: std::ptr::null_mut(),
3761                 },
3762                 result_ok: false,
3763         }
3764 }
3765 #[no_mangle]
3766 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
3767 impl Drop for CResult_CVec_SignatureZNoneZ {
3768         fn drop(&mut self) {
3769                 if self.result_ok {
3770                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3771                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3772                         }
3773                 } else {
3774                 }
3775         }
3776 }
3777 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>> for CResult_CVec_SignatureZNoneZ {
3778         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> Self {
3779                 let contents = if o.result_ok {
3780                         let result = unsafe { o.contents.result };
3781                         unsafe { o.contents.result = std::ptr::null_mut() };
3782                         CResult_CVec_SignatureZNoneZPtr { result }
3783                 } else {
3784                         let _ = unsafe { Box::from_raw(o.contents.err) };
3785                         o.contents.err = std::ptr::null_mut();
3786                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
3787                 };
3788                 Self {
3789                         contents,
3790                         result_ok: o.result_ok,
3791                 }
3792         }
3793 }
3794 impl Clone for CResult_CVec_SignatureZNoneZ {
3795         fn clone(&self) -> Self {
3796                 if self.result_ok {
3797                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
3798                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
3799                         } }
3800                 } else {
3801                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
3802                                 err: std::ptr::null_mut()
3803                         } }
3804                 }
3805         }
3806 }
3807 #[no_mangle]
3808 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
3809 #[repr(C)]
3810 pub struct CVec_RouteHopZ {
3811         pub data: *mut crate::routing::router::RouteHop,
3812         pub datalen: usize
3813 }
3814 impl CVec_RouteHopZ {
3815         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
3816                 if self.datalen == 0 { return Vec::new(); }
3817                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3818                 self.data = std::ptr::null_mut();
3819                 self.datalen = 0;
3820                 ret
3821         }
3822         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
3823                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3824         }
3825 }
3826 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
3827         fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
3828                 let datalen = v.len();
3829                 let data = Box::into_raw(v.into_boxed_slice());
3830                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3831         }
3832 }
3833 #[no_mangle]
3834 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3835 impl Drop for CVec_RouteHopZ {
3836         fn drop(&mut self) {
3837                 if self.datalen == 0 { return; }
3838                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3839         }
3840 }
3841 impl Clone for CVec_RouteHopZ {
3842         fn clone(&self) -> Self {
3843                 let mut res = Vec::new();
3844                 if self.datalen == 0 { return Self::from(res); }
3845                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3846                 Self::from(res)
3847         }
3848 }
3849 #[repr(C)]
3850 pub struct CVec_CVec_RouteHopZZ {
3851         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3852         pub datalen: usize
3853 }
3854 impl CVec_CVec_RouteHopZZ {
3855         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3856                 if self.datalen == 0 { return Vec::new(); }
3857                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3858                 self.data = std::ptr::null_mut();
3859                 self.datalen = 0;
3860                 ret
3861         }
3862         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3863                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3864         }
3865 }
3866 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3867         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3868                 let datalen = v.len();
3869                 let data = Box::into_raw(v.into_boxed_slice());
3870                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3871         }
3872 }
3873 #[no_mangle]
3874 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3875 impl Drop for CVec_CVec_RouteHopZZ {
3876         fn drop(&mut self) {
3877                 if self.datalen == 0 { return; }
3878                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3879         }
3880 }
3881 impl Clone for CVec_CVec_RouteHopZZ {
3882         fn clone(&self) -> Self {
3883                 let mut res = Vec::new();
3884                 if self.datalen == 0 { return Self::from(res); }
3885                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3886                 Self::from(res)
3887         }
3888 }
3889 #[repr(C)]
3890 pub union CResult_RouteDecodeErrorZPtr {
3891         pub result: *mut crate::routing::router::Route,
3892         pub err: *mut crate::ln::msgs::DecodeError,
3893 }
3894 #[repr(C)]
3895 pub struct CResult_RouteDecodeErrorZ {
3896         pub contents: CResult_RouteDecodeErrorZPtr,
3897         pub result_ok: bool,
3898 }
3899 #[no_mangle]
3900 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3901         CResult_RouteDecodeErrorZ {
3902                 contents: CResult_RouteDecodeErrorZPtr {
3903                         result: Box::into_raw(Box::new(o)),
3904                 },
3905                 result_ok: true,
3906         }
3907 }
3908 #[no_mangle]
3909 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3910         CResult_RouteDecodeErrorZ {
3911                 contents: CResult_RouteDecodeErrorZPtr {
3912                         err: Box::into_raw(Box::new(e)),
3913                 },
3914                 result_ok: false,
3915         }
3916 }
3917 #[no_mangle]
3918 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3919 impl Drop for CResult_RouteDecodeErrorZ {
3920         fn drop(&mut self) {
3921                 if self.result_ok {
3922                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3923                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3924                         }
3925                 } else {
3926                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3927                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3928                         }
3929                 }
3930         }
3931 }
3932 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3933         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
3934                 let contents = if o.result_ok {
3935                         let result = unsafe { o.contents.result };
3936                         unsafe { o.contents.result = std::ptr::null_mut() };
3937                         CResult_RouteDecodeErrorZPtr { result }
3938                 } else {
3939                         let err = unsafe { o.contents.err };
3940                         unsafe { o.contents.err = std::ptr::null_mut(); }
3941                         CResult_RouteDecodeErrorZPtr { err }
3942                 };
3943                 Self {
3944                         contents,
3945                         result_ok: o.result_ok,
3946                 }
3947         }
3948 }
3949 impl Clone for CResult_RouteDecodeErrorZ {
3950         fn clone(&self) -> Self {
3951                 if self.result_ok {
3952                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3953                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3954                         } }
3955                 } else {
3956                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3957                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3958                         } }
3959                 }
3960         }
3961 }
3962 #[no_mangle]
3963 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3964 #[repr(C)]
3965 pub struct CVec_RouteHintZ {
3966         pub data: *mut crate::routing::router::RouteHint,
3967         pub datalen: usize
3968 }
3969 impl CVec_RouteHintZ {
3970         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
3971                 if self.datalen == 0 { return Vec::new(); }
3972                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3973                 self.data = std::ptr::null_mut();
3974                 self.datalen = 0;
3975                 ret
3976         }
3977         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
3978                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3979         }
3980 }
3981 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
3982         fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
3983                 let datalen = v.len();
3984                 let data = Box::into_raw(v.into_boxed_slice());
3985                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3986         }
3987 }
3988 #[no_mangle]
3989 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3990 impl Drop for CVec_RouteHintZ {
3991         fn drop(&mut self) {
3992                 if self.datalen == 0 { return; }
3993                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3994         }
3995 }
3996 impl Clone for CVec_RouteHintZ {
3997         fn clone(&self) -> Self {
3998                 let mut res = Vec::new();
3999                 if self.datalen == 0 { return Self::from(res); }
4000                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4001                 Self::from(res)
4002         }
4003 }
4004 #[repr(C)]
4005 pub union CResult_RouteLightningErrorZPtr {
4006         pub result: *mut crate::routing::router::Route,
4007         pub err: *mut crate::ln::msgs::LightningError,
4008 }
4009 #[repr(C)]
4010 pub struct CResult_RouteLightningErrorZ {
4011         pub contents: CResult_RouteLightningErrorZPtr,
4012         pub result_ok: bool,
4013 }
4014 #[no_mangle]
4015 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
4016         CResult_RouteLightningErrorZ {
4017                 contents: CResult_RouteLightningErrorZPtr {
4018                         result: Box::into_raw(Box::new(o)),
4019                 },
4020                 result_ok: true,
4021         }
4022 }
4023 #[no_mangle]
4024 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
4025         CResult_RouteLightningErrorZ {
4026                 contents: CResult_RouteLightningErrorZPtr {
4027                         err: Box::into_raw(Box::new(e)),
4028                 },
4029                 result_ok: false,
4030         }
4031 }
4032 #[no_mangle]
4033 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
4034 impl Drop for CResult_RouteLightningErrorZ {
4035         fn drop(&mut self) {
4036                 if self.result_ok {
4037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4039                         }
4040                 } else {
4041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4043                         }
4044                 }
4045         }
4046 }
4047 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
4048         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
4049                 let contents = if o.result_ok {
4050                         let result = unsafe { o.contents.result };
4051                         unsafe { o.contents.result = std::ptr::null_mut() };
4052                         CResult_RouteLightningErrorZPtr { result }
4053                 } else {
4054                         let err = unsafe { o.contents.err };
4055                         unsafe { o.contents.err = std::ptr::null_mut(); }
4056                         CResult_RouteLightningErrorZPtr { err }
4057                 };
4058                 Self {
4059                         contents,
4060                         result_ok: o.result_ok,
4061                 }
4062         }
4063 }
4064 impl Clone for CResult_RouteLightningErrorZ {
4065         fn clone(&self) -> Self {
4066                 if self.result_ok {
4067                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
4068                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4069                         } }
4070                 } else {
4071                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
4072                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4073                         } }
4074                 }
4075         }
4076 }
4077 #[no_mangle]
4078 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
4079 #[repr(C)]
4080 pub union CResult_RoutingFeesDecodeErrorZPtr {
4081         pub result: *mut crate::routing::network_graph::RoutingFees,
4082         pub err: *mut crate::ln::msgs::DecodeError,
4083 }
4084 #[repr(C)]
4085 pub struct CResult_RoutingFeesDecodeErrorZ {
4086         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
4087         pub result_ok: bool,
4088 }
4089 #[no_mangle]
4090 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
4091         CResult_RoutingFeesDecodeErrorZ {
4092                 contents: CResult_RoutingFeesDecodeErrorZPtr {
4093                         result: Box::into_raw(Box::new(o)),
4094                 },
4095                 result_ok: true,
4096         }
4097 }
4098 #[no_mangle]
4099 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
4100         CResult_RoutingFeesDecodeErrorZ {
4101                 contents: CResult_RoutingFeesDecodeErrorZPtr {
4102                         err: Box::into_raw(Box::new(e)),
4103                 },
4104                 result_ok: false,
4105         }
4106 }
4107 #[no_mangle]
4108 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
4109 impl Drop for CResult_RoutingFeesDecodeErrorZ {
4110         fn drop(&mut self) {
4111                 if self.result_ok {
4112                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4113                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4114                         }
4115                 } else {
4116                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4117                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4118                         }
4119                 }
4120         }
4121 }
4122 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
4123         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
4124                 let contents = if o.result_ok {
4125                         let result = unsafe { o.contents.result };
4126                         unsafe { o.contents.result = std::ptr::null_mut() };
4127                         CResult_RoutingFeesDecodeErrorZPtr { result }
4128                 } else {
4129                         let err = unsafe { o.contents.err };
4130                         unsafe { o.contents.err = std::ptr::null_mut(); }
4131                         CResult_RoutingFeesDecodeErrorZPtr { err }
4132                 };
4133                 Self {
4134                         contents,
4135                         result_ok: o.result_ok,
4136                 }
4137         }
4138 }
4139 impl Clone for CResult_RoutingFeesDecodeErrorZ {
4140         fn clone(&self) -> Self {
4141                 if self.result_ok {
4142                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
4143                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
4144                         } }
4145                 } else {
4146                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
4147                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4148                         } }
4149                 }
4150         }
4151 }
4152 #[no_mangle]
4153 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
4154 #[repr(C)]
4155 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4156         pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
4157         pub err: *mut crate::ln::msgs::DecodeError,
4158 }
4159 #[repr(C)]
4160 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
4161         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
4162         pub result_ok: bool,
4163 }
4164 #[no_mangle]
4165 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4166         CResult_NodeAnnouncementInfoDecodeErrorZ {
4167                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4168                         result: Box::into_raw(Box::new(o)),
4169                 },
4170                 result_ok: true,
4171         }
4172 }
4173 #[no_mangle]
4174 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4175         CResult_NodeAnnouncementInfoDecodeErrorZ {
4176                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4177                         err: Box::into_raw(Box::new(e)),
4178                 },
4179                 result_ok: false,
4180         }
4181 }
4182 #[no_mangle]
4183 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
4184 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
4185         fn drop(&mut self) {
4186                 if self.result_ok {
4187                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4188                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4189                         }
4190                 } else {
4191                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4192                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4193                         }
4194                 }
4195         }
4196 }
4197 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
4198         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
4199                 let contents = if o.result_ok {
4200                         let result = unsafe { o.contents.result };
4201                         unsafe { o.contents.result = std::ptr::null_mut() };
4202                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
4203                 } else {
4204                         let err = unsafe { o.contents.err };
4205                         unsafe { o.contents.err = std::ptr::null_mut(); }
4206                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
4207                 };
4208                 Self {
4209                         contents,
4210                         result_ok: o.result_ok,
4211                 }
4212         }
4213 }
4214 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
4215         fn clone(&self) -> Self {
4216                 if self.result_ok {
4217                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4218                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
4219                         } }
4220                 } else {
4221                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4222                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4223                         } }
4224                 }
4225         }
4226 }
4227 #[no_mangle]
4228 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
4229 #[repr(C)]
4230 pub union CResult_NodeInfoDecodeErrorZPtr {
4231         pub result: *mut crate::routing::network_graph::NodeInfo,
4232         pub err: *mut crate::ln::msgs::DecodeError,
4233 }
4234 #[repr(C)]
4235 pub struct CResult_NodeInfoDecodeErrorZ {
4236         pub contents: CResult_NodeInfoDecodeErrorZPtr,
4237         pub result_ok: bool,
4238 }
4239 #[no_mangle]
4240 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
4241         CResult_NodeInfoDecodeErrorZ {
4242                 contents: CResult_NodeInfoDecodeErrorZPtr {
4243                         result: Box::into_raw(Box::new(o)),
4244                 },
4245                 result_ok: true,
4246         }
4247 }
4248 #[no_mangle]
4249 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
4250         CResult_NodeInfoDecodeErrorZ {
4251                 contents: CResult_NodeInfoDecodeErrorZPtr {
4252                         err: Box::into_raw(Box::new(e)),
4253                 },
4254                 result_ok: false,
4255         }
4256 }
4257 #[no_mangle]
4258 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
4259 impl Drop for CResult_NodeInfoDecodeErrorZ {
4260         fn drop(&mut self) {
4261                 if self.result_ok {
4262                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4263                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4264                         }
4265                 } else {
4266                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4267                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4268                         }
4269                 }
4270         }
4271 }
4272 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
4273         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
4274                 let contents = if o.result_ok {
4275                         let result = unsafe { o.contents.result };
4276                         unsafe { o.contents.result = std::ptr::null_mut() };
4277                         CResult_NodeInfoDecodeErrorZPtr { result }
4278                 } else {
4279                         let err = unsafe { o.contents.err };
4280                         unsafe { o.contents.err = std::ptr::null_mut(); }
4281                         CResult_NodeInfoDecodeErrorZPtr { err }
4282                 };
4283                 Self {
4284                         contents,
4285                         result_ok: o.result_ok,
4286                 }
4287         }
4288 }
4289 impl Clone for CResult_NodeInfoDecodeErrorZ {
4290         fn clone(&self) -> Self {
4291                 if self.result_ok {
4292                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
4293                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
4294                         } }
4295                 } else {
4296                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
4297                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4298                         } }
4299                 }
4300         }
4301 }
4302 #[no_mangle]
4303 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
4304 #[repr(C)]
4305 pub union CResult_NetworkGraphDecodeErrorZPtr {
4306         pub result: *mut crate::routing::network_graph::NetworkGraph,
4307         pub err: *mut crate::ln::msgs::DecodeError,
4308 }
4309 #[repr(C)]
4310 pub struct CResult_NetworkGraphDecodeErrorZ {
4311         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
4312         pub result_ok: bool,
4313 }
4314 #[no_mangle]
4315 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
4316         CResult_NetworkGraphDecodeErrorZ {
4317                 contents: CResult_NetworkGraphDecodeErrorZPtr {
4318                         result: Box::into_raw(Box::new(o)),
4319                 },
4320                 result_ok: true,
4321         }
4322 }
4323 #[no_mangle]
4324 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
4325         CResult_NetworkGraphDecodeErrorZ {
4326                 contents: CResult_NetworkGraphDecodeErrorZPtr {
4327                         err: Box::into_raw(Box::new(e)),
4328                 },
4329                 result_ok: false,
4330         }
4331 }
4332 #[no_mangle]
4333 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
4334 impl Drop for CResult_NetworkGraphDecodeErrorZ {
4335         fn drop(&mut self) {
4336                 if self.result_ok {
4337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4339                         }
4340                 } else {
4341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4343                         }
4344                 }
4345         }
4346 }
4347 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
4348         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
4349                 let contents = if o.result_ok {
4350                         let result = unsafe { o.contents.result };
4351                         unsafe { o.contents.result = std::ptr::null_mut() };
4352                         CResult_NetworkGraphDecodeErrorZPtr { result }
4353                 } else {
4354                         let err = unsafe { o.contents.err };
4355                         unsafe { o.contents.err = std::ptr::null_mut(); }
4356                         CResult_NetworkGraphDecodeErrorZPtr { err }
4357                 };
4358                 Self {
4359                         contents,
4360                         result_ok: o.result_ok,
4361                 }
4362         }
4363 }