- bindings updates
[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 #[repr(C)]
74 pub struct CVec_EventZ {
75         pub data: *mut crate::util::events::Event,
76         pub datalen: usize
77 }
78 impl CVec_EventZ {
79         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
80                 if self.datalen == 0 { return Vec::new(); }
81                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
82                 self.data = std::ptr::null_mut();
83                 self.datalen = 0;
84                 ret
85         }
86         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
87                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
88         }
89 }
90 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
91         fn from(v: Vec<crate::util::events::Event>) -> Self {
92                 let datalen = v.len();
93                 let data = Box::into_raw(v.into_boxed_slice());
94                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
95         }
96 }
97 #[no_mangle]
98 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
99 impl Drop for CVec_EventZ {
100         fn drop(&mut self) {
101                 if self.datalen == 0 { return; }
102                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
103         }
104 }
105 pub type C2Tuple_usizeTransactionZ = crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>;
106 #[no_mangle]
107 pub static C2Tuple_usizeTransactionZ_free: extern "C" fn(C2Tuple_usizeTransactionZ) = crate::c_types::C2TupleTempl_free::<usize, crate::c_types::Transaction>;
108 #[no_mangle]
109 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
110         C2Tuple_usizeTransactionZ { a, b, }
111 }
112
113 #[repr(C)]
114 pub struct CVec_C2Tuple_usizeTransactionZZ {
115         pub data: *mut crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>,
116         pub datalen: usize
117 }
118 impl CVec_C2Tuple_usizeTransactionZZ {
119         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>> {
120                 if self.datalen == 0 { return Vec::new(); }
121                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
122                 self.data = std::ptr::null_mut();
123                 self.datalen = 0;
124                 ret
125         }
126         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>] {
127                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
128         }
129 }
130 impl From<Vec<crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>>> for CVec_C2Tuple_usizeTransactionZZ {
131         fn from(v: Vec<crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>>) -> Self {
132                 let datalen = v.len();
133                 let data = Box::into_raw(v.into_boxed_slice());
134                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
135         }
136 }
137 #[no_mangle]
138 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
139 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
140         fn drop(&mut self) {
141                 if self.datalen == 0 { return; }
142                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
143         }
144 }
145 #[repr(C)]
146 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
147         /// Note that this value is always NULL, as there are no contents in the OK variant
148         pub result: *mut std::ffi::c_void,
149         pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
150 }
151 #[repr(C)]
152 pub struct CResult_NoneChannelMonitorUpdateErrZ {
153         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
154         pub result_ok: bool,
155 }
156 #[no_mangle]
157 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
158         CResult_NoneChannelMonitorUpdateErrZ {
159                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
160                         result: std::ptr::null_mut(),
161                 },
162                 result_ok: true,
163         }
164 }
165 #[no_mangle]
166 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
167         CResult_NoneChannelMonitorUpdateErrZ {
168                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
169                         err: Box::into_raw(Box::new(e)),
170                 },
171                 result_ok: false,
172         }
173 }
174 #[no_mangle]
175 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
176 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
177         fn drop(&mut self) {
178                 if self.result_ok {
179                 } else {
180                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
181                                 let _ = unsafe { Box::from_raw(self.contents.err) };
182                         }
183                 }
184         }
185 }
186 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
187         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
188                 let contents = if o.result_ok {
189                         let _ = unsafe { Box::from_raw(o.contents.result) };
190                         o.contents.result = std::ptr::null_mut();
191                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
192                 } else {
193                         let err = unsafe { o.contents.err };
194                         unsafe { o.contents.err = std::ptr::null_mut(); }
195                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
196                 };
197                 Self {
198                         contents,
199                         result_ok: o.result_ok,
200                 }
201         }
202 }
203 #[repr(C)]
204 pub struct CVec_MonitorEventZ {
205         pub data: *mut crate::chain::channelmonitor::MonitorEvent,
206         pub datalen: usize
207 }
208 impl CVec_MonitorEventZ {
209         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
210                 if self.datalen == 0 { return Vec::new(); }
211                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
212                 self.data = std::ptr::null_mut();
213                 self.datalen = 0;
214                 ret
215         }
216         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
217                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
218         }
219 }
220 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
221         fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
222                 let datalen = v.len();
223                 let data = Box::into_raw(v.into_boxed_slice());
224                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
225         }
226 }
227 #[no_mangle]
228 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
229 impl Drop for CVec_MonitorEventZ {
230         fn drop(&mut self) {
231                 if self.datalen == 0 { return; }
232                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
233         }
234 }
235 #[repr(C)]
236 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
237         pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
238         pub err: *mut crate::ln::msgs::DecodeError,
239 }
240 #[repr(C)]
241 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
242         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
243         pub result_ok: bool,
244 }
245 #[no_mangle]
246 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
247         CResult_ChannelMonitorUpdateDecodeErrorZ {
248                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
249                         result: Box::into_raw(Box::new(o)),
250                 },
251                 result_ok: true,
252         }
253 }
254 #[no_mangle]
255 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
256         CResult_ChannelMonitorUpdateDecodeErrorZ {
257                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
258                         err: Box::into_raw(Box::new(e)),
259                 },
260                 result_ok: false,
261         }
262 }
263 #[no_mangle]
264 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
265 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
266         fn drop(&mut self) {
267                 if self.result_ok {
268                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
269                                 let _ = unsafe { Box::from_raw(self.contents.result) };
270                         }
271                 } else {
272                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
273                                 let _ = unsafe { Box::from_raw(self.contents.err) };
274                         }
275                 }
276         }
277 }
278 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
279         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
280                 let contents = if o.result_ok {
281                         let result = unsafe { o.contents.result };
282                         unsafe { o.contents.result = std::ptr::null_mut() };
283                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
284                 } else {
285                         let err = unsafe { o.contents.err };
286                         unsafe { o.contents.err = std::ptr::null_mut(); }
287                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
288                 };
289                 Self {
290                         contents,
291                         result_ok: o.result_ok,
292                 }
293         }
294 }
295 #[repr(C)]
296 pub union CResult_NoneMonitorUpdateErrorZPtr {
297         /// Note that this value is always NULL, as there are no contents in the OK variant
298         pub result: *mut std::ffi::c_void,
299         pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
300 }
301 #[repr(C)]
302 pub struct CResult_NoneMonitorUpdateErrorZ {
303         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
304         pub result_ok: bool,
305 }
306 #[no_mangle]
307 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
308         CResult_NoneMonitorUpdateErrorZ {
309                 contents: CResult_NoneMonitorUpdateErrorZPtr {
310                         result: std::ptr::null_mut(),
311                 },
312                 result_ok: true,
313         }
314 }
315 #[no_mangle]
316 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
317         CResult_NoneMonitorUpdateErrorZ {
318                 contents: CResult_NoneMonitorUpdateErrorZPtr {
319                         err: Box::into_raw(Box::new(e)),
320                 },
321                 result_ok: false,
322         }
323 }
324 #[no_mangle]
325 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
326 impl Drop for CResult_NoneMonitorUpdateErrorZ {
327         fn drop(&mut self) {
328                 if self.result_ok {
329                 } else {
330                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
331                                 let _ = unsafe { Box::from_raw(self.contents.err) };
332                         }
333                 }
334         }
335 }
336 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
337         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
338                 let contents = if o.result_ok {
339                         let _ = unsafe { Box::from_raw(o.contents.result) };
340                         o.contents.result = std::ptr::null_mut();
341                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
342                 } else {
343                         let err = unsafe { o.contents.err };
344                         unsafe { o.contents.err = std::ptr::null_mut(); }
345                         CResult_NoneMonitorUpdateErrorZPtr { err }
346                 };
347                 Self {
348                         contents,
349                         result_ok: o.result_ok,
350                 }
351         }
352 }
353 pub type C2Tuple_OutPointScriptZ = crate::c_types::C2TupleTempl<crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z>;
354 #[no_mangle]
355 pub static C2Tuple_OutPointScriptZ_free: extern "C" fn(C2Tuple_OutPointScriptZ) = crate::c_types::C2TupleTempl_free::<crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z>;
356 #[no_mangle]
357 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
358         C2Tuple_OutPointScriptZ { a, b, }
359 }
360
361 #[repr(C)]
362 pub struct CVec_TransactionZ {
363         pub data: *mut crate::c_types::Transaction,
364         pub datalen: usize
365 }
366 impl CVec_TransactionZ {
367         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
368                 if self.datalen == 0 { return Vec::new(); }
369                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
370                 self.data = std::ptr::null_mut();
371                 self.datalen = 0;
372                 ret
373         }
374         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
375                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
376         }
377 }
378 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
379         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
380                 let datalen = v.len();
381                 let data = Box::into_raw(v.into_boxed_slice());
382                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
383         }
384 }
385 #[no_mangle]
386 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
387 impl Drop for CVec_TransactionZ {
388         fn drop(&mut self) {
389                 if self.datalen == 0 { return; }
390                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
391         }
392 }
393 pub type C2Tuple_u32TxOutZ = crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>;
394 #[no_mangle]
395 pub static C2Tuple_u32TxOutZ_free: extern "C" fn(C2Tuple_u32TxOutZ) = crate::c_types::C2TupleTempl_free::<u32, crate::c_types::TxOut>;
396 #[no_mangle]
397 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
398         C2Tuple_u32TxOutZ { a, b, }
399 }
400
401 #[repr(C)]
402 pub struct CVec_C2Tuple_u32TxOutZZ {
403         pub data: *mut crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>,
404         pub datalen: usize
405 }
406 impl CVec_C2Tuple_u32TxOutZZ {
407         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>> {
408                 if self.datalen == 0 { return Vec::new(); }
409                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
410                 self.data = std::ptr::null_mut();
411                 self.datalen = 0;
412                 ret
413         }
414         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>] {
415                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
416         }
417 }
418 impl From<Vec<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>> for CVec_C2Tuple_u32TxOutZZ {
419         fn from(v: Vec<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>) -> Self {
420                 let datalen = v.len();
421                 let data = Box::into_raw(v.into_boxed_slice());
422                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
423         }
424 }
425 #[no_mangle]
426 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
427 impl Drop for CVec_C2Tuple_u32TxOutZZ {
428         fn drop(&mut self) {
429                 if self.datalen == 0 { return; }
430                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
431         }
432 }
433 pub type C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ>;
434 #[no_mangle]
435 pub static C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free: extern "C" fn(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ>;
436 #[no_mangle]
437 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 {
438         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
439 }
440
441 #[repr(C)]
442 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
443         pub data: *mut crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ>,
444         pub datalen: usize
445 }
446 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
447         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ>> {
448                 if self.datalen == 0 { return Vec::new(); }
449                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
450                 self.data = std::ptr::null_mut();
451                 self.datalen = 0;
452                 ret
453         }
454         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ>] {
455                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
456         }
457 }
458 impl From<Vec<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ>>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
459         fn from(v: Vec<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ>>) -> Self {
460                 let datalen = v.len();
461                 let data = Box::into_raw(v.into_boxed_slice());
462                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
463         }
464 }
465 #[no_mangle]
466 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) { }
467 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
468         fn drop(&mut self) {
469                 if self.datalen == 0 { return; }
470                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
471         }
472 }
473 pub type C2Tuple_BlockHashChannelMonitorZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>;
474 #[no_mangle]
475 pub static C2Tuple_BlockHashChannelMonitorZ_free: extern "C" fn(C2Tuple_BlockHashChannelMonitorZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>;
476 #[no_mangle]
477 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
478         C2Tuple_BlockHashChannelMonitorZ { a, b, }
479 }
480
481 #[repr(C)]
482 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
483         pub result: *mut crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>,
484         pub err: *mut crate::ln::msgs::DecodeError,
485 }
486 #[repr(C)]
487 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
488         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
489         pub result_ok: bool,
490 }
491 #[no_mangle]
492 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
493         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
494                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
495                         result: Box::into_raw(Box::new(o)),
496                 },
497                 result_ok: true,
498         }
499 }
500 #[no_mangle]
501 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
502         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
503                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
504                         err: Box::into_raw(Box::new(e)),
505                 },
506                 result_ok: false,
507         }
508 }
509 #[no_mangle]
510 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
511 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
512         fn drop(&mut self) {
513                 if self.result_ok {
514                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
515                                 let _ = unsafe { Box::from_raw(self.contents.result) };
516                         }
517                 } else {
518                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
519                                 let _ = unsafe { Box::from_raw(self.contents.err) };
520                         }
521                 }
522         }
523 }
524 impl From<crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
525         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>, crate::ln::msgs::DecodeError>) -> Self {
526                 let contents = if o.result_ok {
527                         let result = unsafe { o.contents.result };
528                         unsafe { o.contents.result = std::ptr::null_mut() };
529                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
530                 } else {
531                         let err = unsafe { o.contents.err };
532                         unsafe { o.contents.err = std::ptr::null_mut(); }
533                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
534                 };
535                 Self {
536                         contents,
537                         result_ok: o.result_ok,
538                 }
539         }
540 }
541 pub type C2Tuple_u64u64Z = crate::c_types::C2TupleTempl<u64, u64>;
542 #[no_mangle]
543 pub static C2Tuple_u64u64Z_free: extern "C" fn(C2Tuple_u64u64Z) = crate::c_types::C2TupleTempl_free::<u64, u64>;
544 #[no_mangle]
545 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
546         C2Tuple_u64u64Z { a, b, }
547 }
548
549 #[repr(C)]
550 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
551         pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
552         pub err: *mut crate::ln::msgs::DecodeError,
553 }
554 #[repr(C)]
555 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
556         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
557         pub result_ok: bool,
558 }
559 #[no_mangle]
560 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
561         CResult_SpendableOutputDescriptorDecodeErrorZ {
562                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
563                         result: Box::into_raw(Box::new(o)),
564                 },
565                 result_ok: true,
566         }
567 }
568 #[no_mangle]
569 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
570         CResult_SpendableOutputDescriptorDecodeErrorZ {
571                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
572                         err: Box::into_raw(Box::new(e)),
573                 },
574                 result_ok: false,
575         }
576 }
577 #[no_mangle]
578 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
579 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
580         fn drop(&mut self) {
581                 if self.result_ok {
582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
584                         }
585                 } else {
586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
588                         }
589                 }
590         }
591 }
592 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
593         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
594                 let contents = if o.result_ok {
595                         let result = unsafe { o.contents.result };
596                         unsafe { o.contents.result = std::ptr::null_mut() };
597                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
598                 } else {
599                         let err = unsafe { o.contents.err };
600                         unsafe { o.contents.err = std::ptr::null_mut(); }
601                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
602                 };
603                 Self {
604                         contents,
605                         result_ok: o.result_ok,
606                 }
607         }
608 }
609 #[repr(C)]
610 pub struct CVec_SignatureZ {
611         pub data: *mut crate::c_types::Signature,
612         pub datalen: usize
613 }
614 impl CVec_SignatureZ {
615         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
616                 if self.datalen == 0 { return Vec::new(); }
617                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
618                 self.data = std::ptr::null_mut();
619                 self.datalen = 0;
620                 ret
621         }
622         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
623                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
624         }
625 }
626 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
627         fn from(v: Vec<crate::c_types::Signature>) -> Self {
628                 let datalen = v.len();
629                 let data = Box::into_raw(v.into_boxed_slice());
630                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
631         }
632 }
633 #[no_mangle]
634 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
635 impl Drop for CVec_SignatureZ {
636         fn drop(&mut self) {
637                 if self.datalen == 0 { return; }
638                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
639         }
640 }
641 pub type C2Tuple_SignatureCVec_SignatureZZ = crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ>;
642 #[no_mangle]
643 pub static C2Tuple_SignatureCVec_SignatureZZ_free: extern "C" fn(C2Tuple_SignatureCVec_SignatureZZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ>;
644 #[no_mangle]
645 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
646         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
647 }
648
649 #[repr(C)]
650 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
651         pub result: *mut crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ>,
652         /// Note that this value is always NULL, as there are no contents in the Err variant
653         pub err: *mut std::ffi::c_void,
654 }
655 #[repr(C)]
656 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
657         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
658         pub result_ok: bool,
659 }
660 #[no_mangle]
661 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ>) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
662         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
663                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
664                         result: Box::into_raw(Box::new(o)),
665                 },
666                 result_ok: true,
667         }
668 }
669 #[no_mangle]
670 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
671         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
672                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
673                         err: std::ptr::null_mut(),
674                 },
675                 result_ok: false,
676         }
677 }
678 #[no_mangle]
679 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
680 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
681         fn drop(&mut self) {
682                 if self.result_ok {
683                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
684                                 let _ = unsafe { Box::from_raw(self.contents.result) };
685                         }
686                 } else {
687                 }
688         }
689 }
690 impl From<crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ>, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
691         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ>, u8>) -> Self {
692                 let contents = if o.result_ok {
693                         let result = unsafe { o.contents.result };
694                         unsafe { o.contents.result = std::ptr::null_mut() };
695                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
696                 } else {
697                         let _ = unsafe { Box::from_raw(o.contents.err) };
698                         o.contents.err = std::ptr::null_mut();
699                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
700                 };
701                 Self {
702                         contents,
703                         result_ok: o.result_ok,
704                 }
705         }
706 }
707 #[repr(C)]
708 pub union CResult_SignatureNoneZPtr {
709         pub result: *mut crate::c_types::Signature,
710         /// Note that this value is always NULL, as there are no contents in the Err variant
711         pub err: *mut std::ffi::c_void,
712 }
713 #[repr(C)]
714 pub struct CResult_SignatureNoneZ {
715         pub contents: CResult_SignatureNoneZPtr,
716         pub result_ok: bool,
717 }
718 #[no_mangle]
719 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
720         CResult_SignatureNoneZ {
721                 contents: CResult_SignatureNoneZPtr {
722                         result: Box::into_raw(Box::new(o)),
723                 },
724                 result_ok: true,
725         }
726 }
727 #[no_mangle]
728 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
729         CResult_SignatureNoneZ {
730                 contents: CResult_SignatureNoneZPtr {
731                         err: std::ptr::null_mut(),
732                 },
733                 result_ok: false,
734         }
735 }
736 #[no_mangle]
737 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
738 impl Drop for CResult_SignatureNoneZ {
739         fn drop(&mut self) {
740                 if self.result_ok {
741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
743                         }
744                 } else {
745                 }
746         }
747 }
748 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
749         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
750                 let contents = if o.result_ok {
751                         let result = unsafe { o.contents.result };
752                         unsafe { o.contents.result = std::ptr::null_mut() };
753                         CResult_SignatureNoneZPtr { result }
754                 } else {
755                         let _ = unsafe { Box::from_raw(o.contents.err) };
756                         o.contents.err = std::ptr::null_mut();
757                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
758                 };
759                 Self {
760                         contents,
761                         result_ok: o.result_ok,
762                 }
763         }
764 }
765 #[repr(C)]
766 pub union CResult_CVec_SignatureZNoneZPtr {
767         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
768         /// Note that this value is always NULL, as there are no contents in the Err variant
769         pub err: *mut std::ffi::c_void,
770 }
771 #[repr(C)]
772 pub struct CResult_CVec_SignatureZNoneZ {
773         pub contents: CResult_CVec_SignatureZNoneZPtr,
774         pub result_ok: bool,
775 }
776 #[no_mangle]
777 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
778         CResult_CVec_SignatureZNoneZ {
779                 contents: CResult_CVec_SignatureZNoneZPtr {
780                         result: Box::into_raw(Box::new(o)),
781                 },
782                 result_ok: true,
783         }
784 }
785 #[no_mangle]
786 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
787         CResult_CVec_SignatureZNoneZ {
788                 contents: CResult_CVec_SignatureZNoneZPtr {
789                         err: std::ptr::null_mut(),
790                 },
791                 result_ok: false,
792         }
793 }
794 #[no_mangle]
795 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
796 impl Drop for CResult_CVec_SignatureZNoneZ {
797         fn drop(&mut self) {
798                 if self.result_ok {
799                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
800                                 let _ = unsafe { Box::from_raw(self.contents.result) };
801                         }
802                 } else {
803                 }
804         }
805 }
806 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>> for CResult_CVec_SignatureZNoneZ {
807         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> Self {
808                 let contents = if o.result_ok {
809                         let result = unsafe { o.contents.result };
810                         unsafe { o.contents.result = std::ptr::null_mut() };
811                         CResult_CVec_SignatureZNoneZPtr { result }
812                 } else {
813                         let _ = unsafe { Box::from_raw(o.contents.err) };
814                         o.contents.err = std::ptr::null_mut();
815                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
816                 };
817                 Self {
818                         contents,
819                         result_ok: o.result_ok,
820                 }
821         }
822 }
823 #[repr(C)]
824 pub union CResult_ChanKeySignerDecodeErrorZPtr {
825         pub result: *mut crate::chain::keysinterface::ChannelKeys,
826         pub err: *mut crate::ln::msgs::DecodeError,
827 }
828 #[repr(C)]
829 pub struct CResult_ChanKeySignerDecodeErrorZ {
830         pub contents: CResult_ChanKeySignerDecodeErrorZPtr,
831         pub result_ok: bool,
832 }
833 #[no_mangle]
834 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::ChannelKeys) -> CResult_ChanKeySignerDecodeErrorZ {
835         CResult_ChanKeySignerDecodeErrorZ {
836                 contents: CResult_ChanKeySignerDecodeErrorZPtr {
837                         result: Box::into_raw(Box::new(o)),
838                 },
839                 result_ok: true,
840         }
841 }
842 #[no_mangle]
843 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChanKeySignerDecodeErrorZ {
844         CResult_ChanKeySignerDecodeErrorZ {
845                 contents: CResult_ChanKeySignerDecodeErrorZPtr {
846                         err: Box::into_raw(Box::new(e)),
847                 },
848                 result_ok: false,
849         }
850 }
851 #[no_mangle]
852 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_free(_res: CResult_ChanKeySignerDecodeErrorZ) { }
853 impl Drop for CResult_ChanKeySignerDecodeErrorZ {
854         fn drop(&mut self) {
855                 if self.result_ok {
856                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
857                                 let _ = unsafe { Box::from_raw(self.contents.result) };
858                         }
859                 } else {
860                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
861                                 let _ = unsafe { Box::from_raw(self.contents.err) };
862                         }
863                 }
864         }
865 }
866 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>> for CResult_ChanKeySignerDecodeErrorZ {
867         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
868                 let contents = if o.result_ok {
869                         let result = unsafe { o.contents.result };
870                         unsafe { o.contents.result = std::ptr::null_mut() };
871                         CResult_ChanKeySignerDecodeErrorZPtr { result }
872                 } else {
873                         let err = unsafe { o.contents.err };
874                         unsafe { o.contents.err = std::ptr::null_mut(); }
875                         CResult_ChanKeySignerDecodeErrorZPtr { err }
876                 };
877                 Self {
878                         contents,
879                         result_ok: o.result_ok,
880                 }
881         }
882 }
883 #[repr(C)]
884 pub union CResult_InMemoryChannelKeysDecodeErrorZPtr {
885         pub result: *mut crate::chain::keysinterface::InMemoryChannelKeys,
886         pub err: *mut crate::ln::msgs::DecodeError,
887 }
888 #[repr(C)]
889 pub struct CResult_InMemoryChannelKeysDecodeErrorZ {
890         pub contents: CResult_InMemoryChannelKeysDecodeErrorZPtr,
891         pub result_ok: bool,
892 }
893 #[no_mangle]
894 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemoryChannelKeys) -> CResult_InMemoryChannelKeysDecodeErrorZ {
895         CResult_InMemoryChannelKeysDecodeErrorZ {
896                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
897                         result: Box::into_raw(Box::new(o)),
898                 },
899                 result_ok: true,
900         }
901 }
902 #[no_mangle]
903 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemoryChannelKeysDecodeErrorZ {
904         CResult_InMemoryChannelKeysDecodeErrorZ {
905                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
906                         err: Box::into_raw(Box::new(e)),
907                 },
908                 result_ok: false,
909         }
910 }
911 #[no_mangle]
912 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_free(_res: CResult_InMemoryChannelKeysDecodeErrorZ) { }
913 impl Drop for CResult_InMemoryChannelKeysDecodeErrorZ {
914         fn drop(&mut self) {
915                 if self.result_ok {
916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
918                         }
919                 } else {
920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
922                         }
923                 }
924         }
925 }
926 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>> for CResult_InMemoryChannelKeysDecodeErrorZ {
927         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
928                 let contents = if o.result_ok {
929                         let result = unsafe { o.contents.result };
930                         unsafe { o.contents.result = std::ptr::null_mut() };
931                         CResult_InMemoryChannelKeysDecodeErrorZPtr { result }
932                 } else {
933                         let err = unsafe { o.contents.err };
934                         unsafe { o.contents.err = std::ptr::null_mut(); }
935                         CResult_InMemoryChannelKeysDecodeErrorZPtr { err }
936                 };
937                 Self {
938                         contents,
939                         result_ok: o.result_ok,
940                 }
941         }
942 }
943 #[repr(C)]
944 pub union CResult_TxOutAccessErrorZPtr {
945         pub result: *mut crate::c_types::TxOut,
946         pub err: *mut crate::chain::AccessError,
947 }
948 #[repr(C)]
949 pub struct CResult_TxOutAccessErrorZ {
950         pub contents: CResult_TxOutAccessErrorZPtr,
951         pub result_ok: bool,
952 }
953 #[no_mangle]
954 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
955         CResult_TxOutAccessErrorZ {
956                 contents: CResult_TxOutAccessErrorZPtr {
957                         result: Box::into_raw(Box::new(o)),
958                 },
959                 result_ok: true,
960         }
961 }
962 #[no_mangle]
963 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
964         CResult_TxOutAccessErrorZ {
965                 contents: CResult_TxOutAccessErrorZPtr {
966                         err: Box::into_raw(Box::new(e)),
967                 },
968                 result_ok: false,
969         }
970 }
971 #[no_mangle]
972 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
973 impl Drop for CResult_TxOutAccessErrorZ {
974         fn drop(&mut self) {
975                 if self.result_ok {
976                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
977                                 let _ = unsafe { Box::from_raw(self.contents.result) };
978                         }
979                 } else {
980                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
981                                 let _ = unsafe { Box::from_raw(self.contents.err) };
982                         }
983                 }
984         }
985 }
986 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
987         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
988                 let contents = if o.result_ok {
989                         let result = unsafe { o.contents.result };
990                         unsafe { o.contents.result = std::ptr::null_mut() };
991                         CResult_TxOutAccessErrorZPtr { result }
992                 } else {
993                         let err = unsafe { o.contents.err };
994                         unsafe { o.contents.err = std::ptr::null_mut(); }
995                         CResult_TxOutAccessErrorZPtr { err }
996                 };
997                 Self {
998                         contents,
999                         result_ok: o.result_ok,
1000                 }
1001         }
1002 }
1003 #[repr(C)]
1004 pub union CResult_NoneAPIErrorZPtr {
1005         /// Note that this value is always NULL, as there are no contents in the OK variant
1006         pub result: *mut std::ffi::c_void,
1007         pub err: *mut crate::util::errors::APIError,
1008 }
1009 #[repr(C)]
1010 pub struct CResult_NoneAPIErrorZ {
1011         pub contents: CResult_NoneAPIErrorZPtr,
1012         pub result_ok: bool,
1013 }
1014 #[no_mangle]
1015 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
1016         CResult_NoneAPIErrorZ {
1017                 contents: CResult_NoneAPIErrorZPtr {
1018                         result: std::ptr::null_mut(),
1019                 },
1020                 result_ok: true,
1021         }
1022 }
1023 #[no_mangle]
1024 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
1025         CResult_NoneAPIErrorZ {
1026                 contents: CResult_NoneAPIErrorZPtr {
1027                         err: Box::into_raw(Box::new(e)),
1028                 },
1029                 result_ok: false,
1030         }
1031 }
1032 #[no_mangle]
1033 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
1034 impl Drop for CResult_NoneAPIErrorZ {
1035         fn drop(&mut self) {
1036                 if self.result_ok {
1037                 } else {
1038                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1039                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1040                         }
1041                 }
1042         }
1043 }
1044 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
1045         fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
1046                 let contents = if o.result_ok {
1047                         let _ = unsafe { Box::from_raw(o.contents.result) };
1048                         o.contents.result = std::ptr::null_mut();
1049                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
1050                 } else {
1051                         let err = unsafe { o.contents.err };
1052                         unsafe { o.contents.err = std::ptr::null_mut(); }
1053                         CResult_NoneAPIErrorZPtr { err }
1054                 };
1055                 Self {
1056                         contents,
1057                         result_ok: o.result_ok,
1058                 }
1059         }
1060 }
1061 #[repr(C)]
1062 pub struct CVec_ChannelDetailsZ {
1063         pub data: *mut crate::ln::channelmanager::ChannelDetails,
1064         pub datalen: usize
1065 }
1066 impl CVec_ChannelDetailsZ {
1067         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
1068                 if self.datalen == 0 { return Vec::new(); }
1069                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1070                 self.data = std::ptr::null_mut();
1071                 self.datalen = 0;
1072                 ret
1073         }
1074         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
1075                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1076         }
1077 }
1078 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1079         fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
1080                 let datalen = v.len();
1081                 let data = Box::into_raw(v.into_boxed_slice());
1082                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1083         }
1084 }
1085 #[no_mangle]
1086 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1087 impl Drop for CVec_ChannelDetailsZ {
1088         fn drop(&mut self) {
1089                 if self.datalen == 0 { return; }
1090                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1091         }
1092 }
1093 #[repr(C)]
1094 pub union CResult_NonePaymentSendFailureZPtr {
1095         /// Note that this value is always NULL, as there are no contents in the OK variant
1096         pub result: *mut std::ffi::c_void,
1097         pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
1098 }
1099 #[repr(C)]
1100 pub struct CResult_NonePaymentSendFailureZ {
1101         pub contents: CResult_NonePaymentSendFailureZPtr,
1102         pub result_ok: bool,
1103 }
1104 #[no_mangle]
1105 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
1106         CResult_NonePaymentSendFailureZ {
1107                 contents: CResult_NonePaymentSendFailureZPtr {
1108                         result: std::ptr::null_mut(),
1109                 },
1110                 result_ok: true,
1111         }
1112 }
1113 #[no_mangle]
1114 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
1115         CResult_NonePaymentSendFailureZ {
1116                 contents: CResult_NonePaymentSendFailureZPtr {
1117                         err: Box::into_raw(Box::new(e)),
1118                 },
1119                 result_ok: false,
1120         }
1121 }
1122 #[no_mangle]
1123 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
1124 impl Drop for CResult_NonePaymentSendFailureZ {
1125         fn drop(&mut self) {
1126                 if self.result_ok {
1127                 } else {
1128                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1129                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1130                         }
1131                 }
1132         }
1133 }
1134 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
1135         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
1136                 let contents = if o.result_ok {
1137                         let _ = unsafe { Box::from_raw(o.contents.result) };
1138                         o.contents.result = std::ptr::null_mut();
1139                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
1140                 } else {
1141                         let err = unsafe { o.contents.err };
1142                         unsafe { o.contents.err = std::ptr::null_mut(); }
1143                         CResult_NonePaymentSendFailureZPtr { err }
1144                 };
1145                 Self {
1146                         contents,
1147                         result_ok: o.result_ok,
1148                 }
1149         }
1150 }
1151 #[repr(C)]
1152 pub struct CVec_NetAddressZ {
1153         pub data: *mut crate::ln::msgs::NetAddress,
1154         pub datalen: usize
1155 }
1156 impl CVec_NetAddressZ {
1157         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NetAddress> {
1158                 if self.datalen == 0 { return Vec::new(); }
1159                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1160                 self.data = std::ptr::null_mut();
1161                 self.datalen = 0;
1162                 ret
1163         }
1164         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NetAddress] {
1165                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1166         }
1167 }
1168 impl From<Vec<crate::ln::msgs::NetAddress>> for CVec_NetAddressZ {
1169         fn from(v: Vec<crate::ln::msgs::NetAddress>) -> Self {
1170                 let datalen = v.len();
1171                 let data = Box::into_raw(v.into_boxed_slice());
1172                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1173         }
1174 }
1175 #[no_mangle]
1176 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
1177 impl Drop for CVec_NetAddressZ {
1178         fn drop(&mut self) {
1179                 if self.datalen == 0 { return; }
1180                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1181         }
1182 }
1183 #[repr(C)]
1184 pub struct CVec_ChannelMonitorZ {
1185         pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
1186         pub datalen: usize
1187 }
1188 impl CVec_ChannelMonitorZ {
1189         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
1190                 if self.datalen == 0 { return Vec::new(); }
1191                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1192                 self.data = std::ptr::null_mut();
1193                 self.datalen = 0;
1194                 ret
1195         }
1196         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
1197                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1198         }
1199 }
1200 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
1201         fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
1202                 let datalen = v.len();
1203                 let data = Box::into_raw(v.into_boxed_slice());
1204                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1205         }
1206 }
1207 #[no_mangle]
1208 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
1209 impl Drop for CVec_ChannelMonitorZ {
1210         fn drop(&mut self) {
1211                 if self.datalen == 0 { return; }
1212                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1213         }
1214 }
1215 pub type C2Tuple_BlockHashChannelManagerZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>;
1216 #[no_mangle]
1217 pub static C2Tuple_BlockHashChannelManagerZ_free: extern "C" fn(C2Tuple_BlockHashChannelManagerZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>;
1218 #[no_mangle]
1219 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
1220         C2Tuple_BlockHashChannelManagerZ { a, b, }
1221 }
1222
1223 #[repr(C)]
1224 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1225         pub result: *mut crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>,
1226         pub err: *mut crate::ln::msgs::DecodeError,
1227 }
1228 #[repr(C)]
1229 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1230         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
1231         pub result_ok: bool,
1232 }
1233 #[no_mangle]
1234 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1235         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1236                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1237                         result: Box::into_raw(Box::new(o)),
1238                 },
1239                 result_ok: true,
1240         }
1241 }
1242 #[no_mangle]
1243 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1244         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1245                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1246                         err: Box::into_raw(Box::new(e)),
1247                 },
1248                 result_ok: false,
1249         }
1250 }
1251 #[no_mangle]
1252 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
1253 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1254         fn drop(&mut self) {
1255                 if self.result_ok {
1256                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1257                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1258                         }
1259                 } else {
1260                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1261                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1262                         }
1263                 }
1264         }
1265 }
1266 impl From<crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1267         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>, crate::ln::msgs::DecodeError>) -> Self {
1268                 let contents = if o.result_ok {
1269                         let result = unsafe { o.contents.result };
1270                         unsafe { o.contents.result = std::ptr::null_mut() };
1271                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
1272                 } else {
1273                         let err = unsafe { o.contents.err };
1274                         unsafe { o.contents.err = std::ptr::null_mut(); }
1275                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
1276                 };
1277                 Self {
1278                         contents,
1279                         result_ok: o.result_ok,
1280                 }
1281         }
1282 }
1283 #[repr(C)]
1284 pub union CResult_NetAddressu8ZPtr {
1285         pub result: *mut crate::ln::msgs::NetAddress,
1286         pub err: *mut u8,
1287 }
1288 #[repr(C)]
1289 pub struct CResult_NetAddressu8Z {
1290         pub contents: CResult_NetAddressu8ZPtr,
1291         pub result_ok: bool,
1292 }
1293 #[no_mangle]
1294 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
1295         CResult_NetAddressu8Z {
1296                 contents: CResult_NetAddressu8ZPtr {
1297                         result: Box::into_raw(Box::new(o)),
1298                 },
1299                 result_ok: true,
1300         }
1301 }
1302 #[no_mangle]
1303 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
1304         CResult_NetAddressu8Z {
1305                 contents: CResult_NetAddressu8ZPtr {
1306                         err: Box::into_raw(Box::new(e)),
1307                 },
1308                 result_ok: false,
1309         }
1310 }
1311 #[no_mangle]
1312 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
1313 impl Drop for CResult_NetAddressu8Z {
1314         fn drop(&mut self) {
1315                 if self.result_ok {
1316                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1317                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1318                         }
1319                 } else {
1320                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1321                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1322                         }
1323                 }
1324         }
1325 }
1326 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
1327         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
1328                 let contents = if o.result_ok {
1329                         let result = unsafe { o.contents.result };
1330                         unsafe { o.contents.result = std::ptr::null_mut() };
1331                         CResult_NetAddressu8ZPtr { result }
1332                 } else {
1333                         let err = unsafe { o.contents.err };
1334                         unsafe { o.contents.err = std::ptr::null_mut(); }
1335                         CResult_NetAddressu8ZPtr { err }
1336                 };
1337                 Self {
1338                         contents,
1339                         result_ok: o.result_ok,
1340                 }
1341         }
1342 }
1343 #[repr(C)]
1344 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1345         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
1346         pub err: *mut crate::ln::msgs::DecodeError,
1347 }
1348 #[repr(C)]
1349 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
1350         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
1351         pub result_ok: bool,
1352 }
1353 #[no_mangle]
1354 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1355         CResult_CResult_NetAddressu8ZDecodeErrorZ {
1356                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1357                         result: Box::into_raw(Box::new(o)),
1358                 },
1359                 result_ok: true,
1360         }
1361 }
1362 #[no_mangle]
1363 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1364         CResult_CResult_NetAddressu8ZDecodeErrorZ {
1365                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1366                         err: Box::into_raw(Box::new(e)),
1367                 },
1368                 result_ok: false,
1369         }
1370 }
1371 #[no_mangle]
1372 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
1373 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1374         fn drop(&mut self) {
1375                 if self.result_ok {
1376                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1377                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1378                         }
1379                 } else {
1380                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1381                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1382                         }
1383                 }
1384         }
1385 }
1386 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1387         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
1388                 let contents = if o.result_ok {
1389                         let result = unsafe { o.contents.result };
1390                         unsafe { o.contents.result = std::ptr::null_mut() };
1391                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
1392                 } else {
1393                         let err = unsafe { o.contents.err };
1394                         unsafe { o.contents.err = std::ptr::null_mut(); }
1395                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
1396                 };
1397                 Self {
1398                         contents,
1399                         result_ok: o.result_ok,
1400                 }
1401         }
1402 }
1403 #[repr(C)]
1404 pub struct CVec_u64Z {
1405         pub data: *mut u64,
1406         pub datalen: usize
1407 }
1408 impl CVec_u64Z {
1409         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
1410                 if self.datalen == 0 { return Vec::new(); }
1411                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1412                 self.data = std::ptr::null_mut();
1413                 self.datalen = 0;
1414                 ret
1415         }
1416         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
1417                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1418         }
1419 }
1420 impl From<Vec<u64>> for CVec_u64Z {
1421         fn from(v: Vec<u64>) -> Self {
1422                 let datalen = v.len();
1423                 let data = Box::into_raw(v.into_boxed_slice());
1424                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1425         }
1426 }
1427 #[no_mangle]
1428 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
1429 impl Drop for CVec_u64Z {
1430         fn drop(&mut self) {
1431                 if self.datalen == 0 { return; }
1432                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1433         }
1434 }
1435 #[repr(C)]
1436 pub struct CVec_UpdateAddHTLCZ {
1437         pub data: *mut crate::ln::msgs::UpdateAddHTLC,
1438         pub datalen: usize
1439 }
1440 impl CVec_UpdateAddHTLCZ {
1441         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
1442                 if self.datalen == 0 { return Vec::new(); }
1443                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1444                 self.data = std::ptr::null_mut();
1445                 self.datalen = 0;
1446                 ret
1447         }
1448         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
1449                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1450         }
1451 }
1452 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
1453         fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
1454                 let datalen = v.len();
1455                 let data = Box::into_raw(v.into_boxed_slice());
1456                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1457         }
1458 }
1459 #[no_mangle]
1460 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
1461 impl Drop for CVec_UpdateAddHTLCZ {
1462         fn drop(&mut self) {
1463                 if self.datalen == 0 { return; }
1464                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1465         }
1466 }
1467 #[repr(C)]
1468 pub struct CVec_UpdateFulfillHTLCZ {
1469         pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
1470         pub datalen: usize
1471 }
1472 impl CVec_UpdateFulfillHTLCZ {
1473         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
1474                 if self.datalen == 0 { return Vec::new(); }
1475                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1476                 self.data = std::ptr::null_mut();
1477                 self.datalen = 0;
1478                 ret
1479         }
1480         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
1481                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1482         }
1483 }
1484 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
1485         fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
1486                 let datalen = v.len();
1487                 let data = Box::into_raw(v.into_boxed_slice());
1488                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1489         }
1490 }
1491 #[no_mangle]
1492 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
1493 impl Drop for CVec_UpdateFulfillHTLCZ {
1494         fn drop(&mut self) {
1495                 if self.datalen == 0 { return; }
1496                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1497         }
1498 }
1499 #[repr(C)]
1500 pub struct CVec_UpdateFailHTLCZ {
1501         pub data: *mut crate::ln::msgs::UpdateFailHTLC,
1502         pub datalen: usize
1503 }
1504 impl CVec_UpdateFailHTLCZ {
1505         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
1506                 if self.datalen == 0 { return Vec::new(); }
1507                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1508                 self.data = std::ptr::null_mut();
1509                 self.datalen = 0;
1510                 ret
1511         }
1512         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
1513                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1514         }
1515 }
1516 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
1517         fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
1518                 let datalen = v.len();
1519                 let data = Box::into_raw(v.into_boxed_slice());
1520                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1521         }
1522 }
1523 #[no_mangle]
1524 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
1525 impl Drop for CVec_UpdateFailHTLCZ {
1526         fn drop(&mut self) {
1527                 if self.datalen == 0 { return; }
1528                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1529         }
1530 }
1531 #[repr(C)]
1532 pub struct CVec_UpdateFailMalformedHTLCZ {
1533         pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
1534         pub datalen: usize
1535 }
1536 impl CVec_UpdateFailMalformedHTLCZ {
1537         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
1538                 if self.datalen == 0 { return Vec::new(); }
1539                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1540                 self.data = std::ptr::null_mut();
1541                 self.datalen = 0;
1542                 ret
1543         }
1544         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
1545                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1546         }
1547 }
1548 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
1549         fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
1550                 let datalen = v.len();
1551                 let data = Box::into_raw(v.into_boxed_slice());
1552                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1553         }
1554 }
1555 #[no_mangle]
1556 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
1557 impl Drop for CVec_UpdateFailMalformedHTLCZ {
1558         fn drop(&mut self) {
1559                 if self.datalen == 0 { return; }
1560                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1561         }
1562 }
1563 #[repr(C)]
1564 pub union CResult_boolLightningErrorZPtr {
1565         pub result: *mut bool,
1566         pub err: *mut crate::ln::msgs::LightningError,
1567 }
1568 #[repr(C)]
1569 pub struct CResult_boolLightningErrorZ {
1570         pub contents: CResult_boolLightningErrorZPtr,
1571         pub result_ok: bool,
1572 }
1573 #[no_mangle]
1574 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1575         CResult_boolLightningErrorZ {
1576                 contents: CResult_boolLightningErrorZPtr {
1577                         result: Box::into_raw(Box::new(o)),
1578                 },
1579                 result_ok: true,
1580         }
1581 }
1582 #[no_mangle]
1583 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1584         CResult_boolLightningErrorZ {
1585                 contents: CResult_boolLightningErrorZPtr {
1586                         err: Box::into_raw(Box::new(e)),
1587                 },
1588                 result_ok: false,
1589         }
1590 }
1591 #[no_mangle]
1592 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1593 impl Drop for CResult_boolLightningErrorZ {
1594         fn drop(&mut self) {
1595                 if self.result_ok {
1596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1598                         }
1599                 } else {
1600                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1601                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1602                         }
1603                 }
1604         }
1605 }
1606 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
1607         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
1608                 let contents = if o.result_ok {
1609                         let result = unsafe { o.contents.result };
1610                         unsafe { o.contents.result = std::ptr::null_mut() };
1611                         CResult_boolLightningErrorZPtr { result }
1612                 } else {
1613                         let err = unsafe { o.contents.err };
1614                         unsafe { o.contents.err = std::ptr::null_mut(); }
1615                         CResult_boolLightningErrorZPtr { err }
1616                 };
1617                 Self {
1618                         contents,
1619                         result_ok: o.result_ok,
1620                 }
1621         }
1622 }
1623 pub type C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ = crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>;
1624 #[no_mangle]
1625 pub static C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free: extern "C" fn(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) = crate::c_types::C3TupleTempl_free::<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>;
1626 #[no_mangle]
1627 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1628         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
1629 }
1630
1631 #[repr(C)]
1632 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1633         pub data: *mut crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>,
1634         pub datalen: usize
1635 }
1636 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1637         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>> {
1638                 if self.datalen == 0 { return Vec::new(); }
1639                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1640                 self.data = std::ptr::null_mut();
1641                 self.datalen = 0;
1642                 ret
1643         }
1644         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>] {
1645                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1646         }
1647 }
1648 impl From<Vec<crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1649         fn from(v: Vec<crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>>) -> Self {
1650                 let datalen = v.len();
1651                 let data = Box::into_raw(v.into_boxed_slice());
1652                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1653         }
1654 }
1655 #[no_mangle]
1656 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
1657 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1658         fn drop(&mut self) {
1659                 if self.datalen == 0 { return; }
1660                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1661         }
1662 }
1663 #[repr(C)]
1664 pub struct CVec_NodeAnnouncementZ {
1665         pub data: *mut crate::ln::msgs::NodeAnnouncement,
1666         pub datalen: usize
1667 }
1668 impl CVec_NodeAnnouncementZ {
1669         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
1670                 if self.datalen == 0 { return Vec::new(); }
1671                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1672                 self.data = std::ptr::null_mut();
1673                 self.datalen = 0;
1674                 ret
1675         }
1676         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
1677                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1678         }
1679 }
1680 impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
1681         fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
1682                 let datalen = v.len();
1683                 let data = Box::into_raw(v.into_boxed_slice());
1684                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1685         }
1686 }
1687 #[no_mangle]
1688 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
1689 impl Drop for CVec_NodeAnnouncementZ {
1690         fn drop(&mut self) {
1691                 if self.datalen == 0 { return; }
1692                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1693         }
1694 }
1695 #[repr(C)]
1696 pub union CResult_NoneLightningErrorZPtr {
1697         /// Note that this value is always NULL, as there are no contents in the OK variant
1698         pub result: *mut std::ffi::c_void,
1699         pub err: *mut crate::ln::msgs::LightningError,
1700 }
1701 #[repr(C)]
1702 pub struct CResult_NoneLightningErrorZ {
1703         pub contents: CResult_NoneLightningErrorZPtr,
1704         pub result_ok: bool,
1705 }
1706 #[no_mangle]
1707 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
1708         CResult_NoneLightningErrorZ {
1709                 contents: CResult_NoneLightningErrorZPtr {
1710                         result: std::ptr::null_mut(),
1711                 },
1712                 result_ok: true,
1713         }
1714 }
1715 #[no_mangle]
1716 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
1717         CResult_NoneLightningErrorZ {
1718                 contents: CResult_NoneLightningErrorZPtr {
1719                         err: Box::into_raw(Box::new(e)),
1720                 },
1721                 result_ok: false,
1722         }
1723 }
1724 #[no_mangle]
1725 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
1726 impl Drop for CResult_NoneLightningErrorZ {
1727         fn drop(&mut self) {
1728                 if self.result_ok {
1729                 } else {
1730                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1731                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1732                         }
1733                 }
1734         }
1735 }
1736 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
1737         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
1738                 let contents = if o.result_ok {
1739                         let _ = unsafe { Box::from_raw(o.contents.result) };
1740                         o.contents.result = std::ptr::null_mut();
1741                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
1742                 } else {
1743                         let err = unsafe { o.contents.err };
1744                         unsafe { o.contents.err = std::ptr::null_mut(); }
1745                         CResult_NoneLightningErrorZPtr { err }
1746                 };
1747                 Self {
1748                         contents,
1749                         result_ok: o.result_ok,
1750                 }
1751         }
1752 }
1753 #[repr(C)]
1754 pub union CResult_ChannelReestablishDecodeErrorZPtr {
1755         pub result: *mut crate::ln::msgs::ChannelReestablish,
1756         pub err: *mut crate::ln::msgs::DecodeError,
1757 }
1758 #[repr(C)]
1759 pub struct CResult_ChannelReestablishDecodeErrorZ {
1760         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
1761         pub result_ok: bool,
1762 }
1763 #[no_mangle]
1764 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
1765         CResult_ChannelReestablishDecodeErrorZ {
1766                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
1767                         result: Box::into_raw(Box::new(o)),
1768                 },
1769                 result_ok: true,
1770         }
1771 }
1772 #[no_mangle]
1773 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
1774         CResult_ChannelReestablishDecodeErrorZ {
1775                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
1776                         err: Box::into_raw(Box::new(e)),
1777                 },
1778                 result_ok: false,
1779         }
1780 }
1781 #[no_mangle]
1782 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
1783 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
1784         fn drop(&mut self) {
1785                 if self.result_ok {
1786                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1787                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1788                         }
1789                 } else {
1790                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1791                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1792                         }
1793                 }
1794         }
1795 }
1796 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
1797         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
1798                 let contents = if o.result_ok {
1799                         let result = unsafe { o.contents.result };
1800                         unsafe { o.contents.result = std::ptr::null_mut() };
1801                         CResult_ChannelReestablishDecodeErrorZPtr { result }
1802                 } else {
1803                         let err = unsafe { o.contents.err };
1804                         unsafe { o.contents.err = std::ptr::null_mut(); }
1805                         CResult_ChannelReestablishDecodeErrorZPtr { err }
1806                 };
1807                 Self {
1808                         contents,
1809                         result_ok: o.result_ok,
1810                 }
1811         }
1812 }
1813 #[repr(C)]
1814 pub union CResult_InitDecodeErrorZPtr {
1815         pub result: *mut crate::ln::msgs::Init,
1816         pub err: *mut crate::ln::msgs::DecodeError,
1817 }
1818 #[repr(C)]
1819 pub struct CResult_InitDecodeErrorZ {
1820         pub contents: CResult_InitDecodeErrorZPtr,
1821         pub result_ok: bool,
1822 }
1823 #[no_mangle]
1824 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
1825         CResult_InitDecodeErrorZ {
1826                 contents: CResult_InitDecodeErrorZPtr {
1827                         result: Box::into_raw(Box::new(o)),
1828                 },
1829                 result_ok: true,
1830         }
1831 }
1832 #[no_mangle]
1833 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
1834         CResult_InitDecodeErrorZ {
1835                 contents: CResult_InitDecodeErrorZPtr {
1836                         err: Box::into_raw(Box::new(e)),
1837                 },
1838                 result_ok: false,
1839         }
1840 }
1841 #[no_mangle]
1842 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
1843 impl Drop for CResult_InitDecodeErrorZ {
1844         fn drop(&mut self) {
1845                 if self.result_ok {
1846                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1847                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1848                         }
1849                 } else {
1850                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1851                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1852                         }
1853                 }
1854         }
1855 }
1856 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
1857         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
1858                 let contents = if o.result_ok {
1859                         let result = unsafe { o.contents.result };
1860                         unsafe { o.contents.result = std::ptr::null_mut() };
1861                         CResult_InitDecodeErrorZPtr { result }
1862                 } else {
1863                         let err = unsafe { o.contents.err };
1864                         unsafe { o.contents.err = std::ptr::null_mut(); }
1865                         CResult_InitDecodeErrorZPtr { err }
1866                 };
1867                 Self {
1868                         contents,
1869                         result_ok: o.result_ok,
1870                 }
1871         }
1872 }
1873 #[repr(C)]
1874 pub union CResult_PingDecodeErrorZPtr {
1875         pub result: *mut crate::ln::msgs::Ping,
1876         pub err: *mut crate::ln::msgs::DecodeError,
1877 }
1878 #[repr(C)]
1879 pub struct CResult_PingDecodeErrorZ {
1880         pub contents: CResult_PingDecodeErrorZPtr,
1881         pub result_ok: bool,
1882 }
1883 #[no_mangle]
1884 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
1885         CResult_PingDecodeErrorZ {
1886                 contents: CResult_PingDecodeErrorZPtr {
1887                         result: Box::into_raw(Box::new(o)),
1888                 },
1889                 result_ok: true,
1890         }
1891 }
1892 #[no_mangle]
1893 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
1894         CResult_PingDecodeErrorZ {
1895                 contents: CResult_PingDecodeErrorZPtr {
1896                         err: Box::into_raw(Box::new(e)),
1897                 },
1898                 result_ok: false,
1899         }
1900 }
1901 #[no_mangle]
1902 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
1903 impl Drop for CResult_PingDecodeErrorZ {
1904         fn drop(&mut self) {
1905                 if self.result_ok {
1906                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1907                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1908                         }
1909                 } else {
1910                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1911                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1912                         }
1913                 }
1914         }
1915 }
1916 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
1917         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
1918                 let contents = if o.result_ok {
1919                         let result = unsafe { o.contents.result };
1920                         unsafe { o.contents.result = std::ptr::null_mut() };
1921                         CResult_PingDecodeErrorZPtr { result }
1922                 } else {
1923                         let err = unsafe { o.contents.err };
1924                         unsafe { o.contents.err = std::ptr::null_mut(); }
1925                         CResult_PingDecodeErrorZPtr { err }
1926                 };
1927                 Self {
1928                         contents,
1929                         result_ok: o.result_ok,
1930                 }
1931         }
1932 }
1933 #[repr(C)]
1934 pub union CResult_PongDecodeErrorZPtr {
1935         pub result: *mut crate::ln::msgs::Pong,
1936         pub err: *mut crate::ln::msgs::DecodeError,
1937 }
1938 #[repr(C)]
1939 pub struct CResult_PongDecodeErrorZ {
1940         pub contents: CResult_PongDecodeErrorZPtr,
1941         pub result_ok: bool,
1942 }
1943 #[no_mangle]
1944 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
1945         CResult_PongDecodeErrorZ {
1946                 contents: CResult_PongDecodeErrorZPtr {
1947                         result: Box::into_raw(Box::new(o)),
1948                 },
1949                 result_ok: true,
1950         }
1951 }
1952 #[no_mangle]
1953 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
1954         CResult_PongDecodeErrorZ {
1955                 contents: CResult_PongDecodeErrorZPtr {
1956                         err: Box::into_raw(Box::new(e)),
1957                 },
1958                 result_ok: false,
1959         }
1960 }
1961 #[no_mangle]
1962 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
1963 impl Drop for CResult_PongDecodeErrorZ {
1964         fn drop(&mut self) {
1965                 if self.result_ok {
1966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1968                         }
1969                 } else {
1970                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1971                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1972                         }
1973                 }
1974         }
1975 }
1976 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
1977         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
1978                 let contents = if o.result_ok {
1979                         let result = unsafe { o.contents.result };
1980                         unsafe { o.contents.result = std::ptr::null_mut() };
1981                         CResult_PongDecodeErrorZPtr { result }
1982                 } else {
1983                         let err = unsafe { o.contents.err };
1984                         unsafe { o.contents.err = std::ptr::null_mut(); }
1985                         CResult_PongDecodeErrorZPtr { err }
1986                 };
1987                 Self {
1988                         contents,
1989                         result_ok: o.result_ok,
1990                 }
1991         }
1992 }
1993 #[repr(C)]
1994 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
1995         pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
1996         pub err: *mut crate::ln::msgs::DecodeError,
1997 }
1998 #[repr(C)]
1999 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2000         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
2001         pub result_ok: bool,
2002 }
2003 #[no_mangle]
2004 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2005         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2006                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2007                         result: Box::into_raw(Box::new(o)),
2008                 },
2009                 result_ok: true,
2010         }
2011 }
2012 #[no_mangle]
2013 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2014         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2015                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2016                         err: Box::into_raw(Box::new(e)),
2017                 },
2018                 result_ok: false,
2019         }
2020 }
2021 #[no_mangle]
2022 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
2023 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2024         fn drop(&mut self) {
2025                 if self.result_ok {
2026                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2027                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2028                         }
2029                 } else {
2030                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2031                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2032                         }
2033                 }
2034         }
2035 }
2036 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2037         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
2038                 let contents = if o.result_ok {
2039                         let result = unsafe { o.contents.result };
2040                         unsafe { o.contents.result = std::ptr::null_mut() };
2041                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
2042                 } else {
2043                         let err = unsafe { o.contents.err };
2044                         unsafe { o.contents.err = std::ptr::null_mut(); }
2045                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
2046                 };
2047                 Self {
2048                         contents,
2049                         result_ok: o.result_ok,
2050                 }
2051         }
2052 }
2053 #[repr(C)]
2054 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2055         pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
2056         pub err: *mut crate::ln::msgs::DecodeError,
2057 }
2058 #[repr(C)]
2059 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
2060         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
2061         pub result_ok: bool,
2062 }
2063 #[no_mangle]
2064 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
2065         CResult_UnsignedChannelUpdateDecodeErrorZ {
2066                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2067                         result: Box::into_raw(Box::new(o)),
2068                 },
2069                 result_ok: true,
2070         }
2071 }
2072 #[no_mangle]
2073 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
2074         CResult_UnsignedChannelUpdateDecodeErrorZ {
2075                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2076                         err: Box::into_raw(Box::new(e)),
2077                 },
2078                 result_ok: false,
2079         }
2080 }
2081 #[no_mangle]
2082 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
2083 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
2084         fn drop(&mut self) {
2085                 if self.result_ok {
2086                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2087                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2088                         }
2089                 } else {
2090                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2091                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2092                         }
2093                 }
2094         }
2095 }
2096 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
2097         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
2098                 let contents = if o.result_ok {
2099                         let result = unsafe { o.contents.result };
2100                         unsafe { o.contents.result = std::ptr::null_mut() };
2101                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
2102                 } else {
2103                         let err = unsafe { o.contents.err };
2104                         unsafe { o.contents.err = std::ptr::null_mut(); }
2105                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
2106                 };
2107                 Self {
2108                         contents,
2109                         result_ok: o.result_ok,
2110                 }
2111         }
2112 }
2113 #[repr(C)]
2114 pub union CResult_ErrorMessageDecodeErrorZPtr {
2115         pub result: *mut crate::ln::msgs::ErrorMessage,
2116         pub err: *mut crate::ln::msgs::DecodeError,
2117 }
2118 #[repr(C)]
2119 pub struct CResult_ErrorMessageDecodeErrorZ {
2120         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
2121         pub result_ok: bool,
2122 }
2123 #[no_mangle]
2124 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
2125         CResult_ErrorMessageDecodeErrorZ {
2126                 contents: CResult_ErrorMessageDecodeErrorZPtr {
2127                         result: Box::into_raw(Box::new(o)),
2128                 },
2129                 result_ok: true,
2130         }
2131 }
2132 #[no_mangle]
2133 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
2134         CResult_ErrorMessageDecodeErrorZ {
2135                 contents: CResult_ErrorMessageDecodeErrorZPtr {
2136                         err: Box::into_raw(Box::new(e)),
2137                 },
2138                 result_ok: false,
2139         }
2140 }
2141 #[no_mangle]
2142 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
2143 impl Drop for CResult_ErrorMessageDecodeErrorZ {
2144         fn drop(&mut self) {
2145                 if self.result_ok {
2146                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2147                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2148                         }
2149                 } else {
2150                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2151                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2152                         }
2153                 }
2154         }
2155 }
2156 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
2157         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
2158                 let contents = if o.result_ok {
2159                         let result = unsafe { o.contents.result };
2160                         unsafe { o.contents.result = std::ptr::null_mut() };
2161                         CResult_ErrorMessageDecodeErrorZPtr { result }
2162                 } else {
2163                         let err = unsafe { o.contents.err };
2164                         unsafe { o.contents.err = std::ptr::null_mut(); }
2165                         CResult_ErrorMessageDecodeErrorZPtr { err }
2166                 };
2167                 Self {
2168                         contents,
2169                         result_ok: o.result_ok,
2170                 }
2171         }
2172 }
2173 #[repr(C)]
2174 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2175         pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
2176         pub err: *mut crate::ln::msgs::DecodeError,
2177 }
2178 #[repr(C)]
2179 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2180         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
2181         pub result_ok: bool,
2182 }
2183 #[no_mangle]
2184 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2185         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2186                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2187                         result: Box::into_raw(Box::new(o)),
2188                 },
2189                 result_ok: true,
2190         }
2191 }
2192 #[no_mangle]
2193 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2194         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2195                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2196                         err: Box::into_raw(Box::new(e)),
2197                 },
2198                 result_ok: false,
2199         }
2200 }
2201 #[no_mangle]
2202 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
2203 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2204         fn drop(&mut self) {
2205                 if self.result_ok {
2206                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2207                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2208                         }
2209                 } else {
2210                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2211                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2212                         }
2213                 }
2214         }
2215 }
2216 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2217         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
2218                 let contents = if o.result_ok {
2219                         let result = unsafe { o.contents.result };
2220                         unsafe { o.contents.result = std::ptr::null_mut() };
2221                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
2222                 } else {
2223                         let err = unsafe { o.contents.err };
2224                         unsafe { o.contents.err = std::ptr::null_mut(); }
2225                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
2226                 };
2227                 Self {
2228                         contents,
2229                         result_ok: o.result_ok,
2230                 }
2231         }
2232 }
2233 #[repr(C)]
2234 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
2235         pub result: *mut crate::ln::msgs::QueryShortChannelIds,
2236         pub err: *mut crate::ln::msgs::DecodeError,
2237 }
2238 #[repr(C)]
2239 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
2240         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
2241         pub result_ok: bool,
2242 }
2243 #[no_mangle]
2244 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
2245         CResult_QueryShortChannelIdsDecodeErrorZ {
2246                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2247                         result: Box::into_raw(Box::new(o)),
2248                 },
2249                 result_ok: true,
2250         }
2251 }
2252 #[no_mangle]
2253 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
2254         CResult_QueryShortChannelIdsDecodeErrorZ {
2255                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2256                         err: Box::into_raw(Box::new(e)),
2257                 },
2258                 result_ok: false,
2259         }
2260 }
2261 #[no_mangle]
2262 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
2263 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
2264         fn drop(&mut self) {
2265                 if self.result_ok {
2266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2268                         }
2269                 } else {
2270                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2271                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2272                         }
2273                 }
2274         }
2275 }
2276 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
2277         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
2278                 let contents = if o.result_ok {
2279                         let result = unsafe { o.contents.result };
2280                         unsafe { o.contents.result = std::ptr::null_mut() };
2281                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
2282                 } else {
2283                         let err = unsafe { o.contents.err };
2284                         unsafe { o.contents.err = std::ptr::null_mut(); }
2285                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
2286                 };
2287                 Self {
2288                         contents,
2289                         result_ok: o.result_ok,
2290                 }
2291         }
2292 }
2293 #[repr(C)]
2294 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2295         pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
2296         pub err: *mut crate::ln::msgs::DecodeError,
2297 }
2298 #[repr(C)]
2299 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2300         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
2301         pub result_ok: bool,
2302 }
2303 #[no_mangle]
2304 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2305         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2306                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2307                         result: Box::into_raw(Box::new(o)),
2308                 },
2309                 result_ok: true,
2310         }
2311 }
2312 #[no_mangle]
2313 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2314         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2315                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2316                         err: Box::into_raw(Box::new(e)),
2317                 },
2318                 result_ok: false,
2319         }
2320 }
2321 #[no_mangle]
2322 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
2323 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2324         fn drop(&mut self) {
2325                 if self.result_ok {
2326                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2327                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2328                         }
2329                 } else {
2330                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2331                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2332                         }
2333                 }
2334         }
2335 }
2336 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2337         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
2338                 let contents = if o.result_ok {
2339                         let result = unsafe { o.contents.result };
2340                         unsafe { o.contents.result = std::ptr::null_mut() };
2341                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
2342                 } else {
2343                         let err = unsafe { o.contents.err };
2344                         unsafe { o.contents.err = std::ptr::null_mut(); }
2345                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
2346                 };
2347                 Self {
2348                         contents,
2349                         result_ok: o.result_ok,
2350                 }
2351         }
2352 }
2353 #[repr(C)]
2354 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
2355         pub result: *mut crate::ln::msgs::QueryChannelRange,
2356         pub err: *mut crate::ln::msgs::DecodeError,
2357 }
2358 #[repr(C)]
2359 pub struct CResult_QueryChannelRangeDecodeErrorZ {
2360         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
2361         pub result_ok: bool,
2362 }
2363 #[no_mangle]
2364 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
2365         CResult_QueryChannelRangeDecodeErrorZ {
2366                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
2367                         result: Box::into_raw(Box::new(o)),
2368                 },
2369                 result_ok: true,
2370         }
2371 }
2372 #[no_mangle]
2373 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
2374         CResult_QueryChannelRangeDecodeErrorZ {
2375                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
2376                         err: Box::into_raw(Box::new(e)),
2377                 },
2378                 result_ok: false,
2379         }
2380 }
2381 #[no_mangle]
2382 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
2383 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
2384         fn drop(&mut self) {
2385                 if self.result_ok {
2386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2388                         }
2389                 } else {
2390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2392                         }
2393                 }
2394         }
2395 }
2396 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
2397         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
2398                 let contents = if o.result_ok {
2399                         let result = unsafe { o.contents.result };
2400                         unsafe { o.contents.result = std::ptr::null_mut() };
2401                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
2402                 } else {
2403                         let err = unsafe { o.contents.err };
2404                         unsafe { o.contents.err = std::ptr::null_mut(); }
2405                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
2406                 };
2407                 Self {
2408                         contents,
2409                         result_ok: o.result_ok,
2410                 }
2411         }
2412 }
2413 #[repr(C)]
2414 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
2415         pub result: *mut crate::ln::msgs::ReplyChannelRange,
2416         pub err: *mut crate::ln::msgs::DecodeError,
2417 }
2418 #[repr(C)]
2419 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
2420         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
2421         pub result_ok: bool,
2422 }
2423 #[no_mangle]
2424 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
2425         CResult_ReplyChannelRangeDecodeErrorZ {
2426                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
2427                         result: Box::into_raw(Box::new(o)),
2428                 },
2429                 result_ok: true,
2430         }
2431 }
2432 #[no_mangle]
2433 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
2434         CResult_ReplyChannelRangeDecodeErrorZ {
2435                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
2436                         err: Box::into_raw(Box::new(e)),
2437                 },
2438                 result_ok: false,
2439         }
2440 }
2441 #[no_mangle]
2442 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
2443 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
2444         fn drop(&mut self) {
2445                 if self.result_ok {
2446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2448                         }
2449                 } else {
2450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2452                         }
2453                 }
2454         }
2455 }
2456 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
2457         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
2458                 let contents = if o.result_ok {
2459                         let result = unsafe { o.contents.result };
2460                         unsafe { o.contents.result = std::ptr::null_mut() };
2461                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
2462                 } else {
2463                         let err = unsafe { o.contents.err };
2464                         unsafe { o.contents.err = std::ptr::null_mut(); }
2465                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
2466                 };
2467                 Self {
2468                         contents,
2469                         result_ok: o.result_ok,
2470                 }
2471         }
2472 }
2473 #[repr(C)]
2474 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
2475         pub result: *mut crate::ln::msgs::GossipTimestampFilter,
2476         pub err: *mut crate::ln::msgs::DecodeError,
2477 }
2478 #[repr(C)]
2479 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
2480         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
2481         pub result_ok: bool,
2482 }
2483 #[no_mangle]
2484 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
2485         CResult_GossipTimestampFilterDecodeErrorZ {
2486                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
2487                         result: Box::into_raw(Box::new(o)),
2488                 },
2489                 result_ok: true,
2490         }
2491 }
2492 #[no_mangle]
2493 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
2494         CResult_GossipTimestampFilterDecodeErrorZ {
2495                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
2496                         err: Box::into_raw(Box::new(e)),
2497                 },
2498                 result_ok: false,
2499         }
2500 }
2501 #[no_mangle]
2502 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
2503 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
2504         fn drop(&mut self) {
2505                 if self.result_ok {
2506                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2507                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2508                         }
2509                 } else {
2510                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2511                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2512                         }
2513                 }
2514         }
2515 }
2516 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
2517         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
2518                 let contents = if o.result_ok {
2519                         let result = unsafe { o.contents.result };
2520                         unsafe { o.contents.result = std::ptr::null_mut() };
2521                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
2522                 } else {
2523                         let err = unsafe { o.contents.err };
2524                         unsafe { o.contents.err = std::ptr::null_mut(); }
2525                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
2526                 };
2527                 Self {
2528                         contents,
2529                         result_ok: o.result_ok,
2530                 }
2531         }
2532 }
2533 #[repr(C)]
2534 pub struct CVec_PublicKeyZ {
2535         pub data: *mut crate::c_types::PublicKey,
2536         pub datalen: usize
2537 }
2538 impl CVec_PublicKeyZ {
2539         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2540                 if self.datalen == 0 { return Vec::new(); }
2541                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2542                 self.data = std::ptr::null_mut();
2543                 self.datalen = 0;
2544                 ret
2545         }
2546         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2547                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2548         }
2549 }
2550 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2551         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2552                 let datalen = v.len();
2553                 let data = Box::into_raw(v.into_boxed_slice());
2554                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2555         }
2556 }
2557 #[no_mangle]
2558 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2559 impl Drop for CVec_PublicKeyZ {
2560         fn drop(&mut self) {
2561                 if self.datalen == 0 { return; }
2562                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2563         }
2564 }
2565 #[repr(C)]
2566 pub struct CVec_u8Z {
2567         pub data: *mut u8,
2568         pub datalen: usize
2569 }
2570 impl CVec_u8Z {
2571         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
2572                 if self.datalen == 0 { return Vec::new(); }
2573                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2574                 self.data = std::ptr::null_mut();
2575                 self.datalen = 0;
2576                 ret
2577         }
2578         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
2579                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2580         }
2581 }
2582 impl From<Vec<u8>> for CVec_u8Z {
2583         fn from(v: Vec<u8>) -> Self {
2584                 let datalen = v.len();
2585                 let data = Box::into_raw(v.into_boxed_slice());
2586                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2587         }
2588 }
2589 #[no_mangle]
2590 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
2591 impl Drop for CVec_u8Z {
2592         fn drop(&mut self) {
2593                 if self.datalen == 0 { return; }
2594                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2595         }
2596 }
2597 impl Clone for CVec_u8Z {
2598         fn clone(&self) -> Self {
2599                 let mut res = Vec::new();
2600                 if self.datalen == 0 { return Self::from(res); }
2601                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2602                 Self::from(res)
2603         }
2604 }
2605 #[repr(C)]
2606 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
2607         pub result: *mut crate::c_types::derived::CVec_u8Z,
2608         pub err: *mut crate::ln::peer_handler::PeerHandleError,
2609 }
2610 #[repr(C)]
2611 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
2612         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
2613         pub result_ok: bool,
2614 }
2615 #[no_mangle]
2616 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
2617         CResult_CVec_u8ZPeerHandleErrorZ {
2618                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
2619                         result: Box::into_raw(Box::new(o)),
2620                 },
2621                 result_ok: true,
2622         }
2623 }
2624 #[no_mangle]
2625 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
2626         CResult_CVec_u8ZPeerHandleErrorZ {
2627                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
2628                         err: Box::into_raw(Box::new(e)),
2629                 },
2630                 result_ok: false,
2631         }
2632 }
2633 #[no_mangle]
2634 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
2635 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
2636         fn drop(&mut self) {
2637                 if self.result_ok {
2638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2640                         }
2641                 } else {
2642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2644                         }
2645                 }
2646         }
2647 }
2648 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
2649         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
2650                 let contents = if o.result_ok {
2651                         let result = unsafe { o.contents.result };
2652                         unsafe { o.contents.result = std::ptr::null_mut() };
2653                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
2654                 } else {
2655                         let err = unsafe { o.contents.err };
2656                         unsafe { o.contents.err = std::ptr::null_mut(); }
2657                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
2658                 };
2659                 Self {
2660                         contents,
2661                         result_ok: o.result_ok,
2662                 }
2663         }
2664 }
2665 #[repr(C)]
2666 pub union CResult_NonePeerHandleErrorZPtr {
2667         /// Note that this value is always NULL, as there are no contents in the OK variant
2668         pub result: *mut std::ffi::c_void,
2669         pub err: *mut crate::ln::peer_handler::PeerHandleError,
2670 }
2671 #[repr(C)]
2672 pub struct CResult_NonePeerHandleErrorZ {
2673         pub contents: CResult_NonePeerHandleErrorZPtr,
2674         pub result_ok: bool,
2675 }
2676 #[no_mangle]
2677 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
2678         CResult_NonePeerHandleErrorZ {
2679                 contents: CResult_NonePeerHandleErrorZPtr {
2680                         result: std::ptr::null_mut(),
2681                 },
2682                 result_ok: true,
2683         }
2684 }
2685 #[no_mangle]
2686 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
2687         CResult_NonePeerHandleErrorZ {
2688                 contents: CResult_NonePeerHandleErrorZPtr {
2689                         err: Box::into_raw(Box::new(e)),
2690                 },
2691                 result_ok: false,
2692         }
2693 }
2694 #[no_mangle]
2695 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
2696 impl Drop for CResult_NonePeerHandleErrorZ {
2697         fn drop(&mut self) {
2698                 if self.result_ok {
2699                 } else {
2700                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2701                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2702                         }
2703                 }
2704         }
2705 }
2706 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
2707         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
2708                 let contents = if o.result_ok {
2709                         let _ = unsafe { Box::from_raw(o.contents.result) };
2710                         o.contents.result = std::ptr::null_mut();
2711                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
2712                 } else {
2713                         let err = unsafe { o.contents.err };
2714                         unsafe { o.contents.err = std::ptr::null_mut(); }
2715                         CResult_NonePeerHandleErrorZPtr { err }
2716                 };
2717                 Self {
2718                         contents,
2719                         result_ok: o.result_ok,
2720                 }
2721         }
2722 }
2723 #[repr(C)]
2724 pub union CResult_boolPeerHandleErrorZPtr {
2725         pub result: *mut bool,
2726         pub err: *mut crate::ln::peer_handler::PeerHandleError,
2727 }
2728 #[repr(C)]
2729 pub struct CResult_boolPeerHandleErrorZ {
2730         pub contents: CResult_boolPeerHandleErrorZPtr,
2731         pub result_ok: bool,
2732 }
2733 #[no_mangle]
2734 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
2735         CResult_boolPeerHandleErrorZ {
2736                 contents: CResult_boolPeerHandleErrorZPtr {
2737                         result: Box::into_raw(Box::new(o)),
2738                 },
2739                 result_ok: true,
2740         }
2741 }
2742 #[no_mangle]
2743 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
2744         CResult_boolPeerHandleErrorZ {
2745                 contents: CResult_boolPeerHandleErrorZPtr {
2746                         err: Box::into_raw(Box::new(e)),
2747                 },
2748                 result_ok: false,
2749         }
2750 }
2751 #[no_mangle]
2752 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
2753 impl Drop for CResult_boolPeerHandleErrorZ {
2754         fn drop(&mut self) {
2755                 if self.result_ok {
2756                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2757                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2758                         }
2759                 } else {
2760                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2761                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2762                         }
2763                 }
2764         }
2765 }
2766 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
2767         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
2768                 let contents = if o.result_ok {
2769                         let result = unsafe { o.contents.result };
2770                         unsafe { o.contents.result = std::ptr::null_mut() };
2771                         CResult_boolPeerHandleErrorZPtr { result }
2772                 } else {
2773                         let err = unsafe { o.contents.err };
2774                         unsafe { o.contents.err = std::ptr::null_mut(); }
2775                         CResult_boolPeerHandleErrorZPtr { err }
2776                 };
2777                 Self {
2778                         contents,
2779                         result_ok: o.result_ok,
2780                 }
2781         }
2782 }
2783 #[repr(C)]
2784 pub union CResult_SecretKeySecpErrorZPtr {
2785         pub result: *mut crate::c_types::SecretKey,
2786         pub err: *mut crate::c_types::Secp256k1Error,
2787 }
2788 #[repr(C)]
2789 pub struct CResult_SecretKeySecpErrorZ {
2790         pub contents: CResult_SecretKeySecpErrorZPtr,
2791         pub result_ok: bool,
2792 }
2793 #[no_mangle]
2794 pub extern "C" fn CResult_SecretKeySecpErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeySecpErrorZ {
2795         CResult_SecretKeySecpErrorZ {
2796                 contents: CResult_SecretKeySecpErrorZPtr {
2797                         result: Box::into_raw(Box::new(o)),
2798                 },
2799                 result_ok: true,
2800         }
2801 }
2802 #[no_mangle]
2803 pub extern "C" fn CResult_SecretKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeySecpErrorZ {
2804         CResult_SecretKeySecpErrorZ {
2805                 contents: CResult_SecretKeySecpErrorZPtr {
2806                         err: Box::into_raw(Box::new(e)),
2807                 },
2808                 result_ok: false,
2809         }
2810 }
2811 #[no_mangle]
2812 pub extern "C" fn CResult_SecretKeySecpErrorZ_free(_res: CResult_SecretKeySecpErrorZ) { }
2813 impl Drop for CResult_SecretKeySecpErrorZ {
2814         fn drop(&mut self) {
2815                 if self.result_ok {
2816                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2817                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2818                         }
2819                 } else {
2820                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2821                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2822                         }
2823                 }
2824         }
2825 }
2826 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeySecpErrorZ {
2827         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
2828                 let contents = if o.result_ok {
2829                         let result = unsafe { o.contents.result };
2830                         unsafe { o.contents.result = std::ptr::null_mut() };
2831                         CResult_SecretKeySecpErrorZPtr { result }
2832                 } else {
2833                         let err = unsafe { o.contents.err };
2834                         unsafe { o.contents.err = std::ptr::null_mut(); }
2835                         CResult_SecretKeySecpErrorZPtr { err }
2836                 };
2837                 Self {
2838                         contents,
2839                         result_ok: o.result_ok,
2840                 }
2841         }
2842 }
2843 #[repr(C)]
2844 pub union CResult_PublicKeySecpErrorZPtr {
2845         pub result: *mut crate::c_types::PublicKey,
2846         pub err: *mut crate::c_types::Secp256k1Error,
2847 }
2848 #[repr(C)]
2849 pub struct CResult_PublicKeySecpErrorZ {
2850         pub contents: CResult_PublicKeySecpErrorZPtr,
2851         pub result_ok: bool,
2852 }
2853 #[no_mangle]
2854 pub extern "C" fn CResult_PublicKeySecpErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecpErrorZ {
2855         CResult_PublicKeySecpErrorZ {
2856                 contents: CResult_PublicKeySecpErrorZPtr {
2857                         result: Box::into_raw(Box::new(o)),
2858                 },
2859                 result_ok: true,
2860         }
2861 }
2862 #[no_mangle]
2863 pub extern "C" fn CResult_PublicKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecpErrorZ {
2864         CResult_PublicKeySecpErrorZ {
2865                 contents: CResult_PublicKeySecpErrorZPtr {
2866                         err: Box::into_raw(Box::new(e)),
2867                 },
2868                 result_ok: false,
2869         }
2870 }
2871 #[no_mangle]
2872 pub extern "C" fn CResult_PublicKeySecpErrorZ_free(_res: CResult_PublicKeySecpErrorZ) { }
2873 impl Drop for CResult_PublicKeySecpErrorZ {
2874         fn drop(&mut self) {
2875                 if self.result_ok {
2876                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2877                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2878                         }
2879                 } else {
2880                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2881                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2882                         }
2883                 }
2884         }
2885 }
2886 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecpErrorZ {
2887         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
2888                 let contents = if o.result_ok {
2889                         let result = unsafe { o.contents.result };
2890                         unsafe { o.contents.result = std::ptr::null_mut() };
2891                         CResult_PublicKeySecpErrorZPtr { result }
2892                 } else {
2893                         let err = unsafe { o.contents.err };
2894                         unsafe { o.contents.err = std::ptr::null_mut(); }
2895                         CResult_PublicKeySecpErrorZPtr { err }
2896                 };
2897                 Self {
2898                         contents,
2899                         result_ok: o.result_ok,
2900                 }
2901         }
2902 }
2903 #[repr(C)]
2904 pub union CResult_TxCreationKeysSecpErrorZPtr {
2905         pub result: *mut crate::ln::chan_utils::TxCreationKeys,
2906         pub err: *mut crate::c_types::Secp256k1Error,
2907 }
2908 #[repr(C)]
2909 pub struct CResult_TxCreationKeysSecpErrorZ {
2910         pub contents: CResult_TxCreationKeysSecpErrorZPtr,
2911         pub result_ok: bool,
2912 }
2913 #[no_mangle]
2914 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysSecpErrorZ {
2915         CResult_TxCreationKeysSecpErrorZ {
2916                 contents: CResult_TxCreationKeysSecpErrorZPtr {
2917                         result: Box::into_raw(Box::new(o)),
2918                 },
2919                 result_ok: true,
2920         }
2921 }
2922 #[no_mangle]
2923 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysSecpErrorZ {
2924         CResult_TxCreationKeysSecpErrorZ {
2925                 contents: CResult_TxCreationKeysSecpErrorZPtr {
2926                         err: Box::into_raw(Box::new(e)),
2927                 },
2928                 result_ok: false,
2929         }
2930 }
2931 #[no_mangle]
2932 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_free(_res: CResult_TxCreationKeysSecpErrorZ) { }
2933 impl Drop for CResult_TxCreationKeysSecpErrorZ {
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::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysSecpErrorZ {
2947         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> 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_TxCreationKeysSecpErrorZPtr { result }
2952                 } else {
2953                         let err = unsafe { o.contents.err };
2954                         unsafe { o.contents.err = std::ptr::null_mut(); }
2955                         CResult_TxCreationKeysSecpErrorZPtr { err }
2956                 };
2957                 Self {
2958                         contents,
2959                         result_ok: o.result_ok,
2960                 }
2961         }
2962 }
2963 #[repr(C)]
2964 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
2965         pub result: *mut crate::ln::chan_utils::TrustedCommitmentTransaction,
2966         /// Note that this value is always NULL, as there are no contents in the Err variant
2967         pub err: *mut std::ffi::c_void,
2968 }
2969 #[repr(C)]
2970 pub struct CResult_TrustedCommitmentTransactionNoneZ {
2971         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
2972         pub result_ok: bool,
2973 }
2974 #[no_mangle]
2975 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
2976         CResult_TrustedCommitmentTransactionNoneZ {
2977                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
2978                         result: Box::into_raw(Box::new(o)),
2979                 },
2980                 result_ok: true,
2981         }
2982 }
2983 #[no_mangle]
2984 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
2985         CResult_TrustedCommitmentTransactionNoneZ {
2986                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
2987                         err: std::ptr::null_mut(),
2988                 },
2989                 result_ok: false,
2990         }
2991 }
2992 #[no_mangle]
2993 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
2994 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
2995         fn drop(&mut self) {
2996                 if self.result_ok {
2997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2999                         }
3000                 } else {
3001                 }
3002         }
3003 }
3004 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
3005         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> Self {
3006                 let contents = if o.result_ok {
3007                         let result = unsafe { o.contents.result };
3008                         unsafe { o.contents.result = std::ptr::null_mut() };
3009                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
3010                 } else {
3011                         let _ = unsafe { Box::from_raw(o.contents.err) };
3012                         o.contents.err = std::ptr::null_mut();
3013                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
3014                 };
3015                 Self {
3016                         contents,
3017                         result_ok: o.result_ok,
3018                 }
3019         }
3020 }
3021 #[repr(C)]
3022 pub struct CVec_RouteHopZ {
3023         pub data: *mut crate::routing::router::RouteHop,
3024         pub datalen: usize
3025 }
3026 impl CVec_RouteHopZ {
3027         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
3028                 if self.datalen == 0 { return Vec::new(); }
3029                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3030                 self.data = std::ptr::null_mut();
3031                 self.datalen = 0;
3032                 ret
3033         }
3034         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
3035                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3036         }
3037 }
3038 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
3039         fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
3040                 let datalen = v.len();
3041                 let data = Box::into_raw(v.into_boxed_slice());
3042                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3043         }
3044 }
3045 #[no_mangle]
3046 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3047 impl Drop for CVec_RouteHopZ {
3048         fn drop(&mut self) {
3049                 if self.datalen == 0 { return; }
3050                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3051         }
3052 }
3053 #[repr(C)]
3054 pub struct CVec_CVec_RouteHopZZ {
3055         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3056         pub datalen: usize
3057 }
3058 impl CVec_CVec_RouteHopZZ {
3059         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3060                 if self.datalen == 0 { return Vec::new(); }
3061                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3062                 self.data = std::ptr::null_mut();
3063                 self.datalen = 0;
3064                 ret
3065         }
3066         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3067                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3068         }
3069 }
3070 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3071         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3072                 let datalen = v.len();
3073                 let data = Box::into_raw(v.into_boxed_slice());
3074                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3075         }
3076 }
3077 #[no_mangle]
3078 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3079 impl Drop for CVec_CVec_RouteHopZZ {
3080         fn drop(&mut self) {
3081                 if self.datalen == 0 { return; }
3082                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3083         }
3084 }
3085 #[repr(C)]
3086 pub union CResult_RouteDecodeErrorZPtr {
3087         pub result: *mut crate::routing::router::Route,
3088         pub err: *mut crate::ln::msgs::DecodeError,
3089 }
3090 #[repr(C)]
3091 pub struct CResult_RouteDecodeErrorZ {
3092         pub contents: CResult_RouteDecodeErrorZPtr,
3093         pub result_ok: bool,
3094 }
3095 #[no_mangle]
3096 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3097         CResult_RouteDecodeErrorZ {
3098                 contents: CResult_RouteDecodeErrorZPtr {
3099                         result: Box::into_raw(Box::new(o)),
3100                 },
3101                 result_ok: true,
3102         }
3103 }
3104 #[no_mangle]
3105 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3106         CResult_RouteDecodeErrorZ {
3107                 contents: CResult_RouteDecodeErrorZPtr {
3108                         err: Box::into_raw(Box::new(e)),
3109                 },
3110                 result_ok: false,
3111         }
3112 }
3113 #[no_mangle]
3114 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3115 impl Drop for CResult_RouteDecodeErrorZ {
3116         fn drop(&mut self) {
3117                 if self.result_ok {
3118                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3119                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3120                         }
3121                 } else {
3122                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3123                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3124                         }
3125                 }
3126         }
3127 }
3128 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3129         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
3130                 let contents = if o.result_ok {
3131                         let result = unsafe { o.contents.result };
3132                         unsafe { o.contents.result = std::ptr::null_mut() };
3133                         CResult_RouteDecodeErrorZPtr { result }
3134                 } else {
3135                         let err = unsafe { o.contents.err };
3136                         unsafe { o.contents.err = std::ptr::null_mut(); }
3137                         CResult_RouteDecodeErrorZPtr { err }
3138                 };
3139                 Self {
3140                         contents,
3141                         result_ok: o.result_ok,
3142                 }
3143         }
3144 }
3145 #[repr(C)]
3146 pub struct CVec_RouteHintZ {
3147         pub data: *mut crate::routing::router::RouteHint,
3148         pub datalen: usize
3149 }
3150 impl CVec_RouteHintZ {
3151         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
3152                 if self.datalen == 0 { return Vec::new(); }
3153                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3154                 self.data = std::ptr::null_mut();
3155                 self.datalen = 0;
3156                 ret
3157         }
3158         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
3159                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3160         }
3161 }
3162 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
3163         fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
3164                 let datalen = v.len();
3165                 let data = Box::into_raw(v.into_boxed_slice());
3166                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3167         }
3168 }
3169 #[no_mangle]
3170 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3171 impl Drop for CVec_RouteHintZ {
3172         fn drop(&mut self) {
3173                 if self.datalen == 0 { return; }
3174                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3175         }
3176 }
3177 #[repr(C)]
3178 pub union CResult_RouteLightningErrorZPtr {
3179         pub result: *mut crate::routing::router::Route,
3180         pub err: *mut crate::ln::msgs::LightningError,
3181 }
3182 #[repr(C)]
3183 pub struct CResult_RouteLightningErrorZ {
3184         pub contents: CResult_RouteLightningErrorZPtr,
3185         pub result_ok: bool,
3186 }
3187 #[no_mangle]
3188 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
3189         CResult_RouteLightningErrorZ {
3190                 contents: CResult_RouteLightningErrorZPtr {
3191                         result: Box::into_raw(Box::new(o)),
3192                 },
3193                 result_ok: true,
3194         }
3195 }
3196 #[no_mangle]
3197 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3198         CResult_RouteLightningErrorZ {
3199                 contents: CResult_RouteLightningErrorZPtr {
3200                         err: Box::into_raw(Box::new(e)),
3201                 },
3202                 result_ok: false,
3203         }
3204 }
3205 #[no_mangle]
3206 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3207 impl Drop for CResult_RouteLightningErrorZ {
3208         fn drop(&mut self) {
3209                 if self.result_ok {
3210                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3211                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3212                         }
3213                 } else {
3214                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3215                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3216                         }
3217                 }
3218         }
3219 }
3220 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3221         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
3222                 let contents = if o.result_ok {
3223                         let result = unsafe { o.contents.result };
3224                         unsafe { o.contents.result = std::ptr::null_mut() };
3225                         CResult_RouteLightningErrorZPtr { result }
3226                 } else {
3227                         let err = unsafe { o.contents.err };
3228                         unsafe { o.contents.err = std::ptr::null_mut(); }
3229                         CResult_RouteLightningErrorZPtr { err }
3230                 };
3231                 Self {
3232                         contents,
3233                         result_ok: o.result_ok,
3234                 }
3235         }
3236 }
3237 #[repr(C)]
3238 pub union CResult_RoutingFeesDecodeErrorZPtr {
3239         pub result: *mut crate::routing::network_graph::RoutingFees,
3240         pub err: *mut crate::ln::msgs::DecodeError,
3241 }
3242 #[repr(C)]
3243 pub struct CResult_RoutingFeesDecodeErrorZ {
3244         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
3245         pub result_ok: bool,
3246 }
3247 #[no_mangle]
3248 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
3249         CResult_RoutingFeesDecodeErrorZ {
3250                 contents: CResult_RoutingFeesDecodeErrorZPtr {
3251                         result: Box::into_raw(Box::new(o)),
3252                 },
3253                 result_ok: true,
3254         }
3255 }
3256 #[no_mangle]
3257 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
3258         CResult_RoutingFeesDecodeErrorZ {
3259                 contents: CResult_RoutingFeesDecodeErrorZPtr {
3260                         err: Box::into_raw(Box::new(e)),
3261                 },
3262                 result_ok: false,
3263         }
3264 }
3265 #[no_mangle]
3266 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
3267 impl Drop for CResult_RoutingFeesDecodeErrorZ {
3268         fn drop(&mut self) {
3269                 if self.result_ok {
3270                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3271                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3272                         }
3273                 } else {
3274                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3275                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3276                         }
3277                 }
3278         }
3279 }
3280 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
3281         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
3282                 let contents = if o.result_ok {
3283                         let result = unsafe { o.contents.result };
3284                         unsafe { o.contents.result = std::ptr::null_mut() };
3285                         CResult_RoutingFeesDecodeErrorZPtr { result }
3286                 } else {
3287                         let err = unsafe { o.contents.err };
3288                         unsafe { o.contents.err = std::ptr::null_mut(); }
3289                         CResult_RoutingFeesDecodeErrorZPtr { err }
3290                 };
3291                 Self {
3292                         contents,
3293                         result_ok: o.result_ok,
3294                 }
3295         }
3296 }
3297 #[repr(C)]
3298 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
3299         pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
3300         pub err: *mut crate::ln::msgs::DecodeError,
3301 }
3302 #[repr(C)]
3303 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
3304         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
3305         pub result_ok: bool,
3306 }
3307 #[no_mangle]
3308 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
3309         CResult_NodeAnnouncementInfoDecodeErrorZ {
3310                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
3311                         result: Box::into_raw(Box::new(o)),
3312                 },
3313                 result_ok: true,
3314         }
3315 }
3316 #[no_mangle]
3317 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
3318         CResult_NodeAnnouncementInfoDecodeErrorZ {
3319                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
3320                         err: Box::into_raw(Box::new(e)),
3321                 },
3322                 result_ok: false,
3323         }
3324 }
3325 #[no_mangle]
3326 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
3327 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
3328         fn drop(&mut self) {
3329                 if self.result_ok {
3330                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3331                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3332                         }
3333                 } else {
3334                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3335                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3336                         }
3337                 }
3338         }
3339 }
3340 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
3341         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
3342                 let contents = if o.result_ok {
3343                         let result = unsafe { o.contents.result };
3344                         unsafe { o.contents.result = std::ptr::null_mut() };
3345                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
3346                 } else {
3347                         let err = unsafe { o.contents.err };
3348                         unsafe { o.contents.err = std::ptr::null_mut(); }
3349                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
3350                 };
3351                 Self {
3352                         contents,
3353                         result_ok: o.result_ok,
3354                 }
3355         }
3356 }
3357 #[repr(C)]
3358 pub union CResult_NodeInfoDecodeErrorZPtr {
3359         pub result: *mut crate::routing::network_graph::NodeInfo,
3360         pub err: *mut crate::ln::msgs::DecodeError,
3361 }
3362 #[repr(C)]
3363 pub struct CResult_NodeInfoDecodeErrorZ {
3364         pub contents: CResult_NodeInfoDecodeErrorZPtr,
3365         pub result_ok: bool,
3366 }
3367 #[no_mangle]
3368 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
3369         CResult_NodeInfoDecodeErrorZ {
3370                 contents: CResult_NodeInfoDecodeErrorZPtr {
3371                         result: Box::into_raw(Box::new(o)),
3372                 },
3373                 result_ok: true,
3374         }
3375 }
3376 #[no_mangle]
3377 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
3378         CResult_NodeInfoDecodeErrorZ {
3379                 contents: CResult_NodeInfoDecodeErrorZPtr {
3380                         err: Box::into_raw(Box::new(e)),
3381                 },
3382                 result_ok: false,
3383         }
3384 }
3385 #[no_mangle]
3386 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
3387 impl Drop for CResult_NodeInfoDecodeErrorZ {
3388         fn drop(&mut self) {
3389                 if self.result_ok {
3390                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3391                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3392                         }
3393                 } else {
3394                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3395                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3396                         }
3397                 }
3398         }
3399 }
3400 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
3401         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
3402                 let contents = if o.result_ok {
3403                         let result = unsafe { o.contents.result };
3404                         unsafe { o.contents.result = std::ptr::null_mut() };
3405                         CResult_NodeInfoDecodeErrorZPtr { result }
3406                 } else {
3407                         let err = unsafe { o.contents.err };
3408                         unsafe { o.contents.err = std::ptr::null_mut(); }
3409                         CResult_NodeInfoDecodeErrorZPtr { err }
3410                 };
3411                 Self {
3412                         contents,
3413                         result_ok: o.result_ok,
3414                 }
3415         }
3416 }
3417 #[repr(C)]
3418 pub union CResult_NetworkGraphDecodeErrorZPtr {
3419         pub result: *mut crate::routing::network_graph::NetworkGraph,
3420         pub err: *mut crate::ln::msgs::DecodeError,
3421 }
3422 #[repr(C)]
3423 pub struct CResult_NetworkGraphDecodeErrorZ {
3424         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
3425         pub result_ok: bool,
3426 }
3427 #[no_mangle]
3428 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
3429         CResult_NetworkGraphDecodeErrorZ {
3430                 contents: CResult_NetworkGraphDecodeErrorZPtr {
3431                         result: Box::into_raw(Box::new(o)),
3432                 },
3433                 result_ok: true,
3434         }
3435 }
3436 #[no_mangle]
3437 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
3438         CResult_NetworkGraphDecodeErrorZ {
3439                 contents: CResult_NetworkGraphDecodeErrorZPtr {
3440                         err: Box::into_raw(Box::new(e)),
3441                 },
3442                 result_ok: false,
3443         }
3444 }
3445 #[no_mangle]
3446 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
3447 impl Drop for CResult_NetworkGraphDecodeErrorZ {
3448         fn drop(&mut self) {
3449                 if self.result_ok {
3450                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3451                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3452                         }
3453                 } else {
3454                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3455                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3456                         }
3457                 }
3458         }
3459 }
3460 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
3461         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
3462                 let contents = if o.result_ok {
3463                         let result = unsafe { o.contents.result };
3464                         unsafe { o.contents.result = std::ptr::null_mut() };
3465                         CResult_NetworkGraphDecodeErrorZPtr { result }
3466                 } else {
3467                         let err = unsafe { o.contents.err };
3468                         unsafe { o.contents.err = std::ptr::null_mut(); }
3469                         CResult_NetworkGraphDecodeErrorZPtr { err }
3470                 };
3471                 Self {
3472                         contents,
3473                         result_ok: o.result_ok,
3474                 }
3475         }
3476 }