6c536ce1cffb48b0ead47e1164a2dc53235e3fa4
[rust-lightning] / lightning-c-bindings / src / c_types / derived.rs
1 pub type CVec_SpendableOutputDescriptorZ = crate::c_types::CVecTempl<crate::chain::keysinterface::SpendableOutputDescriptor>;
2 #[no_mangle]
3 pub static CVec_SpendableOutputDescriptorZ_free: extern "C" fn(CVec_SpendableOutputDescriptorZ) = crate::c_types::CVecTempl_free::<crate::chain::keysinterface::SpendableOutputDescriptor>;
4
5 pub type CVec_MessageSendEventZ = crate::c_types::CVecTempl<crate::util::events::MessageSendEvent>;
6 #[no_mangle]
7 pub static CVec_MessageSendEventZ_free: extern "C" fn(CVec_MessageSendEventZ) = crate::c_types::CVecTempl_free::<crate::util::events::MessageSendEvent>;
8
9 pub type CVec_EventZ = crate::c_types::CVecTempl<crate::util::events::Event>;
10 #[no_mangle]
11 pub static CVec_EventZ_free: extern "C" fn(CVec_EventZ) = crate::c_types::CVecTempl_free::<crate::util::events::Event>;
12
13 pub type C2Tuple_usizeTransactionZ = crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>;
14 #[no_mangle]
15 pub static C2Tuple_usizeTransactionZ_free: extern "C" fn(C2Tuple_usizeTransactionZ) = crate::c_types::C2TupleTempl_free::<usize, crate::c_types::Transaction>;
16 #[no_mangle]
17 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
18         C2Tuple_usizeTransactionZ { a, b, }
19 }
20
21 pub type CVec_C2Tuple_usizeTransactionZZ = crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>>;
22 #[no_mangle]
23 pub static CVec_C2Tuple_usizeTransactionZZ_free: extern "C" fn(CVec_C2Tuple_usizeTransactionZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C2TupleTempl<usize, crate::c_types::Transaction>>;
24
25 #[repr(C)]
26 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
27         /// Note that this value is always NULL, as there are no contents in the OK variant
28         pub result: *mut std::ffi::c_void,
29         pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
30 }
31 #[repr(C)]
32 pub struct CResult_NoneChannelMonitorUpdateErrZ {
33         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
34         pub result_ok: bool,
35 }
36 #[no_mangle]
37 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
38         CResult_NoneChannelMonitorUpdateErrZ {
39                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
40                         result: std::ptr::null_mut(),
41                 },
42                 result_ok: true,
43         }
44 }
45 #[no_mangle]
46 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
47         CResult_NoneChannelMonitorUpdateErrZ {
48                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
49                         err: Box::into_raw(Box::new(e)),
50                 },
51                 result_ok: false,
52         }
53 }
54 #[no_mangle]
55 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
56 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
57         fn drop(&mut self) {
58                 if self.result_ok {
59                 } else {
60                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
61                                 let _ = unsafe { Box::from_raw(self.contents.err) };
62                         }
63                 }
64         }
65 }
66 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
67         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
68                 let contents = if o.result_ok {
69                         let _ = unsafe { Box::from_raw(o.contents.result) };
70                         o.contents.result = std::ptr::null_mut();
71                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
72                 } else {
73                         let err = unsafe { o.contents.err };
74                         unsafe { o.contents.err = std::ptr::null_mut(); }
75                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
76                 };
77                 Self {
78                         contents,
79                         result_ok: o.result_ok,
80                 }
81         }
82 }
83 pub type CVec_MonitorEventZ = crate::c_types::CVecTempl<crate::chain::channelmonitor::MonitorEvent>;
84 #[no_mangle]
85 pub static CVec_MonitorEventZ_free: extern "C" fn(CVec_MonitorEventZ) = crate::c_types::CVecTempl_free::<crate::chain::channelmonitor::MonitorEvent>;
86
87 #[repr(C)]
88 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
89         pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
90         pub err: *mut crate::ln::msgs::DecodeError,
91 }
92 #[repr(C)]
93 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
94         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
95         pub result_ok: bool,
96 }
97 #[no_mangle]
98 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
99         CResult_ChannelMonitorUpdateDecodeErrorZ {
100                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
101                         result: Box::into_raw(Box::new(o)),
102                 },
103                 result_ok: true,
104         }
105 }
106 #[no_mangle]
107 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
108         CResult_ChannelMonitorUpdateDecodeErrorZ {
109                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
110                         err: Box::into_raw(Box::new(e)),
111                 },
112                 result_ok: false,
113         }
114 }
115 #[no_mangle]
116 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
117 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
118         fn drop(&mut self) {
119                 if self.result_ok {
120                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
121                                 let _ = unsafe { Box::from_raw(self.contents.result) };
122                         }
123                 } else {
124                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
125                                 let _ = unsafe { Box::from_raw(self.contents.err) };
126                         }
127                 }
128         }
129 }
130 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
131         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
132                 let contents = if o.result_ok {
133                         let result = unsafe { o.contents.result };
134                         unsafe { o.contents.result = std::ptr::null_mut() };
135                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
136                 } else {
137                         let err = unsafe { o.contents.err };
138                         unsafe { o.contents.err = std::ptr::null_mut(); }
139                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
140                 };
141                 Self {
142                         contents,
143                         result_ok: o.result_ok,
144                 }
145         }
146 }
147 #[repr(C)]
148 pub union CResult_NoneMonitorUpdateErrorZPtr {
149         /// Note that this value is always NULL, as there are no contents in the OK variant
150         pub result: *mut std::ffi::c_void,
151         pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
152 }
153 #[repr(C)]
154 pub struct CResult_NoneMonitorUpdateErrorZ {
155         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
156         pub result_ok: bool,
157 }
158 #[no_mangle]
159 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
160         CResult_NoneMonitorUpdateErrorZ {
161                 contents: CResult_NoneMonitorUpdateErrorZPtr {
162                         result: std::ptr::null_mut(),
163                 },
164                 result_ok: true,
165         }
166 }
167 #[no_mangle]
168 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
169         CResult_NoneMonitorUpdateErrorZ {
170                 contents: CResult_NoneMonitorUpdateErrorZPtr {
171                         err: Box::into_raw(Box::new(e)),
172                 },
173                 result_ok: false,
174         }
175 }
176 #[no_mangle]
177 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
178 impl Drop for CResult_NoneMonitorUpdateErrorZ {
179         fn drop(&mut self) {
180                 if self.result_ok {
181                 } else {
182                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
183                                 let _ = unsafe { Box::from_raw(self.contents.err) };
184                         }
185                 }
186         }
187 }
188 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
189         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
190                 let contents = if o.result_ok {
191                         let _ = unsafe { Box::from_raw(o.contents.result) };
192                         o.contents.result = std::ptr::null_mut();
193                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
194                 } else {
195                         let err = unsafe { o.contents.err };
196                         unsafe { o.contents.err = std::ptr::null_mut(); }
197                         CResult_NoneMonitorUpdateErrorZPtr { err }
198                 };
199                 Self {
200                         contents,
201                         result_ok: o.result_ok,
202                 }
203         }
204 }
205 pub type C2Tuple_OutPointScriptZ = crate::c_types::C2TupleTempl<crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z>;
206 #[no_mangle]
207 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>;
208 #[no_mangle]
209 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
210         C2Tuple_OutPointScriptZ { a, b, }
211 }
212
213 pub type CVec_TransactionZ = crate::c_types::CVecTempl<crate::c_types::Transaction>;
214 #[no_mangle]
215 pub static CVec_TransactionZ_free: extern "C" fn(CVec_TransactionZ) = crate::c_types::CVecTempl_free::<crate::c_types::Transaction>;
216
217 pub type C2Tuple_u32TxOutZ = crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>;
218 #[no_mangle]
219 pub static C2Tuple_u32TxOutZ_free: extern "C" fn(C2Tuple_u32TxOutZ) = crate::c_types::C2TupleTempl_free::<u32, crate::c_types::TxOut>;
220 #[no_mangle]
221 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
222         C2Tuple_u32TxOutZ { a, b, }
223 }
224
225 pub type CVec_C2Tuple_u32TxOutZZ = crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>;
226 #[no_mangle]
227 pub static CVec_C2Tuple_u32TxOutZZ_free: extern "C" fn(CVec_C2Tuple_u32TxOutZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>;
228
229 pub type C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>;
230 #[no_mangle]
231 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::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>;
232 #[no_mangle]
233 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 {
234         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
235 }
236
237 pub type CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ = crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>>;
238 #[no_mangle]
239 pub static CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free: extern "C" fn(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::c_types::CVecTempl<crate::c_types::C2TupleTempl<u32, crate::c_types::TxOut>>>>;
240
241 pub type C2Tuple_BlockHashChannelMonitorZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>;
242 #[no_mangle]
243 pub static C2Tuple_BlockHashChannelMonitorZ_free: extern "C" fn(C2Tuple_BlockHashChannelMonitorZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>;
244 #[no_mangle]
245 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
246         C2Tuple_BlockHashChannelMonitorZ { a, b, }
247 }
248
249 #[repr(C)]
250 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
251         pub result: *mut crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>,
252         pub err: *mut crate::ln::msgs::DecodeError,
253 }
254 #[repr(C)]
255 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
256         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
257         pub result_ok: bool,
258 }
259 #[no_mangle]
260 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor>) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
261         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
262                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
263                         result: Box::into_raw(Box::new(o)),
264                 },
265                 result_ok: true,
266         }
267 }
268 #[no_mangle]
269 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
270         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
271                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
272                         err: Box::into_raw(Box::new(e)),
273                 },
274                 result_ok: false,
275         }
276 }
277 #[no_mangle]
278 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
279 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
280         fn drop(&mut self) {
281                 if self.result_ok {
282                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
283                                 let _ = unsafe { Box::from_raw(self.contents.result) };
284                         }
285                 } else {
286                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
287                                 let _ = unsafe { Box::from_raw(self.contents.err) };
288                         }
289                 }
290         }
291 }
292 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 {
293         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 {
294                 let contents = if o.result_ok {
295                         let result = unsafe { o.contents.result };
296                         unsafe { o.contents.result = std::ptr::null_mut() };
297                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
298                 } else {
299                         let err = unsafe { o.contents.err };
300                         unsafe { o.contents.err = std::ptr::null_mut(); }
301                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
302                 };
303                 Self {
304                         contents,
305                         result_ok: o.result_ok,
306                 }
307         }
308 }
309 pub type C2Tuple_u64u64Z = crate::c_types::C2TupleTempl<u64, u64>;
310 #[no_mangle]
311 pub static C2Tuple_u64u64Z_free: extern "C" fn(C2Tuple_u64u64Z) = crate::c_types::C2TupleTempl_free::<u64, u64>;
312 #[no_mangle]
313 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
314         C2Tuple_u64u64Z { a, b, }
315 }
316
317 #[repr(C)]
318 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
319         pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
320         pub err: *mut crate::ln::msgs::DecodeError,
321 }
322 #[repr(C)]
323 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
324         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
325         pub result_ok: bool,
326 }
327 #[no_mangle]
328 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
329         CResult_SpendableOutputDescriptorDecodeErrorZ {
330                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
331                         result: Box::into_raw(Box::new(o)),
332                 },
333                 result_ok: true,
334         }
335 }
336 #[no_mangle]
337 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
338         CResult_SpendableOutputDescriptorDecodeErrorZ {
339                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
340                         err: Box::into_raw(Box::new(e)),
341                 },
342                 result_ok: false,
343         }
344 }
345 #[no_mangle]
346 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
347 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
348         fn drop(&mut self) {
349                 if self.result_ok {
350                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
351                                 let _ = unsafe { Box::from_raw(self.contents.result) };
352                         }
353                 } else {
354                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
355                                 let _ = unsafe { Box::from_raw(self.contents.err) };
356                         }
357                 }
358         }
359 }
360 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
361         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
362                 let contents = if o.result_ok {
363                         let result = unsafe { o.contents.result };
364                         unsafe { o.contents.result = std::ptr::null_mut() };
365                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
366                 } else {
367                         let err = unsafe { o.contents.err };
368                         unsafe { o.contents.err = std::ptr::null_mut(); }
369                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
370                 };
371                 Self {
372                         contents,
373                         result_ok: o.result_ok,
374                 }
375         }
376 }
377 pub type CVec_SignatureZ = crate::c_types::CVecTempl<crate::c_types::Signature>;
378 #[no_mangle]
379 pub static CVec_SignatureZ_free: extern "C" fn(CVec_SignatureZ) = crate::c_types::CVecTempl_free::<crate::c_types::Signature>;
380
381 pub type C2Tuple_SignatureCVec_SignatureZZ = crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::CVecTempl<crate::c_types::Signature>>;
382 #[no_mangle]
383 pub static C2Tuple_SignatureCVec_SignatureZZ_free: extern "C" fn(C2Tuple_SignatureCVec_SignatureZZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::Signature, crate::c_types::CVecTempl<crate::c_types::Signature>>;
384 #[no_mangle]
385 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
386         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
387 }
388
389 #[repr(C)]
390 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
391         pub result: *mut crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::CVecTempl<crate::c_types::Signature>>,
392         /// Note that this value is always NULL, as there are no contents in the Err variant
393         pub err: *mut std::ffi::c_void,
394 }
395 #[repr(C)]
396 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
397         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
398         pub result_ok: bool,
399 }
400 #[no_mangle]
401 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::CVecTempl<crate::c_types::Signature>>) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
402         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
403                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
404                         result: Box::into_raw(Box::new(o)),
405                 },
406                 result_ok: true,
407         }
408 }
409 #[no_mangle]
410 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
411         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
412                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
413                         err: std::ptr::null_mut(),
414                 },
415                 result_ok: false,
416         }
417 }
418 #[no_mangle]
419 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
420 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
421         fn drop(&mut self) {
422                 if self.result_ok {
423                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
424                                 let _ = unsafe { Box::from_raw(self.contents.result) };
425                         }
426                 } else {
427                 }
428         }
429 }
430 impl From<crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::CVecTempl<crate::c_types::Signature>>, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
431         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::C2TupleTempl<crate::c_types::Signature, crate::c_types::CVecTempl<crate::c_types::Signature>>, u8>) -> Self {
432                 let contents = if o.result_ok {
433                         let result = unsafe { o.contents.result };
434                         unsafe { o.contents.result = std::ptr::null_mut() };
435                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
436                 } else {
437                         let _ = unsafe { Box::from_raw(o.contents.err) };
438                         o.contents.err = std::ptr::null_mut();
439                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
440                 };
441                 Self {
442                         contents,
443                         result_ok: o.result_ok,
444                 }
445         }
446 }
447 #[repr(C)]
448 pub union CResult_SignatureNoneZPtr {
449         pub result: *mut crate::c_types::Signature,
450         /// Note that this value is always NULL, as there are no contents in the Err variant
451         pub err: *mut std::ffi::c_void,
452 }
453 #[repr(C)]
454 pub struct CResult_SignatureNoneZ {
455         pub contents: CResult_SignatureNoneZPtr,
456         pub result_ok: bool,
457 }
458 #[no_mangle]
459 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
460         CResult_SignatureNoneZ {
461                 contents: CResult_SignatureNoneZPtr {
462                         result: Box::into_raw(Box::new(o)),
463                 },
464                 result_ok: true,
465         }
466 }
467 #[no_mangle]
468 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
469         CResult_SignatureNoneZ {
470                 contents: CResult_SignatureNoneZPtr {
471                         err: std::ptr::null_mut(),
472                 },
473                 result_ok: false,
474         }
475 }
476 #[no_mangle]
477 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
478 impl Drop for CResult_SignatureNoneZ {
479         fn drop(&mut self) {
480                 if self.result_ok {
481                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
482                                 let _ = unsafe { Box::from_raw(self.contents.result) };
483                         }
484                 } else {
485                 }
486         }
487 }
488 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
489         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
490                 let contents = if o.result_ok {
491                         let result = unsafe { o.contents.result };
492                         unsafe { o.contents.result = std::ptr::null_mut() };
493                         CResult_SignatureNoneZPtr { result }
494                 } else {
495                         let _ = unsafe { Box::from_raw(o.contents.err) };
496                         o.contents.err = std::ptr::null_mut();
497                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
498                 };
499                 Self {
500                         contents,
501                         result_ok: o.result_ok,
502                 }
503         }
504 }
505 #[repr(C)]
506 pub union CResult_CVec_SignatureZNoneZPtr {
507         pub result: *mut crate::c_types::CVecTempl<crate::c_types::Signature>,
508         /// Note that this value is always NULL, as there are no contents in the Err variant
509         pub err: *mut std::ffi::c_void,
510 }
511 #[repr(C)]
512 pub struct CResult_CVec_SignatureZNoneZ {
513         pub contents: CResult_CVec_SignatureZNoneZPtr,
514         pub result_ok: bool,
515 }
516 #[no_mangle]
517 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::CVecTempl<crate::c_types::Signature>) -> CResult_CVec_SignatureZNoneZ {
518         CResult_CVec_SignatureZNoneZ {
519                 contents: CResult_CVec_SignatureZNoneZPtr {
520                         result: Box::into_raw(Box::new(o)),
521                 },
522                 result_ok: true,
523         }
524 }
525 #[no_mangle]
526 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
527         CResult_CVec_SignatureZNoneZ {
528                 contents: CResult_CVec_SignatureZNoneZPtr {
529                         err: std::ptr::null_mut(),
530                 },
531                 result_ok: false,
532         }
533 }
534 #[no_mangle]
535 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
536 impl Drop for CResult_CVec_SignatureZNoneZ {
537         fn drop(&mut self) {
538                 if self.result_ok {
539                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
540                                 let _ = unsafe { Box::from_raw(self.contents.result) };
541                         }
542                 } else {
543                 }
544         }
545 }
546 impl From<crate::c_types::CResultTempl<crate::c_types::CVecTempl<crate::c_types::Signature>, u8>> for CResult_CVec_SignatureZNoneZ {
547         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::CVecTempl<crate::c_types::Signature>, u8>) -> Self {
548                 let contents = if o.result_ok {
549                         let result = unsafe { o.contents.result };
550                         unsafe { o.contents.result = std::ptr::null_mut() };
551                         CResult_CVec_SignatureZNoneZPtr { result }
552                 } else {
553                         let _ = unsafe { Box::from_raw(o.contents.err) };
554                         o.contents.err = std::ptr::null_mut();
555                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
556                 };
557                 Self {
558                         contents,
559                         result_ok: o.result_ok,
560                 }
561         }
562 }
563 #[repr(C)]
564 pub union CResult_ChanKeySignerDecodeErrorZPtr {
565         pub result: *mut crate::chain::keysinterface::ChannelKeys,
566         pub err: *mut crate::ln::msgs::DecodeError,
567 }
568 #[repr(C)]
569 pub struct CResult_ChanKeySignerDecodeErrorZ {
570         pub contents: CResult_ChanKeySignerDecodeErrorZPtr,
571         pub result_ok: bool,
572 }
573 #[no_mangle]
574 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::ChannelKeys) -> CResult_ChanKeySignerDecodeErrorZ {
575         CResult_ChanKeySignerDecodeErrorZ {
576                 contents: CResult_ChanKeySignerDecodeErrorZPtr {
577                         result: Box::into_raw(Box::new(o)),
578                 },
579                 result_ok: true,
580         }
581 }
582 #[no_mangle]
583 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChanKeySignerDecodeErrorZ {
584         CResult_ChanKeySignerDecodeErrorZ {
585                 contents: CResult_ChanKeySignerDecodeErrorZPtr {
586                         err: Box::into_raw(Box::new(e)),
587                 },
588                 result_ok: false,
589         }
590 }
591 #[no_mangle]
592 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_free(_res: CResult_ChanKeySignerDecodeErrorZ) { }
593 impl Drop for CResult_ChanKeySignerDecodeErrorZ {
594         fn drop(&mut self) {
595                 if self.result_ok {
596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
598                         }
599                 } else {
600                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
601                                 let _ = unsafe { Box::from_raw(self.contents.err) };
602                         }
603                 }
604         }
605 }
606 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>> for CResult_ChanKeySignerDecodeErrorZ {
607         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
608                 let contents = if o.result_ok {
609                         let result = unsafe { o.contents.result };
610                         unsafe { o.contents.result = std::ptr::null_mut() };
611                         CResult_ChanKeySignerDecodeErrorZPtr { result }
612                 } else {
613                         let err = unsafe { o.contents.err };
614                         unsafe { o.contents.err = std::ptr::null_mut(); }
615                         CResult_ChanKeySignerDecodeErrorZPtr { err }
616                 };
617                 Self {
618                         contents,
619                         result_ok: o.result_ok,
620                 }
621         }
622 }
623 #[repr(C)]
624 pub union CResult_InMemoryChannelKeysDecodeErrorZPtr {
625         pub result: *mut crate::chain::keysinterface::InMemoryChannelKeys,
626         pub err: *mut crate::ln::msgs::DecodeError,
627 }
628 #[repr(C)]
629 pub struct CResult_InMemoryChannelKeysDecodeErrorZ {
630         pub contents: CResult_InMemoryChannelKeysDecodeErrorZPtr,
631         pub result_ok: bool,
632 }
633 #[no_mangle]
634 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemoryChannelKeys) -> CResult_InMemoryChannelKeysDecodeErrorZ {
635         CResult_InMemoryChannelKeysDecodeErrorZ {
636                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
637                         result: Box::into_raw(Box::new(o)),
638                 },
639                 result_ok: true,
640         }
641 }
642 #[no_mangle]
643 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemoryChannelKeysDecodeErrorZ {
644         CResult_InMemoryChannelKeysDecodeErrorZ {
645                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
646                         err: Box::into_raw(Box::new(e)),
647                 },
648                 result_ok: false,
649         }
650 }
651 #[no_mangle]
652 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_free(_res: CResult_InMemoryChannelKeysDecodeErrorZ) { }
653 impl Drop for CResult_InMemoryChannelKeysDecodeErrorZ {
654         fn drop(&mut self) {
655                 if self.result_ok {
656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
658                         }
659                 } else {
660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
662                         }
663                 }
664         }
665 }
666 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>> for CResult_InMemoryChannelKeysDecodeErrorZ {
667         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
668                 let contents = if o.result_ok {
669                         let result = unsafe { o.contents.result };
670                         unsafe { o.contents.result = std::ptr::null_mut() };
671                         CResult_InMemoryChannelKeysDecodeErrorZPtr { result }
672                 } else {
673                         let err = unsafe { o.contents.err };
674                         unsafe { o.contents.err = std::ptr::null_mut(); }
675                         CResult_InMemoryChannelKeysDecodeErrorZPtr { err }
676                 };
677                 Self {
678                         contents,
679                         result_ok: o.result_ok,
680                 }
681         }
682 }
683 #[repr(C)]
684 pub union CResult_TxOutAccessErrorZPtr {
685         pub result: *mut crate::c_types::TxOut,
686         pub err: *mut crate::chain::AccessError,
687 }
688 #[repr(C)]
689 pub struct CResult_TxOutAccessErrorZ {
690         pub contents: CResult_TxOutAccessErrorZPtr,
691         pub result_ok: bool,
692 }
693 #[no_mangle]
694 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
695         CResult_TxOutAccessErrorZ {
696                 contents: CResult_TxOutAccessErrorZPtr {
697                         result: Box::into_raw(Box::new(o)),
698                 },
699                 result_ok: true,
700         }
701 }
702 #[no_mangle]
703 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
704         CResult_TxOutAccessErrorZ {
705                 contents: CResult_TxOutAccessErrorZPtr {
706                         err: Box::into_raw(Box::new(e)),
707                 },
708                 result_ok: false,
709         }
710 }
711 #[no_mangle]
712 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
713 impl Drop for CResult_TxOutAccessErrorZ {
714         fn drop(&mut self) {
715                 if self.result_ok {
716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
718                         }
719                 } else {
720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
722                         }
723                 }
724         }
725 }
726 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
727         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
728                 let contents = if o.result_ok {
729                         let result = unsafe { o.contents.result };
730                         unsafe { o.contents.result = std::ptr::null_mut() };
731                         CResult_TxOutAccessErrorZPtr { result }
732                 } else {
733                         let err = unsafe { o.contents.err };
734                         unsafe { o.contents.err = std::ptr::null_mut(); }
735                         CResult_TxOutAccessErrorZPtr { err }
736                 };
737                 Self {
738                         contents,
739                         result_ok: o.result_ok,
740                 }
741         }
742 }
743 #[repr(C)]
744 pub union CResult_NoneAPIErrorZPtr {
745         /// Note that this value is always NULL, as there are no contents in the OK variant
746         pub result: *mut std::ffi::c_void,
747         pub err: *mut crate::util::errors::APIError,
748 }
749 #[repr(C)]
750 pub struct CResult_NoneAPIErrorZ {
751         pub contents: CResult_NoneAPIErrorZPtr,
752         pub result_ok: bool,
753 }
754 #[no_mangle]
755 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
756         CResult_NoneAPIErrorZ {
757                 contents: CResult_NoneAPIErrorZPtr {
758                         result: std::ptr::null_mut(),
759                 },
760                 result_ok: true,
761         }
762 }
763 #[no_mangle]
764 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
765         CResult_NoneAPIErrorZ {
766                 contents: CResult_NoneAPIErrorZPtr {
767                         err: Box::into_raw(Box::new(e)),
768                 },
769                 result_ok: false,
770         }
771 }
772 #[no_mangle]
773 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
774 impl Drop for CResult_NoneAPIErrorZ {
775         fn drop(&mut self) {
776                 if self.result_ok {
777                 } else {
778                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
779                                 let _ = unsafe { Box::from_raw(self.contents.err) };
780                         }
781                 }
782         }
783 }
784 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
785         fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
786                 let contents = if o.result_ok {
787                         let _ = unsafe { Box::from_raw(o.contents.result) };
788                         o.contents.result = std::ptr::null_mut();
789                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
790                 } else {
791                         let err = unsafe { o.contents.err };
792                         unsafe { o.contents.err = std::ptr::null_mut(); }
793                         CResult_NoneAPIErrorZPtr { err }
794                 };
795                 Self {
796                         contents,
797                         result_ok: o.result_ok,
798                 }
799         }
800 }
801 pub type CVec_ChannelDetailsZ = crate::c_types::CVecTempl<crate::ln::channelmanager::ChannelDetails>;
802 #[no_mangle]
803 pub static CVec_ChannelDetailsZ_free: extern "C" fn(CVec_ChannelDetailsZ) = crate::c_types::CVecTempl_free::<crate::ln::channelmanager::ChannelDetails>;
804
805 #[repr(C)]
806 pub union CResult_NonePaymentSendFailureZPtr {
807         /// Note that this value is always NULL, as there are no contents in the OK variant
808         pub result: *mut std::ffi::c_void,
809         pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
810 }
811 #[repr(C)]
812 pub struct CResult_NonePaymentSendFailureZ {
813         pub contents: CResult_NonePaymentSendFailureZPtr,
814         pub result_ok: bool,
815 }
816 #[no_mangle]
817 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
818         CResult_NonePaymentSendFailureZ {
819                 contents: CResult_NonePaymentSendFailureZPtr {
820                         result: std::ptr::null_mut(),
821                 },
822                 result_ok: true,
823         }
824 }
825 #[no_mangle]
826 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
827         CResult_NonePaymentSendFailureZ {
828                 contents: CResult_NonePaymentSendFailureZPtr {
829                         err: Box::into_raw(Box::new(e)),
830                 },
831                 result_ok: false,
832         }
833 }
834 #[no_mangle]
835 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
836 impl Drop for CResult_NonePaymentSendFailureZ {
837         fn drop(&mut self) {
838                 if self.result_ok {
839                 } else {
840                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
841                                 let _ = unsafe { Box::from_raw(self.contents.err) };
842                         }
843                 }
844         }
845 }
846 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
847         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
848                 let contents = if o.result_ok {
849                         let _ = unsafe { Box::from_raw(o.contents.result) };
850                         o.contents.result = std::ptr::null_mut();
851                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
852                 } else {
853                         let err = unsafe { o.contents.err };
854                         unsafe { o.contents.err = std::ptr::null_mut(); }
855                         CResult_NonePaymentSendFailureZPtr { err }
856                 };
857                 Self {
858                         contents,
859                         result_ok: o.result_ok,
860                 }
861         }
862 }
863 pub type CVec_NetAddressZ = crate::c_types::CVecTempl<crate::ln::msgs::NetAddress>;
864 #[no_mangle]
865 pub static CVec_NetAddressZ_free: extern "C" fn(CVec_NetAddressZ) = crate::c_types::CVecTempl_free::<crate::ln::msgs::NetAddress>;
866
867 pub type CVec_ChannelMonitorZ = crate::c_types::CVecTempl<crate::chain::channelmonitor::ChannelMonitor>;
868 #[no_mangle]
869 pub static CVec_ChannelMonitorZ_free: extern "C" fn(CVec_ChannelMonitorZ) = crate::c_types::CVecTempl_free::<crate::chain::channelmonitor::ChannelMonitor>;
870
871 pub type C2Tuple_BlockHashChannelManagerZ = crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>;
872 #[no_mangle]
873 pub static C2Tuple_BlockHashChannelManagerZ_free: extern "C" fn(C2Tuple_BlockHashChannelManagerZ) = crate::c_types::C2TupleTempl_free::<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>;
874 #[no_mangle]
875 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
876         C2Tuple_BlockHashChannelManagerZ { a, b, }
877 }
878
879 #[repr(C)]
880 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
881         pub result: *mut crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>,
882         pub err: *mut crate::ln::msgs::DecodeError,
883 }
884 #[repr(C)]
885 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
886         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
887         pub result_ok: bool,
888 }
889 #[no_mangle]
890 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
891         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
892                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
893                         result: Box::into_raw(Box::new(o)),
894                 },
895                 result_ok: true,
896         }
897 }
898 #[no_mangle]
899 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
900         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
901                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
902                         err: Box::into_raw(Box::new(e)),
903                 },
904                 result_ok: false,
905         }
906 }
907 #[no_mangle]
908 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
909 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
910         fn drop(&mut self) {
911                 if self.result_ok {
912                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
913                                 let _ = unsafe { Box::from_raw(self.contents.result) };
914                         }
915                 } else {
916                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
917                                 let _ = unsafe { Box::from_raw(self.contents.err) };
918                         }
919                 }
920         }
921 }
922 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 {
923         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 {
924                 let contents = if o.result_ok {
925                         let result = unsafe { o.contents.result };
926                         unsafe { o.contents.result = std::ptr::null_mut() };
927                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
928                 } else {
929                         let err = unsafe { o.contents.err };
930                         unsafe { o.contents.err = std::ptr::null_mut(); }
931                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
932                 };
933                 Self {
934                         contents,
935                         result_ok: o.result_ok,
936                 }
937         }
938 }
939 #[repr(C)]
940 pub union CResult_NetAddressu8ZPtr {
941         pub result: *mut crate::ln::msgs::NetAddress,
942         pub err: *mut u8,
943 }
944 #[repr(C)]
945 pub struct CResult_NetAddressu8Z {
946         pub contents: CResult_NetAddressu8ZPtr,
947         pub result_ok: bool,
948 }
949 #[no_mangle]
950 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
951         CResult_NetAddressu8Z {
952                 contents: CResult_NetAddressu8ZPtr {
953                         result: Box::into_raw(Box::new(o)),
954                 },
955                 result_ok: true,
956         }
957 }
958 #[no_mangle]
959 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
960         CResult_NetAddressu8Z {
961                 contents: CResult_NetAddressu8ZPtr {
962                         err: Box::into_raw(Box::new(e)),
963                 },
964                 result_ok: false,
965         }
966 }
967 #[no_mangle]
968 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
969 impl Drop for CResult_NetAddressu8Z {
970         fn drop(&mut self) {
971                 if self.result_ok {
972                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
973                                 let _ = unsafe { Box::from_raw(self.contents.result) };
974                         }
975                 } else {
976                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
977                                 let _ = unsafe { Box::from_raw(self.contents.err) };
978                         }
979                 }
980         }
981 }
982 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
983         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
984                 let contents = if o.result_ok {
985                         let result = unsafe { o.contents.result };
986                         unsafe { o.contents.result = std::ptr::null_mut() };
987                         CResult_NetAddressu8ZPtr { result }
988                 } else {
989                         let err = unsafe { o.contents.err };
990                         unsafe { o.contents.err = std::ptr::null_mut(); }
991                         CResult_NetAddressu8ZPtr { err }
992                 };
993                 Self {
994                         contents,
995                         result_ok: o.result_ok,
996                 }
997         }
998 }
999 #[repr(C)]
1000 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1001         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
1002         pub err: *mut crate::ln::msgs::DecodeError,
1003 }
1004 #[repr(C)]
1005 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
1006         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
1007         pub result_ok: bool,
1008 }
1009 #[no_mangle]
1010 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1011         CResult_CResult_NetAddressu8ZDecodeErrorZ {
1012                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1013                         result: Box::into_raw(Box::new(o)),
1014                 },
1015                 result_ok: true,
1016         }
1017 }
1018 #[no_mangle]
1019 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1020         CResult_CResult_NetAddressu8ZDecodeErrorZ {
1021                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1022                         err: Box::into_raw(Box::new(e)),
1023                 },
1024                 result_ok: false,
1025         }
1026 }
1027 #[no_mangle]
1028 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
1029 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1030         fn drop(&mut self) {
1031                 if self.result_ok {
1032                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1033                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1034                         }
1035                 } else {
1036                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1037                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1038                         }
1039                 }
1040         }
1041 }
1042 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1043         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
1044                 let contents = if o.result_ok {
1045                         let result = unsafe { o.contents.result };
1046                         unsafe { o.contents.result = std::ptr::null_mut() };
1047                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
1048                 } else {
1049                         let err = unsafe { o.contents.err };
1050                         unsafe { o.contents.err = std::ptr::null_mut(); }
1051                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
1052                 };
1053                 Self {
1054                         contents,
1055                         result_ok: o.result_ok,
1056                 }
1057         }
1058 }
1059 pub type CVec_u64Z = crate::c_types::CVecTempl<u64>;
1060 #[no_mangle]
1061 pub static CVec_u64Z_free: extern "C" fn(CVec_u64Z) = crate::c_types::CVecTempl_free::<u64>;
1062
1063 pub type CVec_UpdateAddHTLCZ = crate::c_types::CVecTempl<crate::ln::msgs::UpdateAddHTLC>;
1064 #[no_mangle]
1065 pub static CVec_UpdateAddHTLCZ_free: extern "C" fn(CVec_UpdateAddHTLCZ) = crate::c_types::CVecTempl_free::<crate::ln::msgs::UpdateAddHTLC>;
1066
1067 pub type CVec_UpdateFulfillHTLCZ = crate::c_types::CVecTempl<crate::ln::msgs::UpdateFulfillHTLC>;
1068 #[no_mangle]
1069 pub static CVec_UpdateFulfillHTLCZ_free: extern "C" fn(CVec_UpdateFulfillHTLCZ) = crate::c_types::CVecTempl_free::<crate::ln::msgs::UpdateFulfillHTLC>;
1070
1071 pub type CVec_UpdateFailHTLCZ = crate::c_types::CVecTempl<crate::ln::msgs::UpdateFailHTLC>;
1072 #[no_mangle]
1073 pub static CVec_UpdateFailHTLCZ_free: extern "C" fn(CVec_UpdateFailHTLCZ) = crate::c_types::CVecTempl_free::<crate::ln::msgs::UpdateFailHTLC>;
1074
1075 pub type CVec_UpdateFailMalformedHTLCZ = crate::c_types::CVecTempl<crate::ln::msgs::UpdateFailMalformedHTLC>;
1076 #[no_mangle]
1077 pub static CVec_UpdateFailMalformedHTLCZ_free: extern "C" fn(CVec_UpdateFailMalformedHTLCZ) = crate::c_types::CVecTempl_free::<crate::ln::msgs::UpdateFailMalformedHTLC>;
1078
1079 #[repr(C)]
1080 pub union CResult_boolLightningErrorZPtr {
1081         pub result: *mut bool,
1082         pub err: *mut crate::ln::msgs::LightningError,
1083 }
1084 #[repr(C)]
1085 pub struct CResult_boolLightningErrorZ {
1086         pub contents: CResult_boolLightningErrorZPtr,
1087         pub result_ok: bool,
1088 }
1089 #[no_mangle]
1090 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1091         CResult_boolLightningErrorZ {
1092                 contents: CResult_boolLightningErrorZPtr {
1093                         result: Box::into_raw(Box::new(o)),
1094                 },
1095                 result_ok: true,
1096         }
1097 }
1098 #[no_mangle]
1099 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1100         CResult_boolLightningErrorZ {
1101                 contents: CResult_boolLightningErrorZPtr {
1102                         err: Box::into_raw(Box::new(e)),
1103                 },
1104                 result_ok: false,
1105         }
1106 }
1107 #[no_mangle]
1108 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1109 impl Drop for CResult_boolLightningErrorZ {
1110         fn drop(&mut self) {
1111                 if self.result_ok {
1112                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1113                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1114                         }
1115                 } else {
1116                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1117                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1118                         }
1119                 }
1120         }
1121 }
1122 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
1123         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
1124                 let contents = if o.result_ok {
1125                         let result = unsafe { o.contents.result };
1126                         unsafe { o.contents.result = std::ptr::null_mut() };
1127                         CResult_boolLightningErrorZPtr { result }
1128                 } else {
1129                         let err = unsafe { o.contents.err };
1130                         unsafe { o.contents.err = std::ptr::null_mut(); }
1131                         CResult_boolLightningErrorZPtr { err }
1132                 };
1133                 Self {
1134                         contents,
1135                         result_ok: o.result_ok,
1136                 }
1137         }
1138 }
1139 pub type C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ = crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>;
1140 #[no_mangle]
1141 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>;
1142 #[no_mangle]
1143 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1144         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
1145 }
1146
1147 pub type CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ = crate::c_types::CVecTempl<crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>>;
1148 #[no_mangle]
1149 pub static CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free: extern "C" fn(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) = crate::c_types::CVecTempl_free::<crate::c_types::C3TupleTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate>>;
1150
1151 pub type CVec_NodeAnnouncementZ = crate::c_types::CVecTempl<crate::ln::msgs::NodeAnnouncement>;
1152 #[no_mangle]
1153 pub static CVec_NodeAnnouncementZ_free: extern "C" fn(CVec_NodeAnnouncementZ) = crate::c_types::CVecTempl_free::<crate::ln::msgs::NodeAnnouncement>;
1154
1155 #[repr(C)]
1156 pub union CResult_NoneLightningErrorZPtr {
1157         /// Note that this value is always NULL, as there are no contents in the OK variant
1158         pub result: *mut std::ffi::c_void,
1159         pub err: *mut crate::ln::msgs::LightningError,
1160 }
1161 #[repr(C)]
1162 pub struct CResult_NoneLightningErrorZ {
1163         pub contents: CResult_NoneLightningErrorZPtr,
1164         pub result_ok: bool,
1165 }
1166 #[no_mangle]
1167 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
1168         CResult_NoneLightningErrorZ {
1169                 contents: CResult_NoneLightningErrorZPtr {
1170                         result: std::ptr::null_mut(),
1171                 },
1172                 result_ok: true,
1173         }
1174 }
1175 #[no_mangle]
1176 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
1177         CResult_NoneLightningErrorZ {
1178                 contents: CResult_NoneLightningErrorZPtr {
1179                         err: Box::into_raw(Box::new(e)),
1180                 },
1181                 result_ok: false,
1182         }
1183 }
1184 #[no_mangle]
1185 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
1186 impl Drop for CResult_NoneLightningErrorZ {
1187         fn drop(&mut self) {
1188                 if self.result_ok {
1189                 } else {
1190                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1191                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1192                         }
1193                 }
1194         }
1195 }
1196 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
1197         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
1198                 let contents = if o.result_ok {
1199                         let _ = unsafe { Box::from_raw(o.contents.result) };
1200                         o.contents.result = std::ptr::null_mut();
1201                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
1202                 } else {
1203                         let err = unsafe { o.contents.err };
1204                         unsafe { o.contents.err = std::ptr::null_mut(); }
1205                         CResult_NoneLightningErrorZPtr { err }
1206                 };
1207                 Self {
1208                         contents,
1209                         result_ok: o.result_ok,
1210                 }
1211         }
1212 }
1213 #[repr(C)]
1214 pub union CResult_ChannelReestablishDecodeErrorZPtr {
1215         pub result: *mut crate::ln::msgs::ChannelReestablish,
1216         pub err: *mut crate::ln::msgs::DecodeError,
1217 }
1218 #[repr(C)]
1219 pub struct CResult_ChannelReestablishDecodeErrorZ {
1220         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
1221         pub result_ok: bool,
1222 }
1223 #[no_mangle]
1224 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
1225         CResult_ChannelReestablishDecodeErrorZ {
1226                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
1227                         result: Box::into_raw(Box::new(o)),
1228                 },
1229                 result_ok: true,
1230         }
1231 }
1232 #[no_mangle]
1233 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
1234         CResult_ChannelReestablishDecodeErrorZ {
1235                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
1236                         err: Box::into_raw(Box::new(e)),
1237                 },
1238                 result_ok: false,
1239         }
1240 }
1241 #[no_mangle]
1242 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
1243 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
1244         fn drop(&mut self) {
1245                 if self.result_ok {
1246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1248                         }
1249                 } else {
1250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1252                         }
1253                 }
1254         }
1255 }
1256 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
1257         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
1258                 let contents = if o.result_ok {
1259                         let result = unsafe { o.contents.result };
1260                         unsafe { o.contents.result = std::ptr::null_mut() };
1261                         CResult_ChannelReestablishDecodeErrorZPtr { result }
1262                 } else {
1263                         let err = unsafe { o.contents.err };
1264                         unsafe { o.contents.err = std::ptr::null_mut(); }
1265                         CResult_ChannelReestablishDecodeErrorZPtr { err }
1266                 };
1267                 Self {
1268                         contents,
1269                         result_ok: o.result_ok,
1270                 }
1271         }
1272 }
1273 #[repr(C)]
1274 pub union CResult_InitDecodeErrorZPtr {
1275         pub result: *mut crate::ln::msgs::Init,
1276         pub err: *mut crate::ln::msgs::DecodeError,
1277 }
1278 #[repr(C)]
1279 pub struct CResult_InitDecodeErrorZ {
1280         pub contents: CResult_InitDecodeErrorZPtr,
1281         pub result_ok: bool,
1282 }
1283 #[no_mangle]
1284 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
1285         CResult_InitDecodeErrorZ {
1286                 contents: CResult_InitDecodeErrorZPtr {
1287                         result: Box::into_raw(Box::new(o)),
1288                 },
1289                 result_ok: true,
1290         }
1291 }
1292 #[no_mangle]
1293 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
1294         CResult_InitDecodeErrorZ {
1295                 contents: CResult_InitDecodeErrorZPtr {
1296                         err: Box::into_raw(Box::new(e)),
1297                 },
1298                 result_ok: false,
1299         }
1300 }
1301 #[no_mangle]
1302 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
1303 impl Drop for CResult_InitDecodeErrorZ {
1304         fn drop(&mut self) {
1305                 if self.result_ok {
1306                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1307                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1308                         }
1309                 } else {
1310                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1311                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1312                         }
1313                 }
1314         }
1315 }
1316 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
1317         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
1318                 let contents = if o.result_ok {
1319                         let result = unsafe { o.contents.result };
1320                         unsafe { o.contents.result = std::ptr::null_mut() };
1321                         CResult_InitDecodeErrorZPtr { result }
1322                 } else {
1323                         let err = unsafe { o.contents.err };
1324                         unsafe { o.contents.err = std::ptr::null_mut(); }
1325                         CResult_InitDecodeErrorZPtr { err }
1326                 };
1327                 Self {
1328                         contents,
1329                         result_ok: o.result_ok,
1330                 }
1331         }
1332 }
1333 #[repr(C)]
1334 pub union CResult_PingDecodeErrorZPtr {
1335         pub result: *mut crate::ln::msgs::Ping,
1336         pub err: *mut crate::ln::msgs::DecodeError,
1337 }
1338 #[repr(C)]
1339 pub struct CResult_PingDecodeErrorZ {
1340         pub contents: CResult_PingDecodeErrorZPtr,
1341         pub result_ok: bool,
1342 }
1343 #[no_mangle]
1344 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
1345         CResult_PingDecodeErrorZ {
1346                 contents: CResult_PingDecodeErrorZPtr {
1347                         result: Box::into_raw(Box::new(o)),
1348                 },
1349                 result_ok: true,
1350         }
1351 }
1352 #[no_mangle]
1353 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
1354         CResult_PingDecodeErrorZ {
1355                 contents: CResult_PingDecodeErrorZPtr {
1356                         err: Box::into_raw(Box::new(e)),
1357                 },
1358                 result_ok: false,
1359         }
1360 }
1361 #[no_mangle]
1362 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
1363 impl Drop for CResult_PingDecodeErrorZ {
1364         fn drop(&mut self) {
1365                 if self.result_ok {
1366                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1367                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1368                         }
1369                 } else {
1370                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1371                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1372                         }
1373                 }
1374         }
1375 }
1376 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
1377         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
1378                 let contents = if o.result_ok {
1379                         let result = unsafe { o.contents.result };
1380                         unsafe { o.contents.result = std::ptr::null_mut() };
1381                         CResult_PingDecodeErrorZPtr { result }
1382                 } else {
1383                         let err = unsafe { o.contents.err };
1384                         unsafe { o.contents.err = std::ptr::null_mut(); }
1385                         CResult_PingDecodeErrorZPtr { err }
1386                 };
1387                 Self {
1388                         contents,
1389                         result_ok: o.result_ok,
1390                 }
1391         }
1392 }
1393 #[repr(C)]
1394 pub union CResult_PongDecodeErrorZPtr {
1395         pub result: *mut crate::ln::msgs::Pong,
1396         pub err: *mut crate::ln::msgs::DecodeError,
1397 }
1398 #[repr(C)]
1399 pub struct CResult_PongDecodeErrorZ {
1400         pub contents: CResult_PongDecodeErrorZPtr,
1401         pub result_ok: bool,
1402 }
1403 #[no_mangle]
1404 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
1405         CResult_PongDecodeErrorZ {
1406                 contents: CResult_PongDecodeErrorZPtr {
1407                         result: Box::into_raw(Box::new(o)),
1408                 },
1409                 result_ok: true,
1410         }
1411 }
1412 #[no_mangle]
1413 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
1414         CResult_PongDecodeErrorZ {
1415                 contents: CResult_PongDecodeErrorZPtr {
1416                         err: Box::into_raw(Box::new(e)),
1417                 },
1418                 result_ok: false,
1419         }
1420 }
1421 #[no_mangle]
1422 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
1423 impl Drop for CResult_PongDecodeErrorZ {
1424         fn drop(&mut self) {
1425                 if self.result_ok {
1426                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1427                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1428                         }
1429                 } else {
1430                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1431                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1432                         }
1433                 }
1434         }
1435 }
1436 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
1437         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
1438                 let contents = if o.result_ok {
1439                         let result = unsafe { o.contents.result };
1440                         unsafe { o.contents.result = std::ptr::null_mut() };
1441                         CResult_PongDecodeErrorZPtr { result }
1442                 } else {
1443                         let err = unsafe { o.contents.err };
1444                         unsafe { o.contents.err = std::ptr::null_mut(); }
1445                         CResult_PongDecodeErrorZPtr { err }
1446                 };
1447                 Self {
1448                         contents,
1449                         result_ok: o.result_ok,
1450                 }
1451         }
1452 }
1453 #[repr(C)]
1454 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
1455         pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
1456         pub err: *mut crate::ln::msgs::DecodeError,
1457 }
1458 #[repr(C)]
1459 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
1460         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
1461         pub result_ok: bool,
1462 }
1463 #[no_mangle]
1464 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
1465         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
1466                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
1467                         result: Box::into_raw(Box::new(o)),
1468                 },
1469                 result_ok: true,
1470         }
1471 }
1472 #[no_mangle]
1473 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
1474         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
1475                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
1476                         err: Box::into_raw(Box::new(e)),
1477                 },
1478                 result_ok: false,
1479         }
1480 }
1481 #[no_mangle]
1482 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
1483 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
1484         fn drop(&mut self) {
1485                 if self.result_ok {
1486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1488                         }
1489                 } else {
1490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1492                         }
1493                 }
1494         }
1495 }
1496 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
1497         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
1498                 let contents = if o.result_ok {
1499                         let result = unsafe { o.contents.result };
1500                         unsafe { o.contents.result = std::ptr::null_mut() };
1501                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
1502                 } else {
1503                         let err = unsafe { o.contents.err };
1504                         unsafe { o.contents.err = std::ptr::null_mut(); }
1505                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
1506                 };
1507                 Self {
1508                         contents,
1509                         result_ok: o.result_ok,
1510                 }
1511         }
1512 }
1513 #[repr(C)]
1514 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
1515         pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
1516         pub err: *mut crate::ln::msgs::DecodeError,
1517 }
1518 #[repr(C)]
1519 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
1520         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
1521         pub result_ok: bool,
1522 }
1523 #[no_mangle]
1524 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
1525         CResult_UnsignedChannelUpdateDecodeErrorZ {
1526                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
1527                         result: Box::into_raw(Box::new(o)),
1528                 },
1529                 result_ok: true,
1530         }
1531 }
1532 #[no_mangle]
1533 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
1534         CResult_UnsignedChannelUpdateDecodeErrorZ {
1535                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
1536                         err: Box::into_raw(Box::new(e)),
1537                 },
1538                 result_ok: false,
1539         }
1540 }
1541 #[no_mangle]
1542 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
1543 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
1544         fn drop(&mut self) {
1545                 if self.result_ok {
1546                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1547                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1548                         }
1549                 } else {
1550                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1551                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1552                         }
1553                 }
1554         }
1555 }
1556 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
1557         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
1558                 let contents = if o.result_ok {
1559                         let result = unsafe { o.contents.result };
1560                         unsafe { o.contents.result = std::ptr::null_mut() };
1561                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
1562                 } else {
1563                         let err = unsafe { o.contents.err };
1564                         unsafe { o.contents.err = std::ptr::null_mut(); }
1565                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
1566                 };
1567                 Self {
1568                         contents,
1569                         result_ok: o.result_ok,
1570                 }
1571         }
1572 }
1573 #[repr(C)]
1574 pub union CResult_ErrorMessageDecodeErrorZPtr {
1575         pub result: *mut crate::ln::msgs::ErrorMessage,
1576         pub err: *mut crate::ln::msgs::DecodeError,
1577 }
1578 #[repr(C)]
1579 pub struct CResult_ErrorMessageDecodeErrorZ {
1580         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
1581         pub result_ok: bool,
1582 }
1583 #[no_mangle]
1584 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
1585         CResult_ErrorMessageDecodeErrorZ {
1586                 contents: CResult_ErrorMessageDecodeErrorZPtr {
1587                         result: Box::into_raw(Box::new(o)),
1588                 },
1589                 result_ok: true,
1590         }
1591 }
1592 #[no_mangle]
1593 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
1594         CResult_ErrorMessageDecodeErrorZ {
1595                 contents: CResult_ErrorMessageDecodeErrorZPtr {
1596                         err: Box::into_raw(Box::new(e)),
1597                 },
1598                 result_ok: false,
1599         }
1600 }
1601 #[no_mangle]
1602 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
1603 impl Drop for CResult_ErrorMessageDecodeErrorZ {
1604         fn drop(&mut self) {
1605                 if self.result_ok {
1606                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1607                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1608                         }
1609                 } else {
1610                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1611                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1612                         }
1613                 }
1614         }
1615 }
1616 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
1617         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
1618                 let contents = if o.result_ok {
1619                         let result = unsafe { o.contents.result };
1620                         unsafe { o.contents.result = std::ptr::null_mut() };
1621                         CResult_ErrorMessageDecodeErrorZPtr { result }
1622                 } else {
1623                         let err = unsafe { o.contents.err };
1624                         unsafe { o.contents.err = std::ptr::null_mut(); }
1625                         CResult_ErrorMessageDecodeErrorZPtr { err }
1626                 };
1627                 Self {
1628                         contents,
1629                         result_ok: o.result_ok,
1630                 }
1631         }
1632 }
1633 #[repr(C)]
1634 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
1635         pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
1636         pub err: *mut crate::ln::msgs::DecodeError,
1637 }
1638 #[repr(C)]
1639 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
1640         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
1641         pub result_ok: bool,
1642 }
1643 #[no_mangle]
1644 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
1645         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
1646                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
1647                         result: Box::into_raw(Box::new(o)),
1648                 },
1649                 result_ok: true,
1650         }
1651 }
1652 #[no_mangle]
1653 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
1654         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
1655                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
1656                         err: Box::into_raw(Box::new(e)),
1657                 },
1658                 result_ok: false,
1659         }
1660 }
1661 #[no_mangle]
1662 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
1663 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
1664         fn drop(&mut self) {
1665                 if self.result_ok {
1666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1668                         }
1669                 } else {
1670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1672                         }
1673                 }
1674         }
1675 }
1676 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
1677         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
1678                 let contents = if o.result_ok {
1679                         let result = unsafe { o.contents.result };
1680                         unsafe { o.contents.result = std::ptr::null_mut() };
1681                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
1682                 } else {
1683                         let err = unsafe { o.contents.err };
1684                         unsafe { o.contents.err = std::ptr::null_mut(); }
1685                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
1686                 };
1687                 Self {
1688                         contents,
1689                         result_ok: o.result_ok,
1690                 }
1691         }
1692 }
1693 #[repr(C)]
1694 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
1695         pub result: *mut crate::ln::msgs::QueryShortChannelIds,
1696         pub err: *mut crate::ln::msgs::DecodeError,
1697 }
1698 #[repr(C)]
1699 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
1700         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
1701         pub result_ok: bool,
1702 }
1703 #[no_mangle]
1704 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
1705         CResult_QueryShortChannelIdsDecodeErrorZ {
1706                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
1707                         result: Box::into_raw(Box::new(o)),
1708                 },
1709                 result_ok: true,
1710         }
1711 }
1712 #[no_mangle]
1713 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
1714         CResult_QueryShortChannelIdsDecodeErrorZ {
1715                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
1716                         err: Box::into_raw(Box::new(e)),
1717                 },
1718                 result_ok: false,
1719         }
1720 }
1721 #[no_mangle]
1722 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
1723 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
1724         fn drop(&mut self) {
1725                 if self.result_ok {
1726                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1727                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1728                         }
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<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
1737         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
1738                 let contents = if o.result_ok {
1739                         let result = unsafe { o.contents.result };
1740                         unsafe { o.contents.result = std::ptr::null_mut() };
1741                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
1742                 } else {
1743                         let err = unsafe { o.contents.err };
1744                         unsafe { o.contents.err = std::ptr::null_mut(); }
1745                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
1746                 };
1747                 Self {
1748                         contents,
1749                         result_ok: o.result_ok,
1750                 }
1751         }
1752 }
1753 #[repr(C)]
1754 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
1755         pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
1756         pub err: *mut crate::ln::msgs::DecodeError,
1757 }
1758 #[repr(C)]
1759 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
1760         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
1761         pub result_ok: bool,
1762 }
1763 #[no_mangle]
1764 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
1765         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
1766                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
1767                         result: Box::into_raw(Box::new(o)),
1768                 },
1769                 result_ok: true,
1770         }
1771 }
1772 #[no_mangle]
1773 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
1774         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
1775                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
1776                         err: Box::into_raw(Box::new(e)),
1777                 },
1778                 result_ok: false,
1779         }
1780 }
1781 #[no_mangle]
1782 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
1783 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
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::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
1797         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, 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_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
1802                 } else {
1803                         let err = unsafe { o.contents.err };
1804                         unsafe { o.contents.err = std::ptr::null_mut(); }
1805                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
1806                 };
1807                 Self {
1808                         contents,
1809                         result_ok: o.result_ok,
1810                 }
1811         }
1812 }
1813 #[repr(C)]
1814 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
1815         pub result: *mut crate::ln::msgs::QueryChannelRange,
1816         pub err: *mut crate::ln::msgs::DecodeError,
1817 }
1818 #[repr(C)]
1819 pub struct CResult_QueryChannelRangeDecodeErrorZ {
1820         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
1821         pub result_ok: bool,
1822 }
1823 #[no_mangle]
1824 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
1825         CResult_QueryChannelRangeDecodeErrorZ {
1826                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
1827                         result: Box::into_raw(Box::new(o)),
1828                 },
1829                 result_ok: true,
1830         }
1831 }
1832 #[no_mangle]
1833 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
1834         CResult_QueryChannelRangeDecodeErrorZ {
1835                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
1836                         err: Box::into_raw(Box::new(e)),
1837                 },
1838                 result_ok: false,
1839         }
1840 }
1841 #[no_mangle]
1842 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
1843 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
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::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
1857         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, 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_QueryChannelRangeDecodeErrorZPtr { result }
1862                 } else {
1863                         let err = unsafe { o.contents.err };
1864                         unsafe { o.contents.err = std::ptr::null_mut(); }
1865                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
1866                 };
1867                 Self {
1868                         contents,
1869                         result_ok: o.result_ok,
1870                 }
1871         }
1872 }
1873 #[repr(C)]
1874 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
1875         pub result: *mut crate::ln::msgs::ReplyChannelRange,
1876         pub err: *mut crate::ln::msgs::DecodeError,
1877 }
1878 #[repr(C)]
1879 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
1880         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
1881         pub result_ok: bool,
1882 }
1883 #[no_mangle]
1884 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
1885         CResult_ReplyChannelRangeDecodeErrorZ {
1886                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
1887                         result: Box::into_raw(Box::new(o)),
1888                 },
1889                 result_ok: true,
1890         }
1891 }
1892 #[no_mangle]
1893 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
1894         CResult_ReplyChannelRangeDecodeErrorZ {
1895                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
1896                         err: Box::into_raw(Box::new(e)),
1897                 },
1898                 result_ok: false,
1899         }
1900 }
1901 #[no_mangle]
1902 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
1903 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
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::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
1917         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, 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_ReplyChannelRangeDecodeErrorZPtr { result }
1922                 } else {
1923                         let err = unsafe { o.contents.err };
1924                         unsafe { o.contents.err = std::ptr::null_mut(); }
1925                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
1926                 };
1927                 Self {
1928                         contents,
1929                         result_ok: o.result_ok,
1930                 }
1931         }
1932 }
1933 #[repr(C)]
1934 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
1935         pub result: *mut crate::ln::msgs::GossipTimestampFilter,
1936         pub err: *mut crate::ln::msgs::DecodeError,
1937 }
1938 #[repr(C)]
1939 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
1940         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
1941         pub result_ok: bool,
1942 }
1943 #[no_mangle]
1944 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
1945         CResult_GossipTimestampFilterDecodeErrorZ {
1946                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
1947                         result: Box::into_raw(Box::new(o)),
1948                 },
1949                 result_ok: true,
1950         }
1951 }
1952 #[no_mangle]
1953 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
1954         CResult_GossipTimestampFilterDecodeErrorZ {
1955                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
1956                         err: Box::into_raw(Box::new(e)),
1957                 },
1958                 result_ok: false,
1959         }
1960 }
1961 #[no_mangle]
1962 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
1963 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
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::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
1977         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, 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_GossipTimestampFilterDecodeErrorZPtr { result }
1982                 } else {
1983                         let err = unsafe { o.contents.err };
1984                         unsafe { o.contents.err = std::ptr::null_mut(); }
1985                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
1986                 };
1987                 Self {
1988                         contents,
1989                         result_ok: o.result_ok,
1990                 }
1991         }
1992 }
1993 pub type CVec_PublicKeyZ = crate::c_types::CVecTempl<crate::c_types::PublicKey>;
1994 #[no_mangle]
1995 pub static CVec_PublicKeyZ_free: extern "C" fn(CVec_PublicKeyZ) = crate::c_types::CVecTempl_free::<crate::c_types::PublicKey>;
1996
1997 pub type CVec_u8Z = crate::c_types::CVecTempl<u8>;
1998 #[no_mangle]
1999 pub static CVec_u8Z_free: extern "C" fn(CVec_u8Z) = crate::c_types::CVecTempl_free::<u8>;
2000
2001 #[repr(C)]
2002 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
2003         pub result: *mut crate::c_types::CVecTempl<u8>,
2004         pub err: *mut crate::ln::peer_handler::PeerHandleError,
2005 }
2006 #[repr(C)]
2007 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
2008         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
2009         pub result_ok: bool,
2010 }
2011 #[no_mangle]
2012 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::CVecTempl<u8>) -> CResult_CVec_u8ZPeerHandleErrorZ {
2013         CResult_CVec_u8ZPeerHandleErrorZ {
2014                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
2015                         result: Box::into_raw(Box::new(o)),
2016                 },
2017                 result_ok: true,
2018         }
2019 }
2020 #[no_mangle]
2021 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
2022         CResult_CVec_u8ZPeerHandleErrorZ {
2023                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
2024                         err: Box::into_raw(Box::new(e)),
2025                 },
2026                 result_ok: false,
2027         }
2028 }
2029 #[no_mangle]
2030 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
2031 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
2032         fn drop(&mut self) {
2033                 if self.result_ok {
2034                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2035                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2036                         }
2037                 } else {
2038                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2039                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2040                         }
2041                 }
2042         }
2043 }
2044 impl From<crate::c_types::CResultTempl<crate::c_types::CVecTempl<u8>, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
2045         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::CVecTempl<u8>, crate::ln::peer_handler::PeerHandleError>) -> Self {
2046                 let contents = if o.result_ok {
2047                         let result = unsafe { o.contents.result };
2048                         unsafe { o.contents.result = std::ptr::null_mut() };
2049                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
2050                 } else {
2051                         let err = unsafe { o.contents.err };
2052                         unsafe { o.contents.err = std::ptr::null_mut(); }
2053                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
2054                 };
2055                 Self {
2056                         contents,
2057                         result_ok: o.result_ok,
2058                 }
2059         }
2060 }
2061 #[repr(C)]
2062 pub union CResult_NonePeerHandleErrorZPtr {
2063         /// Note that this value is always NULL, as there are no contents in the OK variant
2064         pub result: *mut std::ffi::c_void,
2065         pub err: *mut crate::ln::peer_handler::PeerHandleError,
2066 }
2067 #[repr(C)]
2068 pub struct CResult_NonePeerHandleErrorZ {
2069         pub contents: CResult_NonePeerHandleErrorZPtr,
2070         pub result_ok: bool,
2071 }
2072 #[no_mangle]
2073 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
2074         CResult_NonePeerHandleErrorZ {
2075                 contents: CResult_NonePeerHandleErrorZPtr {
2076                         result: std::ptr::null_mut(),
2077                 },
2078                 result_ok: true,
2079         }
2080 }
2081 #[no_mangle]
2082 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
2083         CResult_NonePeerHandleErrorZ {
2084                 contents: CResult_NonePeerHandleErrorZPtr {
2085                         err: Box::into_raw(Box::new(e)),
2086                 },
2087                 result_ok: false,
2088         }
2089 }
2090 #[no_mangle]
2091 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
2092 impl Drop for CResult_NonePeerHandleErrorZ {
2093         fn drop(&mut self) {
2094                 if self.result_ok {
2095                 } else {
2096                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2097                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2098                         }
2099                 }
2100         }
2101 }
2102 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
2103         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
2104                 let contents = if o.result_ok {
2105                         let _ = unsafe { Box::from_raw(o.contents.result) };
2106                         o.contents.result = std::ptr::null_mut();
2107                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
2108                 } else {
2109                         let err = unsafe { o.contents.err };
2110                         unsafe { o.contents.err = std::ptr::null_mut(); }
2111                         CResult_NonePeerHandleErrorZPtr { err }
2112                 };
2113                 Self {
2114                         contents,
2115                         result_ok: o.result_ok,
2116                 }
2117         }
2118 }
2119 #[repr(C)]
2120 pub union CResult_boolPeerHandleErrorZPtr {
2121         pub result: *mut bool,
2122         pub err: *mut crate::ln::peer_handler::PeerHandleError,
2123 }
2124 #[repr(C)]
2125 pub struct CResult_boolPeerHandleErrorZ {
2126         pub contents: CResult_boolPeerHandleErrorZPtr,
2127         pub result_ok: bool,
2128 }
2129 #[no_mangle]
2130 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
2131         CResult_boolPeerHandleErrorZ {
2132                 contents: CResult_boolPeerHandleErrorZPtr {
2133                         result: Box::into_raw(Box::new(o)),
2134                 },
2135                 result_ok: true,
2136         }
2137 }
2138 #[no_mangle]
2139 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
2140         CResult_boolPeerHandleErrorZ {
2141                 contents: CResult_boolPeerHandleErrorZPtr {
2142                         err: Box::into_raw(Box::new(e)),
2143                 },
2144                 result_ok: false,
2145         }
2146 }
2147 #[no_mangle]
2148 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
2149 impl Drop for CResult_boolPeerHandleErrorZ {
2150         fn drop(&mut self) {
2151                 if self.result_ok {
2152                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2153                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2154                         }
2155                 } else {
2156                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2157                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2158                         }
2159                 }
2160         }
2161 }
2162 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
2163         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
2164                 let contents = if o.result_ok {
2165                         let result = unsafe { o.contents.result };
2166                         unsafe { o.contents.result = std::ptr::null_mut() };
2167                         CResult_boolPeerHandleErrorZPtr { result }
2168                 } else {
2169                         let err = unsafe { o.contents.err };
2170                         unsafe { o.contents.err = std::ptr::null_mut(); }
2171                         CResult_boolPeerHandleErrorZPtr { err }
2172                 };
2173                 Self {
2174                         contents,
2175                         result_ok: o.result_ok,
2176                 }
2177         }
2178 }
2179 #[repr(C)]
2180 pub union CResult_SecretKeySecpErrorZPtr {
2181         pub result: *mut crate::c_types::SecretKey,
2182         pub err: *mut crate::c_types::Secp256k1Error,
2183 }
2184 #[repr(C)]
2185 pub struct CResult_SecretKeySecpErrorZ {
2186         pub contents: CResult_SecretKeySecpErrorZPtr,
2187         pub result_ok: bool,
2188 }
2189 #[no_mangle]
2190 pub extern "C" fn CResult_SecretKeySecpErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeySecpErrorZ {
2191         CResult_SecretKeySecpErrorZ {
2192                 contents: CResult_SecretKeySecpErrorZPtr {
2193                         result: Box::into_raw(Box::new(o)),
2194                 },
2195                 result_ok: true,
2196         }
2197 }
2198 #[no_mangle]
2199 pub extern "C" fn CResult_SecretKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeySecpErrorZ {
2200         CResult_SecretKeySecpErrorZ {
2201                 contents: CResult_SecretKeySecpErrorZPtr {
2202                         err: Box::into_raw(Box::new(e)),
2203                 },
2204                 result_ok: false,
2205         }
2206 }
2207 #[no_mangle]
2208 pub extern "C" fn CResult_SecretKeySecpErrorZ_free(_res: CResult_SecretKeySecpErrorZ) { }
2209 impl Drop for CResult_SecretKeySecpErrorZ {
2210         fn drop(&mut self) {
2211                 if self.result_ok {
2212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2214                         }
2215                 } else {
2216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2218                         }
2219                 }
2220         }
2221 }
2222 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeySecpErrorZ {
2223         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
2224                 let contents = if o.result_ok {
2225                         let result = unsafe { o.contents.result };
2226                         unsafe { o.contents.result = std::ptr::null_mut() };
2227                         CResult_SecretKeySecpErrorZPtr { result }
2228                 } else {
2229                         let err = unsafe { o.contents.err };
2230                         unsafe { o.contents.err = std::ptr::null_mut(); }
2231                         CResult_SecretKeySecpErrorZPtr { err }
2232                 };
2233                 Self {
2234                         contents,
2235                         result_ok: o.result_ok,
2236                 }
2237         }
2238 }
2239 #[repr(C)]
2240 pub union CResult_PublicKeySecpErrorZPtr {
2241         pub result: *mut crate::c_types::PublicKey,
2242         pub err: *mut crate::c_types::Secp256k1Error,
2243 }
2244 #[repr(C)]
2245 pub struct CResult_PublicKeySecpErrorZ {
2246         pub contents: CResult_PublicKeySecpErrorZPtr,
2247         pub result_ok: bool,
2248 }
2249 #[no_mangle]
2250 pub extern "C" fn CResult_PublicKeySecpErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecpErrorZ {
2251         CResult_PublicKeySecpErrorZ {
2252                 contents: CResult_PublicKeySecpErrorZPtr {
2253                         result: Box::into_raw(Box::new(o)),
2254                 },
2255                 result_ok: true,
2256         }
2257 }
2258 #[no_mangle]
2259 pub extern "C" fn CResult_PublicKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecpErrorZ {
2260         CResult_PublicKeySecpErrorZ {
2261                 contents: CResult_PublicKeySecpErrorZPtr {
2262                         err: Box::into_raw(Box::new(e)),
2263                 },
2264                 result_ok: false,
2265         }
2266 }
2267 #[no_mangle]
2268 pub extern "C" fn CResult_PublicKeySecpErrorZ_free(_res: CResult_PublicKeySecpErrorZ) { }
2269 impl Drop for CResult_PublicKeySecpErrorZ {
2270         fn drop(&mut self) {
2271                 if self.result_ok {
2272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2274                         }
2275                 } else {
2276                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2277                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2278                         }
2279                 }
2280         }
2281 }
2282 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecpErrorZ {
2283         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
2284                 let contents = if o.result_ok {
2285                         let result = unsafe { o.contents.result };
2286                         unsafe { o.contents.result = std::ptr::null_mut() };
2287                         CResult_PublicKeySecpErrorZPtr { result }
2288                 } else {
2289                         let err = unsafe { o.contents.err };
2290                         unsafe { o.contents.err = std::ptr::null_mut(); }
2291                         CResult_PublicKeySecpErrorZPtr { err }
2292                 };
2293                 Self {
2294                         contents,
2295                         result_ok: o.result_ok,
2296                 }
2297         }
2298 }
2299 #[repr(C)]
2300 pub union CResult_TxCreationKeysSecpErrorZPtr {
2301         pub result: *mut crate::ln::chan_utils::TxCreationKeys,
2302         pub err: *mut crate::c_types::Secp256k1Error,
2303 }
2304 #[repr(C)]
2305 pub struct CResult_TxCreationKeysSecpErrorZ {
2306         pub contents: CResult_TxCreationKeysSecpErrorZPtr,
2307         pub result_ok: bool,
2308 }
2309 #[no_mangle]
2310 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysSecpErrorZ {
2311         CResult_TxCreationKeysSecpErrorZ {
2312                 contents: CResult_TxCreationKeysSecpErrorZPtr {
2313                         result: Box::into_raw(Box::new(o)),
2314                 },
2315                 result_ok: true,
2316         }
2317 }
2318 #[no_mangle]
2319 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysSecpErrorZ {
2320         CResult_TxCreationKeysSecpErrorZ {
2321                 contents: CResult_TxCreationKeysSecpErrorZPtr {
2322                         err: Box::into_raw(Box::new(e)),
2323                 },
2324                 result_ok: false,
2325         }
2326 }
2327 #[no_mangle]
2328 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_free(_res: CResult_TxCreationKeysSecpErrorZ) { }
2329 impl Drop for CResult_TxCreationKeysSecpErrorZ {
2330         fn drop(&mut self) {
2331                 if self.result_ok {
2332                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2333                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2334                         }
2335                 } else {
2336                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2337                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2338                         }
2339                 }
2340         }
2341 }
2342 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysSecpErrorZ {
2343         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
2344                 let contents = if o.result_ok {
2345                         let result = unsafe { o.contents.result };
2346                         unsafe { o.contents.result = std::ptr::null_mut() };
2347                         CResult_TxCreationKeysSecpErrorZPtr { result }
2348                 } else {
2349                         let err = unsafe { o.contents.err };
2350                         unsafe { o.contents.err = std::ptr::null_mut(); }
2351                         CResult_TxCreationKeysSecpErrorZPtr { err }
2352                 };
2353                 Self {
2354                         contents,
2355                         result_ok: o.result_ok,
2356                 }
2357         }
2358 }
2359 #[repr(C)]
2360 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
2361         pub result: *mut crate::ln::chan_utils::TrustedCommitmentTransaction,
2362         /// Note that this value is always NULL, as there are no contents in the Err variant
2363         pub err: *mut std::ffi::c_void,
2364 }
2365 #[repr(C)]
2366 pub struct CResult_TrustedCommitmentTransactionNoneZ {
2367         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
2368         pub result_ok: bool,
2369 }
2370 #[no_mangle]
2371 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
2372         CResult_TrustedCommitmentTransactionNoneZ {
2373                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
2374                         result: Box::into_raw(Box::new(o)),
2375                 },
2376                 result_ok: true,
2377         }
2378 }
2379 #[no_mangle]
2380 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
2381         CResult_TrustedCommitmentTransactionNoneZ {
2382                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
2383                         err: std::ptr::null_mut(),
2384                 },
2385                 result_ok: false,
2386         }
2387 }
2388 #[no_mangle]
2389 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
2390 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
2391         fn drop(&mut self) {
2392                 if self.result_ok {
2393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2395                         }
2396                 } else {
2397                 }
2398         }
2399 }
2400 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
2401         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> Self {
2402                 let contents = if o.result_ok {
2403                         let result = unsafe { o.contents.result };
2404                         unsafe { o.contents.result = std::ptr::null_mut() };
2405                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
2406                 } else {
2407                         let _ = unsafe { Box::from_raw(o.contents.err) };
2408                         o.contents.err = std::ptr::null_mut();
2409                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
2410                 };
2411                 Self {
2412                         contents,
2413                         result_ok: o.result_ok,
2414                 }
2415         }
2416 }
2417 pub type CVec_RouteHopZ = crate::c_types::CVecTempl<crate::routing::router::RouteHop>;
2418 #[no_mangle]
2419 pub static CVec_RouteHopZ_free: extern "C" fn(CVec_RouteHopZ) = crate::c_types::CVecTempl_free::<crate::routing::router::RouteHop>;
2420
2421 pub type CVec_CVec_RouteHopZZ = crate::c_types::CVecTempl<crate::c_types::CVecTempl<crate::routing::router::RouteHop>>;
2422 #[no_mangle]
2423 pub static CVec_CVec_RouteHopZZ_free: extern "C" fn(CVec_CVec_RouteHopZZ) = crate::c_types::CVecTempl_free::<crate::c_types::CVecTempl<crate::routing::router::RouteHop>>;
2424
2425 #[repr(C)]
2426 pub union CResult_RouteDecodeErrorZPtr {
2427         pub result: *mut crate::routing::router::Route,
2428         pub err: *mut crate::ln::msgs::DecodeError,
2429 }
2430 #[repr(C)]
2431 pub struct CResult_RouteDecodeErrorZ {
2432         pub contents: CResult_RouteDecodeErrorZPtr,
2433         pub result_ok: bool,
2434 }
2435 #[no_mangle]
2436 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2437         CResult_RouteDecodeErrorZ {
2438                 contents: CResult_RouteDecodeErrorZPtr {
2439                         result: Box::into_raw(Box::new(o)),
2440                 },
2441                 result_ok: true,
2442         }
2443 }
2444 #[no_mangle]
2445 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2446         CResult_RouteDecodeErrorZ {
2447                 contents: CResult_RouteDecodeErrorZPtr {
2448                         err: Box::into_raw(Box::new(e)),
2449                 },
2450                 result_ok: false,
2451         }
2452 }
2453 #[no_mangle]
2454 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2455 impl Drop for CResult_RouteDecodeErrorZ {
2456         fn drop(&mut self) {
2457                 if self.result_ok {
2458                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2459                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2460                         }
2461                 } else {
2462                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2463                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2464                         }
2465                 }
2466         }
2467 }
2468 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2469         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
2470                 let contents = if o.result_ok {
2471                         let result = unsafe { o.contents.result };
2472                         unsafe { o.contents.result = std::ptr::null_mut() };
2473                         CResult_RouteDecodeErrorZPtr { result }
2474                 } else {
2475                         let err = unsafe { o.contents.err };
2476                         unsafe { o.contents.err = std::ptr::null_mut(); }
2477                         CResult_RouteDecodeErrorZPtr { err }
2478                 };
2479                 Self {
2480                         contents,
2481                         result_ok: o.result_ok,
2482                 }
2483         }
2484 }
2485 pub type CVec_RouteHintZ = crate::c_types::CVecTempl<crate::routing::router::RouteHint>;
2486 #[no_mangle]
2487 pub static CVec_RouteHintZ_free: extern "C" fn(CVec_RouteHintZ) = crate::c_types::CVecTempl_free::<crate::routing::router::RouteHint>;
2488
2489 #[repr(C)]
2490 pub union CResult_RouteLightningErrorZPtr {
2491         pub result: *mut crate::routing::router::Route,
2492         pub err: *mut crate::ln::msgs::LightningError,
2493 }
2494 #[repr(C)]
2495 pub struct CResult_RouteLightningErrorZ {
2496         pub contents: CResult_RouteLightningErrorZPtr,
2497         pub result_ok: bool,
2498 }
2499 #[no_mangle]
2500 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
2501         CResult_RouteLightningErrorZ {
2502                 contents: CResult_RouteLightningErrorZPtr {
2503                         result: Box::into_raw(Box::new(o)),
2504                 },
2505                 result_ok: true,
2506         }
2507 }
2508 #[no_mangle]
2509 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2510         CResult_RouteLightningErrorZ {
2511                 contents: CResult_RouteLightningErrorZPtr {
2512                         err: Box::into_raw(Box::new(e)),
2513                 },
2514                 result_ok: false,
2515         }
2516 }
2517 #[no_mangle]
2518 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2519 impl Drop for CResult_RouteLightningErrorZ {
2520         fn drop(&mut self) {
2521                 if self.result_ok {
2522                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2523                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2524                         }
2525                 } else {
2526                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2527                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2528                         }
2529                 }
2530         }
2531 }
2532 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2533         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
2534                 let contents = if o.result_ok {
2535                         let result = unsafe { o.contents.result };
2536                         unsafe { o.contents.result = std::ptr::null_mut() };
2537                         CResult_RouteLightningErrorZPtr { result }
2538                 } else {
2539                         let err = unsafe { o.contents.err };
2540                         unsafe { o.contents.err = std::ptr::null_mut(); }
2541                         CResult_RouteLightningErrorZPtr { err }
2542                 };
2543                 Self {
2544                         contents,
2545                         result_ok: o.result_ok,
2546                 }
2547         }
2548 }
2549 #[repr(C)]
2550 pub union CResult_RoutingFeesDecodeErrorZPtr {
2551         pub result: *mut crate::routing::network_graph::RoutingFees,
2552         pub err: *mut crate::ln::msgs::DecodeError,
2553 }
2554 #[repr(C)]
2555 pub struct CResult_RoutingFeesDecodeErrorZ {
2556         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
2557         pub result_ok: bool,
2558 }
2559 #[no_mangle]
2560 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
2561         CResult_RoutingFeesDecodeErrorZ {
2562                 contents: CResult_RoutingFeesDecodeErrorZPtr {
2563                         result: Box::into_raw(Box::new(o)),
2564                 },
2565                 result_ok: true,
2566         }
2567 }
2568 #[no_mangle]
2569 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
2570         CResult_RoutingFeesDecodeErrorZ {
2571                 contents: CResult_RoutingFeesDecodeErrorZPtr {
2572                         err: Box::into_raw(Box::new(e)),
2573                 },
2574                 result_ok: false,
2575         }
2576 }
2577 #[no_mangle]
2578 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
2579 impl Drop for CResult_RoutingFeesDecodeErrorZ {
2580         fn drop(&mut self) {
2581                 if self.result_ok {
2582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2584                         }
2585                 } else {
2586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2588                         }
2589                 }
2590         }
2591 }
2592 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
2593         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
2594                 let contents = if o.result_ok {
2595                         let result = unsafe { o.contents.result };
2596                         unsafe { o.contents.result = std::ptr::null_mut() };
2597                         CResult_RoutingFeesDecodeErrorZPtr { result }
2598                 } else {
2599                         let err = unsafe { o.contents.err };
2600                         unsafe { o.contents.err = std::ptr::null_mut(); }
2601                         CResult_RoutingFeesDecodeErrorZPtr { err }
2602                 };
2603                 Self {
2604                         contents,
2605                         result_ok: o.result_ok,
2606                 }
2607         }
2608 }
2609 #[repr(C)]
2610 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2611         pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
2612         pub err: *mut crate::ln::msgs::DecodeError,
2613 }
2614 #[repr(C)]
2615 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
2616         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
2617         pub result_ok: bool,
2618 }
2619 #[no_mangle]
2620 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2621         CResult_NodeAnnouncementInfoDecodeErrorZ {
2622                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2623                         result: Box::into_raw(Box::new(o)),
2624                 },
2625                 result_ok: true,
2626         }
2627 }
2628 #[no_mangle]
2629 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2630         CResult_NodeAnnouncementInfoDecodeErrorZ {
2631                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2632                         err: Box::into_raw(Box::new(e)),
2633                 },
2634                 result_ok: false,
2635         }
2636 }
2637 #[no_mangle]
2638 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
2639 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
2640         fn drop(&mut self) {
2641                 if self.result_ok {
2642                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2643                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2644                         }
2645                 } else {
2646                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2647                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2648                         }
2649                 }
2650         }
2651 }
2652 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
2653         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
2654                 let contents = if o.result_ok {
2655                         let result = unsafe { o.contents.result };
2656                         unsafe { o.contents.result = std::ptr::null_mut() };
2657                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
2658                 } else {
2659                         let err = unsafe { o.contents.err };
2660                         unsafe { o.contents.err = std::ptr::null_mut(); }
2661                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
2662                 };
2663                 Self {
2664                         contents,
2665                         result_ok: o.result_ok,
2666                 }
2667         }
2668 }
2669 #[repr(C)]
2670 pub union CResult_NodeInfoDecodeErrorZPtr {
2671         pub result: *mut crate::routing::network_graph::NodeInfo,
2672         pub err: *mut crate::ln::msgs::DecodeError,
2673 }
2674 #[repr(C)]
2675 pub struct CResult_NodeInfoDecodeErrorZ {
2676         pub contents: CResult_NodeInfoDecodeErrorZPtr,
2677         pub result_ok: bool,
2678 }
2679 #[no_mangle]
2680 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
2681         CResult_NodeInfoDecodeErrorZ {
2682                 contents: CResult_NodeInfoDecodeErrorZPtr {
2683                         result: Box::into_raw(Box::new(o)),
2684                 },
2685                 result_ok: true,
2686         }
2687 }
2688 #[no_mangle]
2689 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
2690         CResult_NodeInfoDecodeErrorZ {
2691                 contents: CResult_NodeInfoDecodeErrorZPtr {
2692                         err: Box::into_raw(Box::new(e)),
2693                 },
2694                 result_ok: false,
2695         }
2696 }
2697 #[no_mangle]
2698 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
2699 impl Drop for CResult_NodeInfoDecodeErrorZ {
2700         fn drop(&mut self) {
2701                 if self.result_ok {
2702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2704                         }
2705                 } else {
2706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2708                         }
2709                 }
2710         }
2711 }
2712 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
2713         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
2714                 let contents = if o.result_ok {
2715                         let result = unsafe { o.contents.result };
2716                         unsafe { o.contents.result = std::ptr::null_mut() };
2717                         CResult_NodeInfoDecodeErrorZPtr { result }
2718                 } else {
2719                         let err = unsafe { o.contents.err };
2720                         unsafe { o.contents.err = std::ptr::null_mut(); }
2721                         CResult_NodeInfoDecodeErrorZPtr { err }
2722                 };
2723                 Self {
2724                         contents,
2725                         result_ok: o.result_ok,
2726                 }
2727         }
2728 }
2729 #[repr(C)]
2730 pub union CResult_NetworkGraphDecodeErrorZPtr {
2731         pub result: *mut crate::routing::network_graph::NetworkGraph,
2732         pub err: *mut crate::ln::msgs::DecodeError,
2733 }
2734 #[repr(C)]
2735 pub struct CResult_NetworkGraphDecodeErrorZ {
2736         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
2737         pub result_ok: bool,
2738 }
2739 #[no_mangle]
2740 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
2741         CResult_NetworkGraphDecodeErrorZ {
2742                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2743                         result: Box::into_raw(Box::new(o)),
2744                 },
2745                 result_ok: true,
2746         }
2747 }
2748 #[no_mangle]
2749 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
2750         CResult_NetworkGraphDecodeErrorZ {
2751                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2752                         err: Box::into_raw(Box::new(e)),
2753                 },
2754                 result_ok: false,
2755         }
2756 }
2757 #[no_mangle]
2758 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
2759 impl Drop for CResult_NetworkGraphDecodeErrorZ {
2760         fn drop(&mut self) {
2761                 if self.result_ok {
2762                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2763                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2764                         }
2765                 } else {
2766                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2767                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2768                         }
2769                 }
2770         }
2771 }
2772 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
2773         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
2774                 let contents = if o.result_ok {
2775                         let result = unsafe { o.contents.result };
2776                         unsafe { o.contents.result = std::ptr::null_mut() };
2777                         CResult_NetworkGraphDecodeErrorZPtr { result }
2778                 } else {
2779                         let err = unsafe { o.contents.err };
2780                         unsafe { o.contents.err = std::ptr::null_mut(); }
2781                         CResult_NetworkGraphDecodeErrorZPtr { err }
2782                 };
2783                 Self {
2784                         contents,
2785                         result_ok: o.result_ok,
2786                 }
2787         }
2788 }