2 pub struct CVec_SpendableOutputDescriptorZ {
3 pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
6 impl CVec_SpendableOutputDescriptorZ {
7 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
8 if self.datalen == 0 { return Vec::new(); }
9 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10 self.data = std::ptr::null_mut();
14 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
15 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
18 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
19 fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
20 let datalen = v.len();
21 let data = Box::into_raw(v.into_boxed_slice());
22 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
26 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
27 impl Drop for CVec_SpendableOutputDescriptorZ {
29 if self.datalen == 0 { return; }
30 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
33 impl Clone for CVec_SpendableOutputDescriptorZ {
34 fn clone(&self) -> Self {
35 let mut res = Vec::new();
36 if self.datalen == 0 { return Self::from(res); }
37 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
42 pub struct CVec_MessageSendEventZ {
43 pub data: *mut crate::util::events::MessageSendEvent,
46 impl CVec_MessageSendEventZ {
47 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
48 if self.datalen == 0 { return Vec::new(); }
49 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
50 self.data = std::ptr::null_mut();
54 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::MessageSendEvent] {
55 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
58 impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
59 fn from(v: Vec<crate::util::events::MessageSendEvent>) -> Self {
60 let datalen = v.len();
61 let data = Box::into_raw(v.into_boxed_slice());
62 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
66 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
67 impl Drop for CVec_MessageSendEventZ {
69 if self.datalen == 0 { return; }
70 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
73 impl Clone for CVec_MessageSendEventZ {
74 fn clone(&self) -> Self {
75 let mut res = Vec::new();
76 if self.datalen == 0 { return Self::from(res); }
77 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
82 pub struct CVec_EventZ {
83 pub data: *mut crate::util::events::Event,
87 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
88 if self.datalen == 0 { return Vec::new(); }
89 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
90 self.data = std::ptr::null_mut();
94 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
95 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
98 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
99 fn from(v: Vec<crate::util::events::Event>) -> Self {
100 let datalen = v.len();
101 let data = Box::into_raw(v.into_boxed_slice());
102 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
106 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
107 impl Drop for CVec_EventZ {
109 if self.datalen == 0 { return; }
110 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
113 impl Clone for CVec_EventZ {
114 fn clone(&self) -> Self {
115 let mut res = Vec::new();
116 if self.datalen == 0 { return Self::from(res); }
117 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
122 pub struct C2Tuple_usizeTransactionZ {
124 pub b: crate::c_types::Transaction,
126 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
127 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
134 impl C2Tuple_usizeTransactionZ {
135 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
140 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
141 C2Tuple_usizeTransactionZ { a, b, }
145 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
147 pub struct CVec_C2Tuple_usizeTransactionZZ {
148 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
151 impl CVec_C2Tuple_usizeTransactionZZ {
152 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
153 if self.datalen == 0 { return Vec::new(); }
154 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
155 self.data = std::ptr::null_mut();
159 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
160 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
163 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
164 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
165 let datalen = v.len();
166 let data = Box::into_raw(v.into_boxed_slice());
167 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
171 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
172 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
174 if self.datalen == 0 { return; }
175 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
179 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
180 /// Note that this value is always NULL, as there are no contents in the OK variant
181 pub result: *mut std::ffi::c_void,
182 pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
185 pub struct CResult_NoneChannelMonitorUpdateErrZ {
186 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
190 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
191 CResult_NoneChannelMonitorUpdateErrZ {
192 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
193 result: std::ptr::null_mut(),
199 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
200 CResult_NoneChannelMonitorUpdateErrZ {
201 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
202 err: Box::into_raw(Box::new(e)),
208 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
209 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
213 if unsafe { !(self.contents.err as *mut ()).is_null() } {
214 let _ = unsafe { Box::from_raw(self.contents.err) };
219 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
220 fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
221 let contents = if o.result_ok {
222 let _ = unsafe { Box::from_raw(o.contents.result) };
223 o.contents.result = std::ptr::null_mut();
224 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
226 let err = unsafe { o.contents.err };
227 unsafe { o.contents.err = std::ptr::null_mut(); }
228 CResult_NoneChannelMonitorUpdateErrZPtr { err }
232 result_ok: o.result_ok,
236 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
237 fn clone(&self) -> Self {
239 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
240 result: std::ptr::null_mut()
243 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
244 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
250 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
252 pub struct CVec_MonitorEventZ {
253 pub data: *mut crate::chain::channelmonitor::MonitorEvent,
256 impl CVec_MonitorEventZ {
257 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
258 if self.datalen == 0 { return Vec::new(); }
259 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
260 self.data = std::ptr::null_mut();
264 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
265 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
268 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
269 fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
270 let datalen = v.len();
271 let data = Box::into_raw(v.into_boxed_slice());
272 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
276 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
277 impl Drop for CVec_MonitorEventZ {
279 if self.datalen == 0 { return; }
280 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
283 impl Clone for CVec_MonitorEventZ {
284 fn clone(&self) -> Self {
285 let mut res = Vec::new();
286 if self.datalen == 0 { return Self::from(res); }
287 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
292 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
293 pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
294 pub err: *mut crate::ln::msgs::DecodeError,
297 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
298 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
302 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
303 CResult_ChannelMonitorUpdateDecodeErrorZ {
304 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
305 result: Box::into_raw(Box::new(o)),
311 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
312 CResult_ChannelMonitorUpdateDecodeErrorZ {
313 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
314 err: Box::into_raw(Box::new(e)),
320 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
321 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
325 let _ = unsafe { Box::from_raw(self.contents.result) };
328 if unsafe { !(self.contents.err as *mut ()).is_null() } {
329 let _ = unsafe { Box::from_raw(self.contents.err) };
334 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
335 fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
336 let contents = if o.result_ok {
337 let result = unsafe { o.contents.result };
338 unsafe { o.contents.result = std::ptr::null_mut() };
339 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
341 let err = unsafe { o.contents.err };
342 unsafe { o.contents.err = std::ptr::null_mut(); }
343 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
347 result_ok: o.result_ok,
351 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
352 fn clone(&self) -> Self {
354 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
355 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
358 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
359 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
365 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
367 pub union CResult_NoneMonitorUpdateErrorZPtr {
368 /// Note that this value is always NULL, as there are no contents in the OK variant
369 pub result: *mut std::ffi::c_void,
370 pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
373 pub struct CResult_NoneMonitorUpdateErrorZ {
374 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
378 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
379 CResult_NoneMonitorUpdateErrorZ {
380 contents: CResult_NoneMonitorUpdateErrorZPtr {
381 result: std::ptr::null_mut(),
387 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
388 CResult_NoneMonitorUpdateErrorZ {
389 contents: CResult_NoneMonitorUpdateErrorZPtr {
390 err: Box::into_raw(Box::new(e)),
396 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
397 impl Drop for CResult_NoneMonitorUpdateErrorZ {
401 if unsafe { !(self.contents.err as *mut ()).is_null() } {
402 let _ = unsafe { Box::from_raw(self.contents.err) };
407 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
408 fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
409 let contents = if o.result_ok {
410 let _ = unsafe { Box::from_raw(o.contents.result) };
411 o.contents.result = std::ptr::null_mut();
412 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
414 let err = unsafe { o.contents.err };
415 unsafe { o.contents.err = std::ptr::null_mut(); }
416 CResult_NoneMonitorUpdateErrorZPtr { err }
420 result_ok: o.result_ok,
424 impl Clone for CResult_NoneMonitorUpdateErrorZ {
425 fn clone(&self) -> Self {
427 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
428 result: std::ptr::null_mut()
431 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
432 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
438 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
440 pub struct C2Tuple_OutPointScriptZ {
441 pub a: crate::chain::transaction::OutPoint,
442 pub b: crate::c_types::derived::CVec_u8Z,
444 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
445 fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
452 impl C2Tuple_OutPointScriptZ {
453 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
458 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
459 C2Tuple_OutPointScriptZ { a, b, }
463 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
465 pub struct CVec_TransactionZ {
466 pub data: *mut crate::c_types::Transaction,
469 impl CVec_TransactionZ {
470 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
471 if self.datalen == 0 { return Vec::new(); }
472 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
473 self.data = std::ptr::null_mut();
477 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
478 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
481 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
482 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
483 let datalen = v.len();
484 let data = Box::into_raw(v.into_boxed_slice());
485 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
489 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
490 impl Drop for CVec_TransactionZ {
492 if self.datalen == 0 { return; }
493 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
497 pub struct C2Tuple_u32TxOutZ {
499 pub b: crate::c_types::TxOut,
501 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
502 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
509 impl C2Tuple_u32TxOutZ {
510 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
514 impl Clone for C2Tuple_u32TxOutZ {
515 fn clone(&self) -> Self {
523 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
525 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
526 C2Tuple_u32TxOutZ { a, b, }
530 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
532 pub struct CVec_C2Tuple_u32TxOutZZ {
533 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
536 impl CVec_C2Tuple_u32TxOutZZ {
537 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
538 if self.datalen == 0 { return Vec::new(); }
539 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
540 self.data = std::ptr::null_mut();
544 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
545 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
548 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
549 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
550 let datalen = v.len();
551 let data = Box::into_raw(v.into_boxed_slice());
552 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
556 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
557 impl Drop for CVec_C2Tuple_u32TxOutZZ {
559 if self.datalen == 0 { return; }
560 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
563 impl Clone for CVec_C2Tuple_u32TxOutZZ {
564 fn clone(&self) -> Self {
565 let mut res = Vec::new();
566 if self.datalen == 0 { return Self::from(res); }
567 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
572 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
573 pub a: crate::c_types::ThirtyTwoBytes,
574 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
576 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
577 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
584 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
585 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
590 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
591 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
595 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
597 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
598 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
601 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
602 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
603 if self.datalen == 0 { return Vec::new(); }
604 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
605 self.data = std::ptr::null_mut();
609 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
610 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
613 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
614 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
615 let datalen = v.len();
616 let data = Box::into_raw(v.into_boxed_slice());
617 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
621 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) { }
622 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
624 if self.datalen == 0 { return; }
625 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
629 pub struct C2Tuple_BlockHashChannelMonitorZ {
630 pub a: crate::c_types::ThirtyTwoBytes,
631 pub b: crate::chain::channelmonitor::ChannelMonitor,
633 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
634 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
641 impl C2Tuple_BlockHashChannelMonitorZ {
642 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
647 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
648 C2Tuple_BlockHashChannelMonitorZ { a, b, }
652 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
654 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
655 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
656 pub err: *mut crate::ln::msgs::DecodeError,
659 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
660 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
664 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
665 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
666 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
667 result: Box::into_raw(Box::new(o)),
673 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
674 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
675 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
676 err: Box::into_raw(Box::new(e)),
682 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
683 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
687 let _ = unsafe { Box::from_raw(self.contents.result) };
690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
691 let _ = unsafe { Box::from_raw(self.contents.err) };
696 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
697 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
698 let contents = if o.result_ok {
699 let result = unsafe { o.contents.result };
700 unsafe { o.contents.result = std::ptr::null_mut() };
701 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
703 let err = unsafe { o.contents.err };
704 unsafe { o.contents.err = std::ptr::null_mut(); }
705 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
709 result_ok: o.result_ok,
714 pub struct C2Tuple_u64u64Z {
718 impl From<(u64, u64)> for C2Tuple_u64u64Z {
719 fn from (tup: (u64, u64)) -> Self {
726 impl C2Tuple_u64u64Z {
727 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
731 impl Clone for C2Tuple_u64u64Z {
732 fn clone(&self) -> Self {
740 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { orig.clone() }
742 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
743 C2Tuple_u64u64Z { a, b, }
747 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
749 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
750 pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
751 pub err: *mut crate::ln::msgs::DecodeError,
754 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
755 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
759 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
760 CResult_SpendableOutputDescriptorDecodeErrorZ {
761 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
762 result: Box::into_raw(Box::new(o)),
768 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
769 CResult_SpendableOutputDescriptorDecodeErrorZ {
770 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
771 err: Box::into_raw(Box::new(e)),
777 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
778 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
782 let _ = unsafe { Box::from_raw(self.contents.result) };
785 if unsafe { !(self.contents.err as *mut ()).is_null() } {
786 let _ = unsafe { Box::from_raw(self.contents.err) };
791 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
792 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
793 let contents = if o.result_ok {
794 let result = unsafe { o.contents.result };
795 unsafe { o.contents.result = std::ptr::null_mut() };
796 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
798 let err = unsafe { o.contents.err };
799 unsafe { o.contents.err = std::ptr::null_mut(); }
800 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
804 result_ok: o.result_ok,
808 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
809 fn clone(&self) -> Self {
811 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
812 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
815 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
816 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
822 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
824 pub struct CVec_SignatureZ {
825 pub data: *mut crate::c_types::Signature,
828 impl CVec_SignatureZ {
829 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
830 if self.datalen == 0 { return Vec::new(); }
831 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
832 self.data = std::ptr::null_mut();
836 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
837 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
840 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
841 fn from(v: Vec<crate::c_types::Signature>) -> Self {
842 let datalen = v.len();
843 let data = Box::into_raw(v.into_boxed_slice());
844 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
848 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
849 impl Drop for CVec_SignatureZ {
851 if self.datalen == 0 { return; }
852 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
855 impl Clone for CVec_SignatureZ {
856 fn clone(&self) -> Self {
857 let mut res = Vec::new();
858 if self.datalen == 0 { return Self::from(res); }
859 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
864 pub struct C2Tuple_SignatureCVec_SignatureZZ {
865 pub a: crate::c_types::Signature,
866 pub b: crate::c_types::derived::CVec_SignatureZ,
868 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
869 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
876 impl C2Tuple_SignatureCVec_SignatureZZ {
877 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
881 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
882 fn clone(&self) -> Self {
890 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
892 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
893 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
897 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
899 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
900 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
901 /// Note that this value is always NULL, as there are no contents in the Err variant
902 pub err: *mut std::ffi::c_void,
905 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
906 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
910 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
911 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
912 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
913 result: Box::into_raw(Box::new(o)),
919 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
920 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
921 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
922 err: std::ptr::null_mut(),
928 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
929 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
932 if unsafe { !(self.contents.result as *mut ()).is_null() } {
933 let _ = unsafe { Box::from_raw(self.contents.result) };
939 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
940 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
941 let contents = if o.result_ok {
942 let result = unsafe { o.contents.result };
943 unsafe { o.contents.result = std::ptr::null_mut() };
944 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
946 let _ = unsafe { Box::from_raw(o.contents.err) };
947 o.contents.err = std::ptr::null_mut();
948 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
952 result_ok: o.result_ok,
956 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
957 fn clone(&self) -> Self {
959 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
960 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
963 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
964 err: std::ptr::null_mut()
970 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
972 pub union CResult_SignatureNoneZPtr {
973 pub result: *mut crate::c_types::Signature,
974 /// Note that this value is always NULL, as there are no contents in the Err variant
975 pub err: *mut std::ffi::c_void,
978 pub struct CResult_SignatureNoneZ {
979 pub contents: CResult_SignatureNoneZPtr,
983 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
984 CResult_SignatureNoneZ {
985 contents: CResult_SignatureNoneZPtr {
986 result: Box::into_raw(Box::new(o)),
992 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
993 CResult_SignatureNoneZ {
994 contents: CResult_SignatureNoneZPtr {
995 err: std::ptr::null_mut(),
1001 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
1002 impl Drop for CResult_SignatureNoneZ {
1003 fn drop(&mut self) {
1005 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1006 let _ = unsafe { Box::from_raw(self.contents.result) };
1012 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
1013 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
1014 let contents = if o.result_ok {
1015 let result = unsafe { o.contents.result };
1016 unsafe { o.contents.result = std::ptr::null_mut() };
1017 CResult_SignatureNoneZPtr { result }
1019 let _ = unsafe { Box::from_raw(o.contents.err) };
1020 o.contents.err = std::ptr::null_mut();
1021 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
1025 result_ok: o.result_ok,
1029 impl Clone for CResult_SignatureNoneZ {
1030 fn clone(&self) -> Self {
1032 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
1033 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
1036 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
1037 err: std::ptr::null_mut()
1043 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
1045 pub union CResult_ChanKeySignerDecodeErrorZPtr {
1046 pub result: *mut crate::chain::keysinterface::ChannelKeys,
1047 pub err: *mut crate::ln::msgs::DecodeError,
1050 pub struct CResult_ChanKeySignerDecodeErrorZ {
1051 pub contents: CResult_ChanKeySignerDecodeErrorZPtr,
1052 pub result_ok: bool,
1055 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::ChannelKeys) -> CResult_ChanKeySignerDecodeErrorZ {
1056 CResult_ChanKeySignerDecodeErrorZ {
1057 contents: CResult_ChanKeySignerDecodeErrorZPtr {
1058 result: Box::into_raw(Box::new(o)),
1064 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChanKeySignerDecodeErrorZ {
1065 CResult_ChanKeySignerDecodeErrorZ {
1066 contents: CResult_ChanKeySignerDecodeErrorZPtr {
1067 err: Box::into_raw(Box::new(e)),
1073 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_free(_res: CResult_ChanKeySignerDecodeErrorZ) { }
1074 impl Drop for CResult_ChanKeySignerDecodeErrorZ {
1075 fn drop(&mut self) {
1077 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1078 let _ = unsafe { Box::from_raw(self.contents.result) };
1081 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1082 let _ = unsafe { Box::from_raw(self.contents.err) };
1087 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>> for CResult_ChanKeySignerDecodeErrorZ {
1088 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
1089 let contents = if o.result_ok {
1090 let result = unsafe { o.contents.result };
1091 unsafe { o.contents.result = std::ptr::null_mut() };
1092 CResult_ChanKeySignerDecodeErrorZPtr { result }
1094 let err = unsafe { o.contents.err };
1095 unsafe { o.contents.err = std::ptr::null_mut(); }
1096 CResult_ChanKeySignerDecodeErrorZPtr { err }
1100 result_ok: o.result_ok,
1104 impl Clone for CResult_ChanKeySignerDecodeErrorZ {
1105 fn clone(&self) -> Self {
1107 Self { result_ok: true, contents: CResult_ChanKeySignerDecodeErrorZPtr {
1108 result: Box::into_raw(Box::new(<crate::chain::keysinterface::ChannelKeys>::clone(unsafe { &*self.contents.result })))
1111 Self { result_ok: false, contents: CResult_ChanKeySignerDecodeErrorZPtr {
1112 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1118 pub extern "C" fn CResult_ChanKeySignerDecodeErrorZ_clone(orig: &CResult_ChanKeySignerDecodeErrorZ) -> CResult_ChanKeySignerDecodeErrorZ { orig.clone() }
1120 pub union CResult_InMemoryChannelKeysDecodeErrorZPtr {
1121 pub result: *mut crate::chain::keysinterface::InMemoryChannelKeys,
1122 pub err: *mut crate::ln::msgs::DecodeError,
1125 pub struct CResult_InMemoryChannelKeysDecodeErrorZ {
1126 pub contents: CResult_InMemoryChannelKeysDecodeErrorZPtr,
1127 pub result_ok: bool,
1130 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemoryChannelKeys) -> CResult_InMemoryChannelKeysDecodeErrorZ {
1131 CResult_InMemoryChannelKeysDecodeErrorZ {
1132 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1133 result: Box::into_raw(Box::new(o)),
1139 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemoryChannelKeysDecodeErrorZ {
1140 CResult_InMemoryChannelKeysDecodeErrorZ {
1141 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1142 err: Box::into_raw(Box::new(e)),
1148 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_free(_res: CResult_InMemoryChannelKeysDecodeErrorZ) { }
1149 impl Drop for CResult_InMemoryChannelKeysDecodeErrorZ {
1150 fn drop(&mut self) {
1152 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1153 let _ = unsafe { Box::from_raw(self.contents.result) };
1156 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1157 let _ = unsafe { Box::from_raw(self.contents.err) };
1162 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>> for CResult_InMemoryChannelKeysDecodeErrorZ {
1163 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
1164 let contents = if o.result_ok {
1165 let result = unsafe { o.contents.result };
1166 unsafe { o.contents.result = std::ptr::null_mut() };
1167 CResult_InMemoryChannelKeysDecodeErrorZPtr { result }
1169 let err = unsafe { o.contents.err };
1170 unsafe { o.contents.err = std::ptr::null_mut(); }
1171 CResult_InMemoryChannelKeysDecodeErrorZPtr { err }
1175 result_ok: o.result_ok,
1179 impl Clone for CResult_InMemoryChannelKeysDecodeErrorZ {
1180 fn clone(&self) -> Self {
1182 Self { result_ok: true, contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1183 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemoryChannelKeys>::clone(unsafe { &*self.contents.result })))
1186 Self { result_ok: false, contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
1187 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1193 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig: &CResult_InMemoryChannelKeysDecodeErrorZ) -> CResult_InMemoryChannelKeysDecodeErrorZ { orig.clone() }
1195 pub union CResult_TxOutAccessErrorZPtr {
1196 pub result: *mut crate::c_types::TxOut,
1197 pub err: *mut crate::chain::AccessError,
1200 pub struct CResult_TxOutAccessErrorZ {
1201 pub contents: CResult_TxOutAccessErrorZPtr,
1202 pub result_ok: bool,
1205 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
1206 CResult_TxOutAccessErrorZ {
1207 contents: CResult_TxOutAccessErrorZPtr {
1208 result: Box::into_raw(Box::new(o)),
1214 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
1215 CResult_TxOutAccessErrorZ {
1216 contents: CResult_TxOutAccessErrorZPtr {
1217 err: Box::into_raw(Box::new(e)),
1223 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
1224 impl Drop for CResult_TxOutAccessErrorZ {
1225 fn drop(&mut self) {
1227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1228 let _ = unsafe { Box::from_raw(self.contents.result) };
1231 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1232 let _ = unsafe { Box::from_raw(self.contents.err) };
1237 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
1238 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
1239 let contents = if o.result_ok {
1240 let result = unsafe { o.contents.result };
1241 unsafe { o.contents.result = std::ptr::null_mut() };
1242 CResult_TxOutAccessErrorZPtr { result }
1244 let err = unsafe { o.contents.err };
1245 unsafe { o.contents.err = std::ptr::null_mut(); }
1246 CResult_TxOutAccessErrorZPtr { err }
1250 result_ok: o.result_ok,
1254 impl Clone for CResult_TxOutAccessErrorZ {
1255 fn clone(&self) -> Self {
1257 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
1258 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
1261 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
1262 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
1268 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
1270 pub union CResult_NoneAPIErrorZPtr {
1271 /// Note that this value is always NULL, as there are no contents in the OK variant
1272 pub result: *mut std::ffi::c_void,
1273 pub err: *mut crate::util::errors::APIError,
1276 pub struct CResult_NoneAPIErrorZ {
1277 pub contents: CResult_NoneAPIErrorZPtr,
1278 pub result_ok: bool,
1281 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
1282 CResult_NoneAPIErrorZ {
1283 contents: CResult_NoneAPIErrorZPtr {
1284 result: std::ptr::null_mut(),
1290 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
1291 CResult_NoneAPIErrorZ {
1292 contents: CResult_NoneAPIErrorZPtr {
1293 err: Box::into_raw(Box::new(e)),
1299 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
1300 impl Drop for CResult_NoneAPIErrorZ {
1301 fn drop(&mut self) {
1304 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1305 let _ = unsafe { Box::from_raw(self.contents.err) };
1310 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
1311 fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
1312 let contents = if o.result_ok {
1313 let _ = unsafe { Box::from_raw(o.contents.result) };
1314 o.contents.result = std::ptr::null_mut();
1315 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
1317 let err = unsafe { o.contents.err };
1318 unsafe { o.contents.err = std::ptr::null_mut(); }
1319 CResult_NoneAPIErrorZPtr { err }
1323 result_ok: o.result_ok,
1327 impl Clone for CResult_NoneAPIErrorZ {
1328 fn clone(&self) -> Self {
1330 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
1331 result: std::ptr::null_mut()
1334 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
1335 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
1341 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
1343 pub struct CVec_ChannelDetailsZ {
1344 pub data: *mut crate::ln::channelmanager::ChannelDetails,
1347 impl CVec_ChannelDetailsZ {
1348 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
1349 if self.datalen == 0 { return Vec::new(); }
1350 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1351 self.data = std::ptr::null_mut();
1355 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
1356 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1359 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
1360 fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
1361 let datalen = v.len();
1362 let data = Box::into_raw(v.into_boxed_slice());
1363 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1367 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
1368 impl Drop for CVec_ChannelDetailsZ {
1369 fn drop(&mut self) {
1370 if self.datalen == 0 { return; }
1371 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1374 impl Clone for CVec_ChannelDetailsZ {
1375 fn clone(&self) -> Self {
1376 let mut res = Vec::new();
1377 if self.datalen == 0 { return Self::from(res); }
1378 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1383 pub union CResult_NonePaymentSendFailureZPtr {
1384 /// Note that this value is always NULL, as there are no contents in the OK variant
1385 pub result: *mut std::ffi::c_void,
1386 pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
1389 pub struct CResult_NonePaymentSendFailureZ {
1390 pub contents: CResult_NonePaymentSendFailureZPtr,
1391 pub result_ok: bool,
1394 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
1395 CResult_NonePaymentSendFailureZ {
1396 contents: CResult_NonePaymentSendFailureZPtr {
1397 result: std::ptr::null_mut(),
1403 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
1404 CResult_NonePaymentSendFailureZ {
1405 contents: CResult_NonePaymentSendFailureZPtr {
1406 err: Box::into_raw(Box::new(e)),
1412 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
1413 impl Drop for CResult_NonePaymentSendFailureZ {
1414 fn drop(&mut self) {
1417 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1418 let _ = unsafe { Box::from_raw(self.contents.err) };
1423 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
1424 fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
1425 let contents = if o.result_ok {
1426 let _ = unsafe { Box::from_raw(o.contents.result) };
1427 o.contents.result = std::ptr::null_mut();
1428 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
1430 let err = unsafe { o.contents.err };
1431 unsafe { o.contents.err = std::ptr::null_mut(); }
1432 CResult_NonePaymentSendFailureZPtr { err }
1436 result_ok: o.result_ok,
1440 impl Clone for CResult_NonePaymentSendFailureZ {
1441 fn clone(&self) -> Self {
1443 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
1444 result: std::ptr::null_mut()
1447 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
1448 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
1454 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
1456 pub struct CVec_NetAddressZ {
1457 pub data: *mut crate::ln::msgs::NetAddress,
1460 impl CVec_NetAddressZ {
1461 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NetAddress> {
1462 if self.datalen == 0 { return Vec::new(); }
1463 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1464 self.data = std::ptr::null_mut();
1468 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NetAddress] {
1469 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1472 impl From<Vec<crate::ln::msgs::NetAddress>> for CVec_NetAddressZ {
1473 fn from(v: Vec<crate::ln::msgs::NetAddress>) -> Self {
1474 let datalen = v.len();
1475 let data = Box::into_raw(v.into_boxed_slice());
1476 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1480 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
1481 impl Drop for CVec_NetAddressZ {
1482 fn drop(&mut self) {
1483 if self.datalen == 0 { return; }
1484 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1487 impl Clone for CVec_NetAddressZ {
1488 fn clone(&self) -> Self {
1489 let mut res = Vec::new();
1490 if self.datalen == 0 { return Self::from(res); }
1491 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1496 pub struct CVec_ChannelMonitorZ {
1497 pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
1500 impl CVec_ChannelMonitorZ {
1501 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
1502 if self.datalen == 0 { return Vec::new(); }
1503 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1504 self.data = std::ptr::null_mut();
1508 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
1509 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1512 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
1513 fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
1514 let datalen = v.len();
1515 let data = Box::into_raw(v.into_boxed_slice());
1516 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1520 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
1521 impl Drop for CVec_ChannelMonitorZ {
1522 fn drop(&mut self) {
1523 if self.datalen == 0 { return; }
1524 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1528 pub struct C2Tuple_BlockHashChannelManagerZ {
1529 pub a: crate::c_types::ThirtyTwoBytes,
1530 pub b: crate::ln::channelmanager::ChannelManager,
1532 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
1533 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
1540 impl C2Tuple_BlockHashChannelManagerZ {
1541 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
1546 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
1547 C2Tuple_BlockHashChannelManagerZ { a, b, }
1551 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
1553 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1554 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
1555 pub err: *mut crate::ln::msgs::DecodeError,
1558 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1559 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
1560 pub result_ok: bool,
1563 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1564 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1565 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1566 result: Box::into_raw(Box::new(o)),
1572 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1573 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1574 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1575 err: Box::into_raw(Box::new(e)),
1581 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
1582 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1583 fn drop(&mut self) {
1585 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1586 let _ = unsafe { Box::from_raw(self.contents.result) };
1589 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1590 let _ = unsafe { Box::from_raw(self.contents.err) };
1595 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1596 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
1597 let contents = if o.result_ok {
1598 let result = unsafe { o.contents.result };
1599 unsafe { o.contents.result = std::ptr::null_mut() };
1600 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
1602 let err = unsafe { o.contents.err };
1603 unsafe { o.contents.err = std::ptr::null_mut(); }
1604 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
1608 result_ok: o.result_ok,
1613 pub union CResult_NetAddressu8ZPtr {
1614 pub result: *mut crate::ln::msgs::NetAddress,
1618 pub struct CResult_NetAddressu8Z {
1619 pub contents: CResult_NetAddressu8ZPtr,
1620 pub result_ok: bool,
1623 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
1624 CResult_NetAddressu8Z {
1625 contents: CResult_NetAddressu8ZPtr {
1626 result: Box::into_raw(Box::new(o)),
1632 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
1633 CResult_NetAddressu8Z {
1634 contents: CResult_NetAddressu8ZPtr {
1635 err: Box::into_raw(Box::new(e)),
1641 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
1642 impl Drop for CResult_NetAddressu8Z {
1643 fn drop(&mut self) {
1645 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1646 let _ = unsafe { Box::from_raw(self.contents.result) };
1649 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1650 let _ = unsafe { Box::from_raw(self.contents.err) };
1655 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
1656 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
1657 let contents = if o.result_ok {
1658 let result = unsafe { o.contents.result };
1659 unsafe { o.contents.result = std::ptr::null_mut() };
1660 CResult_NetAddressu8ZPtr { result }
1662 let err = unsafe { o.contents.err };
1663 unsafe { o.contents.err = std::ptr::null_mut(); }
1664 CResult_NetAddressu8ZPtr { err }
1668 result_ok: o.result_ok,
1672 impl Clone for CResult_NetAddressu8Z {
1673 fn clone(&self) -> Self {
1675 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
1676 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
1679 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
1680 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
1686 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
1688 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1689 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
1690 pub err: *mut crate::ln::msgs::DecodeError,
1693 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
1694 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
1695 pub result_ok: bool,
1698 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1699 CResult_CResult_NetAddressu8ZDecodeErrorZ {
1700 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1701 result: Box::into_raw(Box::new(o)),
1707 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
1708 CResult_CResult_NetAddressu8ZDecodeErrorZ {
1709 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1710 err: Box::into_raw(Box::new(e)),
1716 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
1717 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1718 fn drop(&mut self) {
1720 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1721 let _ = unsafe { Box::from_raw(self.contents.result) };
1724 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1725 let _ = unsafe { Box::from_raw(self.contents.err) };
1730 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1731 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
1732 let contents = if o.result_ok {
1733 let result = unsafe { o.contents.result };
1734 unsafe { o.contents.result = std::ptr::null_mut() };
1735 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
1737 let err = unsafe { o.contents.err };
1738 unsafe { o.contents.err = std::ptr::null_mut(); }
1739 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
1743 result_ok: o.result_ok,
1747 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
1748 fn clone(&self) -> Self {
1750 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1751 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
1754 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1755 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1761 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
1763 pub struct CVec_u64Z {
1768 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
1769 if self.datalen == 0 { return Vec::new(); }
1770 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1771 self.data = std::ptr::null_mut();
1775 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
1776 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1779 impl From<Vec<u64>> for CVec_u64Z {
1780 fn from(v: Vec<u64>) -> Self {
1781 let datalen = v.len();
1782 let data = Box::into_raw(v.into_boxed_slice());
1783 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1787 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
1788 impl Drop for CVec_u64Z {
1789 fn drop(&mut self) {
1790 if self.datalen == 0 { return; }
1791 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1794 impl Clone for CVec_u64Z {
1795 fn clone(&self) -> Self {
1796 let mut res = Vec::new();
1797 if self.datalen == 0 { return Self::from(res); }
1798 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1803 pub struct CVec_UpdateAddHTLCZ {
1804 pub data: *mut crate::ln::msgs::UpdateAddHTLC,
1807 impl CVec_UpdateAddHTLCZ {
1808 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
1809 if self.datalen == 0 { return Vec::new(); }
1810 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1811 self.data = std::ptr::null_mut();
1815 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
1816 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1819 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
1820 fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
1821 let datalen = v.len();
1822 let data = Box::into_raw(v.into_boxed_slice());
1823 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1827 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
1828 impl Drop for CVec_UpdateAddHTLCZ {
1829 fn drop(&mut self) {
1830 if self.datalen == 0 { return; }
1831 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1834 impl Clone for CVec_UpdateAddHTLCZ {
1835 fn clone(&self) -> Self {
1836 let mut res = Vec::new();
1837 if self.datalen == 0 { return Self::from(res); }
1838 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1843 pub struct CVec_UpdateFulfillHTLCZ {
1844 pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
1847 impl CVec_UpdateFulfillHTLCZ {
1848 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
1849 if self.datalen == 0 { return Vec::new(); }
1850 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1851 self.data = std::ptr::null_mut();
1855 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
1856 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1859 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
1860 fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
1861 let datalen = v.len();
1862 let data = Box::into_raw(v.into_boxed_slice());
1863 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1867 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
1868 impl Drop for CVec_UpdateFulfillHTLCZ {
1869 fn drop(&mut self) {
1870 if self.datalen == 0 { return; }
1871 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1874 impl Clone for CVec_UpdateFulfillHTLCZ {
1875 fn clone(&self) -> Self {
1876 let mut res = Vec::new();
1877 if self.datalen == 0 { return Self::from(res); }
1878 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1883 pub struct CVec_UpdateFailHTLCZ {
1884 pub data: *mut crate::ln::msgs::UpdateFailHTLC,
1887 impl CVec_UpdateFailHTLCZ {
1888 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
1889 if self.datalen == 0 { return Vec::new(); }
1890 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1891 self.data = std::ptr::null_mut();
1895 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
1896 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1899 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
1900 fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
1901 let datalen = v.len();
1902 let data = Box::into_raw(v.into_boxed_slice());
1903 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1907 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
1908 impl Drop for CVec_UpdateFailHTLCZ {
1909 fn drop(&mut self) {
1910 if self.datalen == 0 { return; }
1911 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1914 impl Clone for CVec_UpdateFailHTLCZ {
1915 fn clone(&self) -> Self {
1916 let mut res = Vec::new();
1917 if self.datalen == 0 { return Self::from(res); }
1918 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1923 pub struct CVec_UpdateFailMalformedHTLCZ {
1924 pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
1927 impl CVec_UpdateFailMalformedHTLCZ {
1928 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
1929 if self.datalen == 0 { return Vec::new(); }
1930 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1931 self.data = std::ptr::null_mut();
1935 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
1936 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1939 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
1940 fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
1941 let datalen = v.len();
1942 let data = Box::into_raw(v.into_boxed_slice());
1943 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1947 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
1948 impl Drop for CVec_UpdateFailMalformedHTLCZ {
1949 fn drop(&mut self) {
1950 if self.datalen == 0 { return; }
1951 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1954 impl Clone for CVec_UpdateFailMalformedHTLCZ {
1955 fn clone(&self) -> Self {
1956 let mut res = Vec::new();
1957 if self.datalen == 0 { return Self::from(res); }
1958 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1963 pub union CResult_boolLightningErrorZPtr {
1964 pub result: *mut bool,
1965 pub err: *mut crate::ln::msgs::LightningError,
1968 pub struct CResult_boolLightningErrorZ {
1969 pub contents: CResult_boolLightningErrorZPtr,
1970 pub result_ok: bool,
1973 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1974 CResult_boolLightningErrorZ {
1975 contents: CResult_boolLightningErrorZPtr {
1976 result: Box::into_raw(Box::new(o)),
1982 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1983 CResult_boolLightningErrorZ {
1984 contents: CResult_boolLightningErrorZPtr {
1985 err: Box::into_raw(Box::new(e)),
1991 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1992 impl Drop for CResult_boolLightningErrorZ {
1993 fn drop(&mut self) {
1995 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1996 let _ = unsafe { Box::from_raw(self.contents.result) };
1999 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2000 let _ = unsafe { Box::from_raw(self.contents.err) };
2005 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
2006 fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
2007 let contents = if o.result_ok {
2008 let result = unsafe { o.contents.result };
2009 unsafe { o.contents.result = std::ptr::null_mut() };
2010 CResult_boolLightningErrorZPtr { result }
2012 let err = unsafe { o.contents.err };
2013 unsafe { o.contents.err = std::ptr::null_mut(); }
2014 CResult_boolLightningErrorZPtr { err }
2018 result_ok: o.result_ok,
2022 impl Clone for CResult_boolLightningErrorZ {
2023 fn clone(&self) -> Self {
2025 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
2026 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
2029 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
2030 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2036 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
2038 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2039 pub a: crate::ln::msgs::ChannelAnnouncement,
2040 pub b: crate::ln::msgs::ChannelUpdate,
2041 pub c: crate::ln::msgs::ChannelUpdate,
2043 impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2044 fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
2052 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2053 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
2054 (self.a, self.b, self.c)
2057 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2058 fn clone(&self) -> Self {
2067 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
2069 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2070 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
2074 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
2076 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2077 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
2080 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2081 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
2082 if self.datalen == 0 { return Vec::new(); }
2083 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2084 self.data = std::ptr::null_mut();
2088 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
2089 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2092 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2093 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
2094 let datalen = v.len();
2095 let data = Box::into_raw(v.into_boxed_slice());
2096 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2100 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
2101 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2102 fn drop(&mut self) {
2103 if self.datalen == 0 { return; }
2104 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2107 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2108 fn clone(&self) -> Self {
2109 let mut res = Vec::new();
2110 if self.datalen == 0 { return Self::from(res); }
2111 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2116 pub struct CVec_NodeAnnouncementZ {
2117 pub data: *mut crate::ln::msgs::NodeAnnouncement,
2120 impl CVec_NodeAnnouncementZ {
2121 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
2122 if self.datalen == 0 { return Vec::new(); }
2123 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2124 self.data = std::ptr::null_mut();
2128 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
2129 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2132 impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
2133 fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
2134 let datalen = v.len();
2135 let data = Box::into_raw(v.into_boxed_slice());
2136 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2140 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
2141 impl Drop for CVec_NodeAnnouncementZ {
2142 fn drop(&mut self) {
2143 if self.datalen == 0 { return; }
2144 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2147 impl Clone for CVec_NodeAnnouncementZ {
2148 fn clone(&self) -> Self {
2149 let mut res = Vec::new();
2150 if self.datalen == 0 { return Self::from(res); }
2151 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2156 pub union CResult_NoneLightningErrorZPtr {
2157 /// Note that this value is always NULL, as there are no contents in the OK variant
2158 pub result: *mut std::ffi::c_void,
2159 pub err: *mut crate::ln::msgs::LightningError,
2162 pub struct CResult_NoneLightningErrorZ {
2163 pub contents: CResult_NoneLightningErrorZPtr,
2164 pub result_ok: bool,
2167 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
2168 CResult_NoneLightningErrorZ {
2169 contents: CResult_NoneLightningErrorZPtr {
2170 result: std::ptr::null_mut(),
2176 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
2177 CResult_NoneLightningErrorZ {
2178 contents: CResult_NoneLightningErrorZPtr {
2179 err: Box::into_raw(Box::new(e)),
2185 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
2186 impl Drop for CResult_NoneLightningErrorZ {
2187 fn drop(&mut self) {
2190 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2191 let _ = unsafe { Box::from_raw(self.contents.err) };
2196 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
2197 fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
2198 let contents = if o.result_ok {
2199 let _ = unsafe { Box::from_raw(o.contents.result) };
2200 o.contents.result = std::ptr::null_mut();
2201 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
2203 let err = unsafe { o.contents.err };
2204 unsafe { o.contents.err = std::ptr::null_mut(); }
2205 CResult_NoneLightningErrorZPtr { err }
2209 result_ok: o.result_ok,
2213 impl Clone for CResult_NoneLightningErrorZ {
2214 fn clone(&self) -> Self {
2216 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
2217 result: std::ptr::null_mut()
2220 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
2221 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2227 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
2229 pub union CResult_ChannelReestablishDecodeErrorZPtr {
2230 pub result: *mut crate::ln::msgs::ChannelReestablish,
2231 pub err: *mut crate::ln::msgs::DecodeError,
2234 pub struct CResult_ChannelReestablishDecodeErrorZ {
2235 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
2236 pub result_ok: bool,
2239 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
2240 CResult_ChannelReestablishDecodeErrorZ {
2241 contents: CResult_ChannelReestablishDecodeErrorZPtr {
2242 result: Box::into_raw(Box::new(o)),
2248 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
2249 CResult_ChannelReestablishDecodeErrorZ {
2250 contents: CResult_ChannelReestablishDecodeErrorZPtr {
2251 err: Box::into_raw(Box::new(e)),
2257 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
2258 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
2259 fn drop(&mut self) {
2261 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2262 let _ = unsafe { Box::from_raw(self.contents.result) };
2265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2266 let _ = unsafe { Box::from_raw(self.contents.err) };
2271 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
2272 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
2273 let contents = if o.result_ok {
2274 let result = unsafe { o.contents.result };
2275 unsafe { o.contents.result = std::ptr::null_mut() };
2276 CResult_ChannelReestablishDecodeErrorZPtr { result }
2278 let err = unsafe { o.contents.err };
2279 unsafe { o.contents.err = std::ptr::null_mut(); }
2280 CResult_ChannelReestablishDecodeErrorZPtr { err }
2284 result_ok: o.result_ok,
2288 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
2289 fn clone(&self) -> Self {
2291 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
2292 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
2295 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
2296 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2302 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
2304 pub union CResult_InitDecodeErrorZPtr {
2305 pub result: *mut crate::ln::msgs::Init,
2306 pub err: *mut crate::ln::msgs::DecodeError,
2309 pub struct CResult_InitDecodeErrorZ {
2310 pub contents: CResult_InitDecodeErrorZPtr,
2311 pub result_ok: bool,
2314 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
2315 CResult_InitDecodeErrorZ {
2316 contents: CResult_InitDecodeErrorZPtr {
2317 result: Box::into_raw(Box::new(o)),
2323 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
2324 CResult_InitDecodeErrorZ {
2325 contents: CResult_InitDecodeErrorZPtr {
2326 err: Box::into_raw(Box::new(e)),
2332 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
2333 impl Drop for CResult_InitDecodeErrorZ {
2334 fn drop(&mut self) {
2336 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2337 let _ = unsafe { Box::from_raw(self.contents.result) };
2340 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2341 let _ = unsafe { Box::from_raw(self.contents.err) };
2346 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
2347 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
2348 let contents = if o.result_ok {
2349 let result = unsafe { o.contents.result };
2350 unsafe { o.contents.result = std::ptr::null_mut() };
2351 CResult_InitDecodeErrorZPtr { result }
2353 let err = unsafe { o.contents.err };
2354 unsafe { o.contents.err = std::ptr::null_mut(); }
2355 CResult_InitDecodeErrorZPtr { err }
2359 result_ok: o.result_ok,
2363 impl Clone for CResult_InitDecodeErrorZ {
2364 fn clone(&self) -> Self {
2366 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
2367 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
2370 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
2371 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2377 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
2379 pub union CResult_PingDecodeErrorZPtr {
2380 pub result: *mut crate::ln::msgs::Ping,
2381 pub err: *mut crate::ln::msgs::DecodeError,
2384 pub struct CResult_PingDecodeErrorZ {
2385 pub contents: CResult_PingDecodeErrorZPtr,
2386 pub result_ok: bool,
2389 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
2390 CResult_PingDecodeErrorZ {
2391 contents: CResult_PingDecodeErrorZPtr {
2392 result: Box::into_raw(Box::new(o)),
2398 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
2399 CResult_PingDecodeErrorZ {
2400 contents: CResult_PingDecodeErrorZPtr {
2401 err: Box::into_raw(Box::new(e)),
2407 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
2408 impl Drop for CResult_PingDecodeErrorZ {
2409 fn drop(&mut self) {
2411 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2412 let _ = unsafe { Box::from_raw(self.contents.result) };
2415 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2416 let _ = unsafe { Box::from_raw(self.contents.err) };
2421 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
2422 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
2423 let contents = if o.result_ok {
2424 let result = unsafe { o.contents.result };
2425 unsafe { o.contents.result = std::ptr::null_mut() };
2426 CResult_PingDecodeErrorZPtr { result }
2428 let err = unsafe { o.contents.err };
2429 unsafe { o.contents.err = std::ptr::null_mut(); }
2430 CResult_PingDecodeErrorZPtr { err }
2434 result_ok: o.result_ok,
2438 impl Clone for CResult_PingDecodeErrorZ {
2439 fn clone(&self) -> Self {
2441 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
2442 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
2445 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
2446 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2452 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
2454 pub union CResult_PongDecodeErrorZPtr {
2455 pub result: *mut crate::ln::msgs::Pong,
2456 pub err: *mut crate::ln::msgs::DecodeError,
2459 pub struct CResult_PongDecodeErrorZ {
2460 pub contents: CResult_PongDecodeErrorZPtr,
2461 pub result_ok: bool,
2464 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
2465 CResult_PongDecodeErrorZ {
2466 contents: CResult_PongDecodeErrorZPtr {
2467 result: Box::into_raw(Box::new(o)),
2473 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
2474 CResult_PongDecodeErrorZ {
2475 contents: CResult_PongDecodeErrorZPtr {
2476 err: Box::into_raw(Box::new(e)),
2482 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
2483 impl Drop for CResult_PongDecodeErrorZ {
2484 fn drop(&mut self) {
2486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2487 let _ = unsafe { Box::from_raw(self.contents.result) };
2490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2491 let _ = unsafe { Box::from_raw(self.contents.err) };
2496 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
2497 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
2498 let contents = if o.result_ok {
2499 let result = unsafe { o.contents.result };
2500 unsafe { o.contents.result = std::ptr::null_mut() };
2501 CResult_PongDecodeErrorZPtr { result }
2503 let err = unsafe { o.contents.err };
2504 unsafe { o.contents.err = std::ptr::null_mut(); }
2505 CResult_PongDecodeErrorZPtr { err }
2509 result_ok: o.result_ok,
2513 impl Clone for CResult_PongDecodeErrorZ {
2514 fn clone(&self) -> Self {
2516 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
2517 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
2520 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
2521 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2527 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
2529 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2530 pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
2531 pub err: *mut crate::ln::msgs::DecodeError,
2534 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2535 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
2536 pub result_ok: bool,
2539 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2540 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2541 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2542 result: Box::into_raw(Box::new(o)),
2548 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2549 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2550 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2551 err: Box::into_raw(Box::new(e)),
2557 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
2558 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2559 fn drop(&mut self) {
2561 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2562 let _ = unsafe { Box::from_raw(self.contents.result) };
2565 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2566 let _ = unsafe { Box::from_raw(self.contents.err) };
2571 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2572 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
2573 let contents = if o.result_ok {
2574 let result = unsafe { o.contents.result };
2575 unsafe { o.contents.result = std::ptr::null_mut() };
2576 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
2578 let err = unsafe { o.contents.err };
2579 unsafe { o.contents.err = std::ptr::null_mut(); }
2580 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
2584 result_ok: o.result_ok,
2588 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
2589 fn clone(&self) -> Self {
2591 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2592 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
2595 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2596 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2602 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
2604 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2605 pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
2606 pub err: *mut crate::ln::msgs::DecodeError,
2609 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
2610 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
2611 pub result_ok: bool,
2614 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
2615 CResult_UnsignedChannelUpdateDecodeErrorZ {
2616 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2617 result: Box::into_raw(Box::new(o)),
2623 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
2624 CResult_UnsignedChannelUpdateDecodeErrorZ {
2625 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2626 err: Box::into_raw(Box::new(e)),
2632 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
2633 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
2634 fn drop(&mut self) {
2636 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2637 let _ = unsafe { Box::from_raw(self.contents.result) };
2640 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2641 let _ = unsafe { Box::from_raw(self.contents.err) };
2646 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
2647 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
2648 let contents = if o.result_ok {
2649 let result = unsafe { o.contents.result };
2650 unsafe { o.contents.result = std::ptr::null_mut() };
2651 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
2653 let err = unsafe { o.contents.err };
2654 unsafe { o.contents.err = std::ptr::null_mut(); }
2655 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
2659 result_ok: o.result_ok,
2663 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
2664 fn clone(&self) -> Self {
2666 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2667 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
2670 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
2671 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
2679 pub union CResult_ErrorMessageDecodeErrorZPtr {
2680 pub result: *mut crate::ln::msgs::ErrorMessage,
2681 pub err: *mut crate::ln::msgs::DecodeError,
2684 pub struct CResult_ErrorMessageDecodeErrorZ {
2685 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
2686 pub result_ok: bool,
2689 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
2690 CResult_ErrorMessageDecodeErrorZ {
2691 contents: CResult_ErrorMessageDecodeErrorZPtr {
2692 result: Box::into_raw(Box::new(o)),
2698 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
2699 CResult_ErrorMessageDecodeErrorZ {
2700 contents: CResult_ErrorMessageDecodeErrorZPtr {
2701 err: Box::into_raw(Box::new(e)),
2707 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
2708 impl Drop for CResult_ErrorMessageDecodeErrorZ {
2709 fn drop(&mut self) {
2711 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2712 let _ = unsafe { Box::from_raw(self.contents.result) };
2715 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2716 let _ = unsafe { Box::from_raw(self.contents.err) };
2721 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
2722 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
2723 let contents = if o.result_ok {
2724 let result = unsafe { o.contents.result };
2725 unsafe { o.contents.result = std::ptr::null_mut() };
2726 CResult_ErrorMessageDecodeErrorZPtr { result }
2728 let err = unsafe { o.contents.err };
2729 unsafe { o.contents.err = std::ptr::null_mut(); }
2730 CResult_ErrorMessageDecodeErrorZPtr { err }
2734 result_ok: o.result_ok,
2738 impl Clone for CResult_ErrorMessageDecodeErrorZ {
2739 fn clone(&self) -> Self {
2741 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
2742 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
2745 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
2746 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2752 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
2754 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2755 pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
2756 pub err: *mut crate::ln::msgs::DecodeError,
2759 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2760 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
2761 pub result_ok: bool,
2764 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2765 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2766 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2767 result: Box::into_raw(Box::new(o)),
2773 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2774 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2775 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2776 err: Box::into_raw(Box::new(e)),
2782 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
2783 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2784 fn drop(&mut self) {
2786 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2787 let _ = unsafe { Box::from_raw(self.contents.result) };
2790 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2791 let _ = unsafe { Box::from_raw(self.contents.err) };
2796 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2797 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
2798 let contents = if o.result_ok {
2799 let result = unsafe { o.contents.result };
2800 unsafe { o.contents.result = std::ptr::null_mut() };
2801 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
2803 let err = unsafe { o.contents.err };
2804 unsafe { o.contents.err = std::ptr::null_mut(); }
2805 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
2809 result_ok: o.result_ok,
2813 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
2814 fn clone(&self) -> Self {
2816 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2817 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
2820 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2821 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2827 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
2829 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
2830 pub result: *mut crate::ln::msgs::QueryShortChannelIds,
2831 pub err: *mut crate::ln::msgs::DecodeError,
2834 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
2835 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
2836 pub result_ok: bool,
2839 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
2840 CResult_QueryShortChannelIdsDecodeErrorZ {
2841 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2842 result: Box::into_raw(Box::new(o)),
2848 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
2849 CResult_QueryShortChannelIdsDecodeErrorZ {
2850 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2851 err: Box::into_raw(Box::new(e)),
2857 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
2858 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
2859 fn drop(&mut self) {
2861 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2862 let _ = unsafe { Box::from_raw(self.contents.result) };
2865 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2866 let _ = unsafe { Box::from_raw(self.contents.err) };
2871 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
2872 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
2873 let contents = if o.result_ok {
2874 let result = unsafe { o.contents.result };
2875 unsafe { o.contents.result = std::ptr::null_mut() };
2876 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
2878 let err = unsafe { o.contents.err };
2879 unsafe { o.contents.err = std::ptr::null_mut(); }
2880 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
2884 result_ok: o.result_ok,
2888 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
2889 fn clone(&self) -> Self {
2891 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2892 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
2895 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
2896 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2902 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
2904 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2905 pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
2906 pub err: *mut crate::ln::msgs::DecodeError,
2909 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2910 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
2911 pub result_ok: bool,
2914 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2915 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2916 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2917 result: Box::into_raw(Box::new(o)),
2923 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2924 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2925 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2926 err: Box::into_raw(Box::new(e)),
2932 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
2933 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2934 fn drop(&mut self) {
2936 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2937 let _ = unsafe { Box::from_raw(self.contents.result) };
2940 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2941 let _ = unsafe { Box::from_raw(self.contents.err) };
2946 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2947 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
2948 let contents = if o.result_ok {
2949 let result = unsafe { o.contents.result };
2950 unsafe { o.contents.result = std::ptr::null_mut() };
2951 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
2953 let err = unsafe { o.contents.err };
2954 unsafe { o.contents.err = std::ptr::null_mut(); }
2955 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
2959 result_ok: o.result_ok,
2963 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
2964 fn clone(&self) -> Self {
2966 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2967 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
2970 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2971 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2977 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
2979 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
2980 pub result: *mut crate::ln::msgs::QueryChannelRange,
2981 pub err: *mut crate::ln::msgs::DecodeError,
2984 pub struct CResult_QueryChannelRangeDecodeErrorZ {
2985 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
2986 pub result_ok: bool,
2989 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
2990 CResult_QueryChannelRangeDecodeErrorZ {
2991 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
2992 result: Box::into_raw(Box::new(o)),
2998 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
2999 CResult_QueryChannelRangeDecodeErrorZ {
3000 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
3001 err: Box::into_raw(Box::new(e)),
3007 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
3008 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
3009 fn drop(&mut self) {
3011 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3012 let _ = unsafe { Box::from_raw(self.contents.result) };
3015 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3016 let _ = unsafe { Box::from_raw(self.contents.err) };
3021 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
3022 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
3023 let contents = if o.result_ok {
3024 let result = unsafe { o.contents.result };
3025 unsafe { o.contents.result = std::ptr::null_mut() };
3026 CResult_QueryChannelRangeDecodeErrorZPtr { result }
3028 let err = unsafe { o.contents.err };
3029 unsafe { o.contents.err = std::ptr::null_mut(); }
3030 CResult_QueryChannelRangeDecodeErrorZPtr { err }
3034 result_ok: o.result_ok,
3038 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
3039 fn clone(&self) -> Self {
3041 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
3042 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
3045 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
3046 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3052 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
3054 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
3055 pub result: *mut crate::ln::msgs::ReplyChannelRange,
3056 pub err: *mut crate::ln::msgs::DecodeError,
3059 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
3060 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
3061 pub result_ok: bool,
3064 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
3065 CResult_ReplyChannelRangeDecodeErrorZ {
3066 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3067 result: Box::into_raw(Box::new(o)),
3073 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
3074 CResult_ReplyChannelRangeDecodeErrorZ {
3075 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3076 err: Box::into_raw(Box::new(e)),
3082 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
3083 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
3084 fn drop(&mut self) {
3086 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3087 let _ = unsafe { Box::from_raw(self.contents.result) };
3090 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3091 let _ = unsafe { Box::from_raw(self.contents.err) };
3096 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
3097 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
3098 let contents = if o.result_ok {
3099 let result = unsafe { o.contents.result };
3100 unsafe { o.contents.result = std::ptr::null_mut() };
3101 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
3103 let err = unsafe { o.contents.err };
3104 unsafe { o.contents.err = std::ptr::null_mut(); }
3105 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
3109 result_ok: o.result_ok,
3113 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
3114 fn clone(&self) -> Self {
3116 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3117 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
3120 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
3121 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3127 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
3129 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
3130 pub result: *mut crate::ln::msgs::GossipTimestampFilter,
3131 pub err: *mut crate::ln::msgs::DecodeError,
3134 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
3135 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
3136 pub result_ok: bool,
3139 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
3140 CResult_GossipTimestampFilterDecodeErrorZ {
3141 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3142 result: Box::into_raw(Box::new(o)),
3148 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
3149 CResult_GossipTimestampFilterDecodeErrorZ {
3150 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3151 err: Box::into_raw(Box::new(e)),
3157 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
3158 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
3159 fn drop(&mut self) {
3161 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3162 let _ = unsafe { Box::from_raw(self.contents.result) };
3165 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3166 let _ = unsafe { Box::from_raw(self.contents.err) };
3171 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
3172 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
3173 let contents = if o.result_ok {
3174 let result = unsafe { o.contents.result };
3175 unsafe { o.contents.result = std::ptr::null_mut() };
3176 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
3178 let err = unsafe { o.contents.err };
3179 unsafe { o.contents.err = std::ptr::null_mut(); }
3180 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
3184 result_ok: o.result_ok,
3188 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
3189 fn clone(&self) -> Self {
3191 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3192 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
3195 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
3196 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3202 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
3204 pub struct CVec_PublicKeyZ {
3205 pub data: *mut crate::c_types::PublicKey,
3208 impl CVec_PublicKeyZ {
3209 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3210 if self.datalen == 0 { return Vec::new(); }
3211 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3212 self.data = std::ptr::null_mut();
3216 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3217 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3220 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3221 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3222 let datalen = v.len();
3223 let data = Box::into_raw(v.into_boxed_slice());
3224 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3228 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3229 impl Drop for CVec_PublicKeyZ {
3230 fn drop(&mut self) {
3231 if self.datalen == 0 { return; }
3232 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3236 pub struct CVec_u8Z {
3241 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3242 if self.datalen == 0 { return Vec::new(); }
3243 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3244 self.data = std::ptr::null_mut();
3248 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3249 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3252 impl From<Vec<u8>> for CVec_u8Z {
3253 fn from(v: Vec<u8>) -> Self {
3254 let datalen = v.len();
3255 let data = Box::into_raw(v.into_boxed_slice());
3256 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3260 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3261 impl Drop for CVec_u8Z {
3262 fn drop(&mut self) {
3263 if self.datalen == 0 { return; }
3264 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3267 impl Clone for CVec_u8Z {
3268 fn clone(&self) -> Self {
3269 let mut res = Vec::new();
3270 if self.datalen == 0 { return Self::from(res); }
3271 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3276 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
3277 pub result: *mut crate::c_types::derived::CVec_u8Z,
3278 pub err: *mut crate::ln::peer_handler::PeerHandleError,
3281 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
3282 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
3283 pub result_ok: bool,
3286 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
3287 CResult_CVec_u8ZPeerHandleErrorZ {
3288 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3289 result: Box::into_raw(Box::new(o)),
3295 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
3296 CResult_CVec_u8ZPeerHandleErrorZ {
3297 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3298 err: Box::into_raw(Box::new(e)),
3304 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
3305 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
3306 fn drop(&mut self) {
3308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3309 let _ = unsafe { Box::from_raw(self.contents.result) };
3312 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3313 let _ = unsafe { Box::from_raw(self.contents.err) };
3318 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
3319 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
3320 let contents = if o.result_ok {
3321 let result = unsafe { o.contents.result };
3322 unsafe { o.contents.result = std::ptr::null_mut() };
3323 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
3325 let err = unsafe { o.contents.err };
3326 unsafe { o.contents.err = std::ptr::null_mut(); }
3327 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
3331 result_ok: o.result_ok,
3335 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
3336 fn clone(&self) -> Self {
3338 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3339 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3342 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3343 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3349 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
3351 pub union CResult_NonePeerHandleErrorZPtr {
3352 /// Note that this value is always NULL, as there are no contents in the OK variant
3353 pub result: *mut std::ffi::c_void,
3354 pub err: *mut crate::ln::peer_handler::PeerHandleError,
3357 pub struct CResult_NonePeerHandleErrorZ {
3358 pub contents: CResult_NonePeerHandleErrorZPtr,
3359 pub result_ok: bool,
3362 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
3363 CResult_NonePeerHandleErrorZ {
3364 contents: CResult_NonePeerHandleErrorZPtr {
3365 result: std::ptr::null_mut(),
3371 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
3372 CResult_NonePeerHandleErrorZ {
3373 contents: CResult_NonePeerHandleErrorZPtr {
3374 err: Box::into_raw(Box::new(e)),
3380 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
3381 impl Drop for CResult_NonePeerHandleErrorZ {
3382 fn drop(&mut self) {
3385 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3386 let _ = unsafe { Box::from_raw(self.contents.err) };
3391 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
3392 fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
3393 let contents = if o.result_ok {
3394 let _ = unsafe { Box::from_raw(o.contents.result) };
3395 o.contents.result = std::ptr::null_mut();
3396 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
3398 let err = unsafe { o.contents.err };
3399 unsafe { o.contents.err = std::ptr::null_mut(); }
3400 CResult_NonePeerHandleErrorZPtr { err }
3404 result_ok: o.result_ok,
3408 impl Clone for CResult_NonePeerHandleErrorZ {
3409 fn clone(&self) -> Self {
3411 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
3412 result: std::ptr::null_mut()
3415 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
3416 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3422 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
3424 pub union CResult_boolPeerHandleErrorZPtr {
3425 pub result: *mut bool,
3426 pub err: *mut crate::ln::peer_handler::PeerHandleError,
3429 pub struct CResult_boolPeerHandleErrorZ {
3430 pub contents: CResult_boolPeerHandleErrorZPtr,
3431 pub result_ok: bool,
3434 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
3435 CResult_boolPeerHandleErrorZ {
3436 contents: CResult_boolPeerHandleErrorZPtr {
3437 result: Box::into_raw(Box::new(o)),
3443 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
3444 CResult_boolPeerHandleErrorZ {
3445 contents: CResult_boolPeerHandleErrorZPtr {
3446 err: Box::into_raw(Box::new(e)),
3452 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
3453 impl Drop for CResult_boolPeerHandleErrorZ {
3454 fn drop(&mut self) {
3456 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3457 let _ = unsafe { Box::from_raw(self.contents.result) };
3460 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3461 let _ = unsafe { Box::from_raw(self.contents.err) };
3466 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
3467 fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
3468 let contents = if o.result_ok {
3469 let result = unsafe { o.contents.result };
3470 unsafe { o.contents.result = std::ptr::null_mut() };
3471 CResult_boolPeerHandleErrorZPtr { result }
3473 let err = unsafe { o.contents.err };
3474 unsafe { o.contents.err = std::ptr::null_mut(); }
3475 CResult_boolPeerHandleErrorZPtr { err }
3479 result_ok: o.result_ok,
3483 impl Clone for CResult_boolPeerHandleErrorZ {
3484 fn clone(&self) -> Self {
3486 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
3487 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
3490 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
3491 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3497 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
3499 pub union CResult_SecretKeySecpErrorZPtr {
3500 pub result: *mut crate::c_types::SecretKey,
3501 pub err: *mut crate::c_types::Secp256k1Error,
3504 pub struct CResult_SecretKeySecpErrorZ {
3505 pub contents: CResult_SecretKeySecpErrorZPtr,
3506 pub result_ok: bool,
3509 pub extern "C" fn CResult_SecretKeySecpErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeySecpErrorZ {
3510 CResult_SecretKeySecpErrorZ {
3511 contents: CResult_SecretKeySecpErrorZPtr {
3512 result: Box::into_raw(Box::new(o)),
3518 pub extern "C" fn CResult_SecretKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeySecpErrorZ {
3519 CResult_SecretKeySecpErrorZ {
3520 contents: CResult_SecretKeySecpErrorZPtr {
3521 err: Box::into_raw(Box::new(e)),
3527 pub extern "C" fn CResult_SecretKeySecpErrorZ_free(_res: CResult_SecretKeySecpErrorZ) { }
3528 impl Drop for CResult_SecretKeySecpErrorZ {
3529 fn drop(&mut self) {
3531 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3532 let _ = unsafe { Box::from_raw(self.contents.result) };
3535 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3536 let _ = unsafe { Box::from_raw(self.contents.err) };
3541 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeySecpErrorZ {
3542 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
3543 let contents = if o.result_ok {
3544 let result = unsafe { o.contents.result };
3545 unsafe { o.contents.result = std::ptr::null_mut() };
3546 CResult_SecretKeySecpErrorZPtr { result }
3548 let err = unsafe { o.contents.err };
3549 unsafe { o.contents.err = std::ptr::null_mut(); }
3550 CResult_SecretKeySecpErrorZPtr { err }
3554 result_ok: o.result_ok,
3559 pub union CResult_PublicKeySecpErrorZPtr {
3560 pub result: *mut crate::c_types::PublicKey,
3561 pub err: *mut crate::c_types::Secp256k1Error,
3564 pub struct CResult_PublicKeySecpErrorZ {
3565 pub contents: CResult_PublicKeySecpErrorZPtr,
3566 pub result_ok: bool,
3569 pub extern "C" fn CResult_PublicKeySecpErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecpErrorZ {
3570 CResult_PublicKeySecpErrorZ {
3571 contents: CResult_PublicKeySecpErrorZPtr {
3572 result: Box::into_raw(Box::new(o)),
3578 pub extern "C" fn CResult_PublicKeySecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecpErrorZ {
3579 CResult_PublicKeySecpErrorZ {
3580 contents: CResult_PublicKeySecpErrorZPtr {
3581 err: Box::into_raw(Box::new(e)),
3587 pub extern "C" fn CResult_PublicKeySecpErrorZ_free(_res: CResult_PublicKeySecpErrorZ) { }
3588 impl Drop for CResult_PublicKeySecpErrorZ {
3589 fn drop(&mut self) {
3591 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3592 let _ = unsafe { Box::from_raw(self.contents.result) };
3595 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3596 let _ = unsafe { Box::from_raw(self.contents.err) };
3601 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecpErrorZ {
3602 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
3603 let contents = if o.result_ok {
3604 let result = unsafe { o.contents.result };
3605 unsafe { o.contents.result = std::ptr::null_mut() };
3606 CResult_PublicKeySecpErrorZPtr { result }
3608 let err = unsafe { o.contents.err };
3609 unsafe { o.contents.err = std::ptr::null_mut(); }
3610 CResult_PublicKeySecpErrorZPtr { err }
3614 result_ok: o.result_ok,
3619 pub union CResult_TxCreationKeysSecpErrorZPtr {
3620 pub result: *mut crate::ln::chan_utils::TxCreationKeys,
3621 pub err: *mut crate::c_types::Secp256k1Error,
3624 pub struct CResult_TxCreationKeysSecpErrorZ {
3625 pub contents: CResult_TxCreationKeysSecpErrorZPtr,
3626 pub result_ok: bool,
3629 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysSecpErrorZ {
3630 CResult_TxCreationKeysSecpErrorZ {
3631 contents: CResult_TxCreationKeysSecpErrorZPtr {
3632 result: Box::into_raw(Box::new(o)),
3638 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysSecpErrorZ {
3639 CResult_TxCreationKeysSecpErrorZ {
3640 contents: CResult_TxCreationKeysSecpErrorZPtr {
3641 err: Box::into_raw(Box::new(e)),
3647 pub extern "C" fn CResult_TxCreationKeysSecpErrorZ_free(_res: CResult_TxCreationKeysSecpErrorZ) { }
3648 impl Drop for CResult_TxCreationKeysSecpErrorZ {
3649 fn drop(&mut self) {
3651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3652 let _ = unsafe { Box::from_raw(self.contents.result) };
3655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3656 let _ = unsafe { Box::from_raw(self.contents.err) };
3661 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysSecpErrorZ {
3662 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
3663 let contents = if o.result_ok {
3664 let result = unsafe { o.contents.result };
3665 unsafe { o.contents.result = std::ptr::null_mut() };
3666 CResult_TxCreationKeysSecpErrorZPtr { result }
3668 let err = unsafe { o.contents.err };
3669 unsafe { o.contents.err = std::ptr::null_mut(); }
3670 CResult_TxCreationKeysSecpErrorZPtr { err }
3674 result_ok: o.result_ok,
3679 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
3680 pub result: *mut crate::ln::chan_utils::TrustedCommitmentTransaction,
3681 /// Note that this value is always NULL, as there are no contents in the Err variant
3682 pub err: *mut std::ffi::c_void,
3685 pub struct CResult_TrustedCommitmentTransactionNoneZ {
3686 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
3687 pub result_ok: bool,
3690 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
3691 CResult_TrustedCommitmentTransactionNoneZ {
3692 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
3693 result: Box::into_raw(Box::new(o)),
3699 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
3700 CResult_TrustedCommitmentTransactionNoneZ {
3701 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
3702 err: std::ptr::null_mut(),
3708 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
3709 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
3710 fn drop(&mut self) {
3712 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3713 let _ = unsafe { Box::from_raw(self.contents.result) };
3719 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
3720 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> Self {
3721 let contents = if o.result_ok {
3722 let result = unsafe { o.contents.result };
3723 unsafe { o.contents.result = std::ptr::null_mut() };
3724 CResult_TrustedCommitmentTransactionNoneZPtr { result }
3726 let _ = unsafe { Box::from_raw(o.contents.err) };
3727 o.contents.err = std::ptr::null_mut();
3728 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
3732 result_ok: o.result_ok,
3737 pub union CResult_CVec_SignatureZNoneZPtr {
3738 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
3739 /// Note that this value is always NULL, as there are no contents in the Err variant
3740 pub err: *mut std::ffi::c_void,
3743 pub struct CResult_CVec_SignatureZNoneZ {
3744 pub contents: CResult_CVec_SignatureZNoneZPtr,
3745 pub result_ok: bool,
3748 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
3749 CResult_CVec_SignatureZNoneZ {
3750 contents: CResult_CVec_SignatureZNoneZPtr {
3751 result: Box::into_raw(Box::new(o)),
3757 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
3758 CResult_CVec_SignatureZNoneZ {
3759 contents: CResult_CVec_SignatureZNoneZPtr {
3760 err: std::ptr::null_mut(),
3766 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
3767 impl Drop for CResult_CVec_SignatureZNoneZ {
3768 fn drop(&mut self) {
3770 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3771 let _ = unsafe { Box::from_raw(self.contents.result) };
3777 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>> for CResult_CVec_SignatureZNoneZ {
3778 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> Self {
3779 let contents = if o.result_ok {
3780 let result = unsafe { o.contents.result };
3781 unsafe { o.contents.result = std::ptr::null_mut() };
3782 CResult_CVec_SignatureZNoneZPtr { result }
3784 let _ = unsafe { Box::from_raw(o.contents.err) };
3785 o.contents.err = std::ptr::null_mut();
3786 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
3790 result_ok: o.result_ok,
3794 impl Clone for CResult_CVec_SignatureZNoneZ {
3795 fn clone(&self) -> Self {
3797 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
3798 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
3801 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
3802 err: std::ptr::null_mut()
3808 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
3810 pub struct CVec_RouteHopZ {
3811 pub data: *mut crate::routing::router::RouteHop,
3814 impl CVec_RouteHopZ {
3815 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
3816 if self.datalen == 0 { return Vec::new(); }
3817 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3818 self.data = std::ptr::null_mut();
3822 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
3823 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3826 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
3827 fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
3828 let datalen = v.len();
3829 let data = Box::into_raw(v.into_boxed_slice());
3830 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3834 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3835 impl Drop for CVec_RouteHopZ {
3836 fn drop(&mut self) {
3837 if self.datalen == 0 { return; }
3838 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3841 impl Clone for CVec_RouteHopZ {
3842 fn clone(&self) -> Self {
3843 let mut res = Vec::new();
3844 if self.datalen == 0 { return Self::from(res); }
3845 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3850 pub struct CVec_CVec_RouteHopZZ {
3851 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3854 impl CVec_CVec_RouteHopZZ {
3855 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3856 if self.datalen == 0 { return Vec::new(); }
3857 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3858 self.data = std::ptr::null_mut();
3862 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3863 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3866 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3867 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3868 let datalen = v.len();
3869 let data = Box::into_raw(v.into_boxed_slice());
3870 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3874 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3875 impl Drop for CVec_CVec_RouteHopZZ {
3876 fn drop(&mut self) {
3877 if self.datalen == 0 { return; }
3878 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3881 impl Clone for CVec_CVec_RouteHopZZ {
3882 fn clone(&self) -> Self {
3883 let mut res = Vec::new();
3884 if self.datalen == 0 { return Self::from(res); }
3885 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3890 pub union CResult_RouteDecodeErrorZPtr {
3891 pub result: *mut crate::routing::router::Route,
3892 pub err: *mut crate::ln::msgs::DecodeError,
3895 pub struct CResult_RouteDecodeErrorZ {
3896 pub contents: CResult_RouteDecodeErrorZPtr,
3897 pub result_ok: bool,
3900 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3901 CResult_RouteDecodeErrorZ {
3902 contents: CResult_RouteDecodeErrorZPtr {
3903 result: Box::into_raw(Box::new(o)),
3909 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3910 CResult_RouteDecodeErrorZ {
3911 contents: CResult_RouteDecodeErrorZPtr {
3912 err: Box::into_raw(Box::new(e)),
3918 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3919 impl Drop for CResult_RouteDecodeErrorZ {
3920 fn drop(&mut self) {
3922 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3923 let _ = unsafe { Box::from_raw(self.contents.result) };
3926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3927 let _ = unsafe { Box::from_raw(self.contents.err) };
3932 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3933 fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
3934 let contents = if o.result_ok {
3935 let result = unsafe { o.contents.result };
3936 unsafe { o.contents.result = std::ptr::null_mut() };
3937 CResult_RouteDecodeErrorZPtr { result }
3939 let err = unsafe { o.contents.err };
3940 unsafe { o.contents.err = std::ptr::null_mut(); }
3941 CResult_RouteDecodeErrorZPtr { err }
3945 result_ok: o.result_ok,
3949 impl Clone for CResult_RouteDecodeErrorZ {
3950 fn clone(&self) -> Self {
3952 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3953 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3956 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3957 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3963 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3965 pub struct CVec_RouteHintZ {
3966 pub data: *mut crate::routing::router::RouteHint,
3969 impl CVec_RouteHintZ {
3970 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
3971 if self.datalen == 0 { return Vec::new(); }
3972 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3973 self.data = std::ptr::null_mut();
3977 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
3978 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3981 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
3982 fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
3983 let datalen = v.len();
3984 let data = Box::into_raw(v.into_boxed_slice());
3985 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3989 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3990 impl Drop for CVec_RouteHintZ {
3991 fn drop(&mut self) {
3992 if self.datalen == 0 { return; }
3993 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3996 impl Clone for CVec_RouteHintZ {
3997 fn clone(&self) -> Self {
3998 let mut res = Vec::new();
3999 if self.datalen == 0 { return Self::from(res); }
4000 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4005 pub union CResult_RouteLightningErrorZPtr {
4006 pub result: *mut crate::routing::router::Route,
4007 pub err: *mut crate::ln::msgs::LightningError,
4010 pub struct CResult_RouteLightningErrorZ {
4011 pub contents: CResult_RouteLightningErrorZPtr,
4012 pub result_ok: bool,
4015 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
4016 CResult_RouteLightningErrorZ {
4017 contents: CResult_RouteLightningErrorZPtr {
4018 result: Box::into_raw(Box::new(o)),
4024 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
4025 CResult_RouteLightningErrorZ {
4026 contents: CResult_RouteLightningErrorZPtr {
4027 err: Box::into_raw(Box::new(e)),
4033 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
4034 impl Drop for CResult_RouteLightningErrorZ {
4035 fn drop(&mut self) {
4037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4038 let _ = unsafe { Box::from_raw(self.contents.result) };
4041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4042 let _ = unsafe { Box::from_raw(self.contents.err) };
4047 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
4048 fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
4049 let contents = if o.result_ok {
4050 let result = unsafe { o.contents.result };
4051 unsafe { o.contents.result = std::ptr::null_mut() };
4052 CResult_RouteLightningErrorZPtr { result }
4054 let err = unsafe { o.contents.err };
4055 unsafe { o.contents.err = std::ptr::null_mut(); }
4056 CResult_RouteLightningErrorZPtr { err }
4060 result_ok: o.result_ok,
4064 impl Clone for CResult_RouteLightningErrorZ {
4065 fn clone(&self) -> Self {
4067 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
4068 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4071 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
4072 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4078 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
4080 pub union CResult_RoutingFeesDecodeErrorZPtr {
4081 pub result: *mut crate::routing::network_graph::RoutingFees,
4082 pub err: *mut crate::ln::msgs::DecodeError,
4085 pub struct CResult_RoutingFeesDecodeErrorZ {
4086 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
4087 pub result_ok: bool,
4090 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
4091 CResult_RoutingFeesDecodeErrorZ {
4092 contents: CResult_RoutingFeesDecodeErrorZPtr {
4093 result: Box::into_raw(Box::new(o)),
4099 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
4100 CResult_RoutingFeesDecodeErrorZ {
4101 contents: CResult_RoutingFeesDecodeErrorZPtr {
4102 err: Box::into_raw(Box::new(e)),
4108 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
4109 impl Drop for CResult_RoutingFeesDecodeErrorZ {
4110 fn drop(&mut self) {
4112 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4113 let _ = unsafe { Box::from_raw(self.contents.result) };
4116 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4117 let _ = unsafe { Box::from_raw(self.contents.err) };
4122 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
4123 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
4124 let contents = if o.result_ok {
4125 let result = unsafe { o.contents.result };
4126 unsafe { o.contents.result = std::ptr::null_mut() };
4127 CResult_RoutingFeesDecodeErrorZPtr { result }
4129 let err = unsafe { o.contents.err };
4130 unsafe { o.contents.err = std::ptr::null_mut(); }
4131 CResult_RoutingFeesDecodeErrorZPtr { err }
4135 result_ok: o.result_ok,
4139 impl Clone for CResult_RoutingFeesDecodeErrorZ {
4140 fn clone(&self) -> Self {
4142 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
4143 result: Box::into_raw(Box::new(<crate::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
4146 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
4147 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4153 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
4155 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4156 pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
4157 pub err: *mut crate::ln::msgs::DecodeError,
4160 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
4161 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
4162 pub result_ok: bool,
4165 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4166 CResult_NodeAnnouncementInfoDecodeErrorZ {
4167 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4168 result: Box::into_raw(Box::new(o)),
4174 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4175 CResult_NodeAnnouncementInfoDecodeErrorZ {
4176 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4177 err: Box::into_raw(Box::new(e)),
4183 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
4184 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
4185 fn drop(&mut self) {
4187 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4188 let _ = unsafe { Box::from_raw(self.contents.result) };
4191 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4192 let _ = unsafe { Box::from_raw(self.contents.err) };
4197 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
4198 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
4199 let contents = if o.result_ok {
4200 let result = unsafe { o.contents.result };
4201 unsafe { o.contents.result = std::ptr::null_mut() };
4202 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
4204 let err = unsafe { o.contents.err };
4205 unsafe { o.contents.err = std::ptr::null_mut(); }
4206 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
4210 result_ok: o.result_ok,
4214 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
4215 fn clone(&self) -> Self {
4217 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4218 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
4221 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4222 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4228 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
4230 pub union CResult_NodeInfoDecodeErrorZPtr {
4231 pub result: *mut crate::routing::network_graph::NodeInfo,
4232 pub err: *mut crate::ln::msgs::DecodeError,
4235 pub struct CResult_NodeInfoDecodeErrorZ {
4236 pub contents: CResult_NodeInfoDecodeErrorZPtr,
4237 pub result_ok: bool,
4240 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
4241 CResult_NodeInfoDecodeErrorZ {
4242 contents: CResult_NodeInfoDecodeErrorZPtr {
4243 result: Box::into_raw(Box::new(o)),
4249 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
4250 CResult_NodeInfoDecodeErrorZ {
4251 contents: CResult_NodeInfoDecodeErrorZPtr {
4252 err: Box::into_raw(Box::new(e)),
4258 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
4259 impl Drop for CResult_NodeInfoDecodeErrorZ {
4260 fn drop(&mut self) {
4262 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4263 let _ = unsafe { Box::from_raw(self.contents.result) };
4266 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4267 let _ = unsafe { Box::from_raw(self.contents.err) };
4272 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
4273 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
4274 let contents = if o.result_ok {
4275 let result = unsafe { o.contents.result };
4276 unsafe { o.contents.result = std::ptr::null_mut() };
4277 CResult_NodeInfoDecodeErrorZPtr { result }
4279 let err = unsafe { o.contents.err };
4280 unsafe { o.contents.err = std::ptr::null_mut(); }
4281 CResult_NodeInfoDecodeErrorZPtr { err }
4285 result_ok: o.result_ok,
4289 impl Clone for CResult_NodeInfoDecodeErrorZ {
4290 fn clone(&self) -> Self {
4292 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
4293 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
4296 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
4297 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4303 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
4305 pub union CResult_NetworkGraphDecodeErrorZPtr {
4306 pub result: *mut crate::routing::network_graph::NetworkGraph,
4307 pub err: *mut crate::ln::msgs::DecodeError,
4310 pub struct CResult_NetworkGraphDecodeErrorZ {
4311 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
4312 pub result_ok: bool,
4315 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
4316 CResult_NetworkGraphDecodeErrorZ {
4317 contents: CResult_NetworkGraphDecodeErrorZPtr {
4318 result: Box::into_raw(Box::new(o)),
4324 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
4325 CResult_NetworkGraphDecodeErrorZ {
4326 contents: CResult_NetworkGraphDecodeErrorZPtr {
4327 err: Box::into_raw(Box::new(e)),
4333 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
4334 impl Drop for CResult_NetworkGraphDecodeErrorZ {
4335 fn drop(&mut self) {
4337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4338 let _ = unsafe { Box::from_raw(self.contents.result) };
4341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4342 let _ = unsafe { Box::from_raw(self.contents.err) };
4347 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
4348 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
4349 let contents = if o.result_ok {
4350 let result = unsafe { o.contents.result };
4351 unsafe { o.contents.result = std::ptr::null_mut() };
4352 CResult_NetworkGraphDecodeErrorZPtr { result }
4354 let err = unsafe { o.contents.err };
4355 unsafe { o.contents.err = std::ptr::null_mut(); }
4356 CResult_NetworkGraphDecodeErrorZPtr { err }
4360 result_ok: o.result_ok,