2 use alloc::str::FromStr;
3 use alloc::string::String;
5 use core::convert::Infallible;
6 use bitcoin::hashes::Hash;
8 #[cfg(feature="no-std")]
9 use alloc::{vec::Vec, boxed::Box};
13 /// An enum which can either contain a u64 or not
14 pub enum COption_u64Z {
15 /// When we're in this state, this COption_u64Z contains a u64
17 /// When we're in this state, this COption_u64Z contains nothing
21 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22 if let Self::None = self { false } else { true }
24 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
27 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
28 if let Self::Some(v) = self { v } else { unreachable!() }
32 /// Constructs a new COption_u64Z containing a u64
33 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
37 /// Constructs a new COption_u64Z containing nothing
38 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
42 /// Frees any resources associated with the u64, if we are in the Some state
43 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
45 /// Creates a new COption_u64Z which has the same data as `orig`
46 /// but with all dynamically-allocated buffers duplicated in new buffers.
47 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
49 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
50 /// This corresponds to std::vector in C++
51 pub struct CVec_BlindedPathZ {
52 /// The elements in the array.
53 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
54 pub data: *mut crate::lightning::blinded_path::BlindedPath,
55 /// The number of elements pointed to by `data`.
58 impl CVec_BlindedPathZ {
59 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
60 if self.datalen == 0 { return Vec::new(); }
61 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
62 self.data = core::ptr::null_mut();
66 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
67 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
70 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
71 fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
72 let datalen = v.len();
73 let data = Box::into_raw(v.into_boxed_slice());
74 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
78 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
79 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
80 impl Drop for CVec_BlindedPathZ {
82 if self.datalen == 0 { return; }
83 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
86 impl Clone for CVec_BlindedPathZ {
87 fn clone(&self) -> Self {
88 let mut res = Vec::new();
89 if self.datalen == 0 { return Self::from(res); }
90 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
95 /// The contents of CResult_RefundBolt12ParseErrorZ
96 pub union CResult_RefundBolt12ParseErrorZPtr {
97 /// A pointer to the contents in the success state.
98 /// Reading from this pointer when `result_ok` is not set is undefined.
99 pub result: *mut crate::lightning::offers::refund::Refund,
100 /// A pointer to the contents in the error state.
101 /// Reading from this pointer when `result_ok` is set is undefined.
102 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
105 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
106 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
108 pub struct CResult_RefundBolt12ParseErrorZ {
109 /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
110 /// `err` or `result` depending on the state of `result_ok`.
111 pub contents: CResult_RefundBolt12ParseErrorZPtr,
112 /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
116 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
117 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
118 CResult_RefundBolt12ParseErrorZ {
119 contents: CResult_RefundBolt12ParseErrorZPtr {
120 result: Box::into_raw(Box::new(o)),
126 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
127 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
128 CResult_RefundBolt12ParseErrorZ {
129 contents: CResult_RefundBolt12ParseErrorZPtr {
130 err: Box::into_raw(Box::new(e)),
135 /// Checks if the given object is currently in the success state
137 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
141 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
142 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
143 impl Drop for CResult_RefundBolt12ParseErrorZ {
146 if unsafe { !(self.contents.result as *mut ()).is_null() } {
147 let _ = unsafe { Box::from_raw(self.contents.result) };
150 if unsafe { !(self.contents.err as *mut ()).is_null() } {
151 let _ = unsafe { Box::from_raw(self.contents.err) };
156 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
157 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
158 let contents = if o.result_ok {
159 let result = unsafe { o.contents.result };
160 unsafe { o.contents.result = core::ptr::null_mut() };
161 CResult_RefundBolt12ParseErrorZPtr { result }
163 let err = unsafe { o.contents.err };
164 unsafe { o.contents.err = core::ptr::null_mut(); }
165 CResult_RefundBolt12ParseErrorZPtr { err }
169 result_ok: o.result_ok,
173 impl Clone for CResult_RefundBolt12ParseErrorZ {
174 fn clone(&self) -> Self {
176 Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
177 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
180 Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
181 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
187 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
188 /// but with all dynamically-allocated buffers duplicated in new buffers.
189 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
191 /// The contents of CResult_RetryDecodeErrorZ
192 pub union CResult_RetryDecodeErrorZPtr {
193 /// A pointer to the contents in the success state.
194 /// Reading from this pointer when `result_ok` is not set is undefined.
195 pub result: *mut crate::lightning::ln::outbound_payment::Retry,
196 /// A pointer to the contents in the error state.
197 /// Reading from this pointer when `result_ok` is set is undefined.
198 pub err: *mut crate::lightning::ln::msgs::DecodeError,
201 /// A CResult_RetryDecodeErrorZ represents the result of a fallible operation,
202 /// containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure.
203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
204 pub struct CResult_RetryDecodeErrorZ {
205 /// The contents of this CResult_RetryDecodeErrorZ, accessible via either
206 /// `err` or `result` depending on the state of `result_ok`.
207 pub contents: CResult_RetryDecodeErrorZPtr,
208 /// Whether this CResult_RetryDecodeErrorZ represents a success state.
212 /// Creates a new CResult_RetryDecodeErrorZ in the success state.
213 pub extern "C" fn CResult_RetryDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::Retry) -> CResult_RetryDecodeErrorZ {
214 CResult_RetryDecodeErrorZ {
215 contents: CResult_RetryDecodeErrorZPtr {
216 result: Box::into_raw(Box::new(o)),
222 /// Creates a new CResult_RetryDecodeErrorZ in the error state.
223 pub extern "C" fn CResult_RetryDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RetryDecodeErrorZ {
224 CResult_RetryDecodeErrorZ {
225 contents: CResult_RetryDecodeErrorZPtr {
226 err: Box::into_raw(Box::new(e)),
231 /// Checks if the given object is currently in the success state
233 pub extern "C" fn CResult_RetryDecodeErrorZ_is_ok(o: &CResult_RetryDecodeErrorZ) -> bool {
237 /// Frees any resources used by the CResult_RetryDecodeErrorZ.
238 pub extern "C" fn CResult_RetryDecodeErrorZ_free(_res: CResult_RetryDecodeErrorZ) { }
239 impl Drop for CResult_RetryDecodeErrorZ {
242 if unsafe { !(self.contents.result as *mut ()).is_null() } {
243 let _ = unsafe { Box::from_raw(self.contents.result) };
246 if unsafe { !(self.contents.err as *mut ()).is_null() } {
247 let _ = unsafe { Box::from_raw(self.contents.err) };
252 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>> for CResult_RetryDecodeErrorZ {
253 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>) -> Self {
254 let contents = if o.result_ok {
255 let result = unsafe { o.contents.result };
256 unsafe { o.contents.result = core::ptr::null_mut() };
257 CResult_RetryDecodeErrorZPtr { result }
259 let err = unsafe { o.contents.err };
260 unsafe { o.contents.err = core::ptr::null_mut(); }
261 CResult_RetryDecodeErrorZPtr { err }
265 result_ok: o.result_ok,
269 impl Clone for CResult_RetryDecodeErrorZ {
270 fn clone(&self) -> Self {
272 Self { result_ok: true, contents: CResult_RetryDecodeErrorZPtr {
273 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::Retry>::clone(unsafe { &*self.contents.result })))
276 Self { result_ok: false, contents: CResult_RetryDecodeErrorZPtr {
277 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
283 /// Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig`
284 /// but with all dynamically-allocated buffers duplicated in new buffers.
285 pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) }
287 /// The contents of CResult_NoneAPIErrorZ
288 pub union CResult_NoneAPIErrorZPtr {
289 /// Note that this value is always NULL, as there are no contents in the OK variant
290 pub result: *mut core::ffi::c_void,
291 /// A pointer to the contents in the error state.
292 /// Reading from this pointer when `result_ok` is set is undefined.
293 pub err: *mut crate::lightning::util::errors::APIError,
296 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
297 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
299 pub struct CResult_NoneAPIErrorZ {
300 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
301 /// `err` or `result` depending on the state of `result_ok`.
302 pub contents: CResult_NoneAPIErrorZPtr,
303 /// Whether this CResult_NoneAPIErrorZ represents a success state.
307 /// Creates a new CResult_NoneAPIErrorZ in the success state.
308 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
309 CResult_NoneAPIErrorZ {
310 contents: CResult_NoneAPIErrorZPtr {
311 result: core::ptr::null_mut(),
317 /// Creates a new CResult_NoneAPIErrorZ in the error state.
318 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
319 CResult_NoneAPIErrorZ {
320 contents: CResult_NoneAPIErrorZPtr {
321 err: Box::into_raw(Box::new(e)),
326 /// Checks if the given object is currently in the success state
328 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
332 /// Frees any resources used by the CResult_NoneAPIErrorZ.
333 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
334 impl Drop for CResult_NoneAPIErrorZ {
338 if unsafe { !(self.contents.err as *mut ()).is_null() } {
339 let _ = unsafe { Box::from_raw(self.contents.err) };
344 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
345 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
346 let contents = if o.result_ok {
347 let _ = unsafe { Box::from_raw(o.contents.result) };
348 o.contents.result = core::ptr::null_mut();
349 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
351 let err = unsafe { o.contents.err };
352 unsafe { o.contents.err = core::ptr::null_mut(); }
353 CResult_NoneAPIErrorZPtr { err }
357 result_ok: o.result_ok,
361 impl Clone for CResult_NoneAPIErrorZ {
362 fn clone(&self) -> Self {
364 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
365 result: core::ptr::null_mut()
368 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
369 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
375 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
376 /// but with all dynamically-allocated buffers duplicated in new buffers.
377 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
379 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
380 /// This corresponds to std::vector in C++
381 pub struct CVec_CResult_NoneAPIErrorZZ {
382 /// The elements in the array.
383 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
384 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
385 /// The number of elements pointed to by `data`.
388 impl CVec_CResult_NoneAPIErrorZZ {
389 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
390 if self.datalen == 0 { return Vec::new(); }
391 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
392 self.data = core::ptr::null_mut();
396 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
397 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
400 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
401 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
402 let datalen = v.len();
403 let data = Box::into_raw(v.into_boxed_slice());
404 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
408 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
409 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
410 impl Drop for CVec_CResult_NoneAPIErrorZZ {
412 if self.datalen == 0 { return; }
413 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
416 impl Clone for CVec_CResult_NoneAPIErrorZZ {
417 fn clone(&self) -> Self {
418 let mut res = Vec::new();
419 if self.datalen == 0 { return Self::from(res); }
420 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
425 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
426 /// This corresponds to std::vector in C++
427 pub struct CVec_APIErrorZ {
428 /// The elements in the array.
429 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
430 pub data: *mut crate::lightning::util::errors::APIError,
431 /// The number of elements pointed to by `data`.
434 impl CVec_APIErrorZ {
435 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
436 if self.datalen == 0 { return Vec::new(); }
437 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
438 self.data = core::ptr::null_mut();
442 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
443 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
446 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
447 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
448 let datalen = v.len();
449 let data = Box::into_raw(v.into_boxed_slice());
450 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
455 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
456 impl Drop for CVec_APIErrorZ {
458 if self.datalen == 0 { return; }
459 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
462 impl Clone for CVec_APIErrorZ {
463 fn clone(&self) -> Self {
464 let mut res = Vec::new();
465 if self.datalen == 0 { return Self::from(res); }
466 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
472 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
473 pub enum COption_ThirtyTwoBytesZ {
474 /// When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes
475 Some(crate::c_types::ThirtyTwoBytes),
476 /// When we're in this state, this COption_ThirtyTwoBytesZ contains nothing
479 impl COption_ThirtyTwoBytesZ {
480 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
481 if let Self::None = self { false } else { true }
483 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
486 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
487 if let Self::Some(v) = self { v } else { unreachable!() }
491 /// Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
492 pub extern "C" fn COption_ThirtyTwoBytesZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_ThirtyTwoBytesZ {
493 COption_ThirtyTwoBytesZ::Some(o)
496 /// Constructs a new COption_ThirtyTwoBytesZ containing nothing
497 pub extern "C" fn COption_ThirtyTwoBytesZ_none() -> COption_ThirtyTwoBytesZ {
498 COption_ThirtyTwoBytesZ::None
501 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
502 pub extern "C" fn COption_ThirtyTwoBytesZ_free(_res: COption_ThirtyTwoBytesZ) { }
504 /// Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
505 /// but with all dynamically-allocated buffers duplicated in new buffers.
506 pub extern "C" fn COption_ThirtyTwoBytesZ_clone(orig: &COption_ThirtyTwoBytesZ) -> COption_ThirtyTwoBytesZ { Clone::clone(&orig) }
508 /// A dynamically-allocated array of u8s of arbitrary size.
509 /// This corresponds to std::vector in C++
510 pub struct CVec_u8Z {
511 /// The elements in the array.
512 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
514 /// The number of elements pointed to by `data`.
518 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
519 if self.datalen == 0 { return Vec::new(); }
520 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
521 self.data = core::ptr::null_mut();
525 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
526 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
529 impl From<Vec<u8>> for CVec_u8Z {
530 fn from(v: Vec<u8>) -> Self {
531 let datalen = v.len();
532 let data = Box::into_raw(v.into_boxed_slice());
533 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
537 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
538 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
539 impl Drop for CVec_u8Z {
541 if self.datalen == 0 { return; }
542 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
545 impl Clone for CVec_u8Z {
546 fn clone(&self) -> Self {
547 let mut res = Vec::new();
548 if self.datalen == 0 { return Self::from(res); }
549 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
555 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
556 pub enum COption_CVec_u8ZZ {
557 /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
558 Some(crate::c_types::derived::CVec_u8Z),
559 /// When we're in this state, this COption_CVec_u8ZZ contains nothing
562 impl COption_CVec_u8ZZ {
563 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
564 if let Self::None = self { false } else { true }
566 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
569 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
570 if let Self::Some(v) = self { v } else { unreachable!() }
574 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
575 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
576 COption_CVec_u8ZZ::Some(o)
579 /// Constructs a new COption_CVec_u8ZZ containing nothing
580 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
581 COption_CVec_u8ZZ::None
584 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
585 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
587 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
588 /// but with all dynamically-allocated buffers duplicated in new buffers.
589 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
591 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
592 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
593 /// A pointer to the contents in the success state.
594 /// Reading from this pointer when `result_ok` is not set is undefined.
595 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
596 /// A pointer to the contents in the error state.
597 /// Reading from this pointer when `result_ok` is set is undefined.
598 pub err: *mut crate::lightning::ln::msgs::DecodeError,
601 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
602 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
604 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
605 /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
606 /// `err` or `result` depending on the state of `result_ok`.
607 pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
608 /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
612 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
613 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
614 CResult_RecipientOnionFieldsDecodeErrorZ {
615 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
616 result: Box::into_raw(Box::new(o)),
622 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
623 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
624 CResult_RecipientOnionFieldsDecodeErrorZ {
625 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
626 err: Box::into_raw(Box::new(e)),
631 /// Checks if the given object is currently in the success state
633 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
637 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
638 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
639 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
642 if unsafe { !(self.contents.result as *mut ()).is_null() } {
643 let _ = unsafe { Box::from_raw(self.contents.result) };
646 if unsafe { !(self.contents.err as *mut ()).is_null() } {
647 let _ = unsafe { Box::from_raw(self.contents.err) };
652 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
653 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
654 let contents = if o.result_ok {
655 let result = unsafe { o.contents.result };
656 unsafe { o.contents.result = core::ptr::null_mut() };
657 CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
659 let err = unsafe { o.contents.err };
660 unsafe { o.contents.err = core::ptr::null_mut(); }
661 CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
665 result_ok: o.result_ok,
669 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
670 fn clone(&self) -> Self {
672 Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
673 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
676 Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
677 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
683 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
684 /// but with all dynamically-allocated buffers duplicated in new buffers.
685 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
687 /// A tuple of 2 elements. See the individual fields for the types contained.
688 pub struct C2Tuple_u64CVec_u8ZZ {
689 /// The element at position 0
691 /// The element at position 1
692 pub b: crate::c_types::derived::CVec_u8Z,
694 impl From<(u64, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u64CVec_u8ZZ {
695 fn from (tup: (u64, crate::c_types::derived::CVec_u8Z)) -> Self {
702 impl C2Tuple_u64CVec_u8ZZ {
703 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::c_types::derived::CVec_u8Z) {
707 impl Clone for C2Tuple_u64CVec_u8ZZ {
708 fn clone(&self) -> Self {
710 a: Clone::clone(&self.a),
711 b: Clone::clone(&self.b),
716 /// Creates a new tuple which has the same data as `orig`
717 /// but with all dynamically-allocated buffers duplicated in new buffers.
718 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_clone(orig: &C2Tuple_u64CVec_u8ZZ) -> C2Tuple_u64CVec_u8ZZ { Clone::clone(&orig) }
719 /// Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements.
721 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_new(a: u64, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u64CVec_u8ZZ {
722 C2Tuple_u64CVec_u8ZZ { a, b, }
726 /// Frees any resources used by the C2Tuple_u64CVec_u8ZZ.
727 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_free(_res: C2Tuple_u64CVec_u8ZZ) { }
729 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size.
730 /// This corresponds to std::vector in C++
731 pub struct CVec_C2Tuple_u64CVec_u8ZZZ {
732 /// The elements in the array.
733 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
734 pub data: *mut crate::c_types::derived::C2Tuple_u64CVec_u8ZZ,
735 /// The number of elements pointed to by `data`.
738 impl CVec_C2Tuple_u64CVec_u8ZZZ {
739 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ> {
740 if self.datalen == 0 { return Vec::new(); }
741 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
742 self.data = core::ptr::null_mut();
746 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64CVec_u8ZZ] {
747 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
750 impl From<Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>> for CVec_C2Tuple_u64CVec_u8ZZZ {
751 fn from(v: Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>) -> Self {
752 let datalen = v.len();
753 let data = Box::into_raw(v.into_boxed_slice());
754 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
758 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
759 pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8ZZZ) { }
760 impl Drop for CVec_C2Tuple_u64CVec_u8ZZZ {
762 if self.datalen == 0 { return; }
763 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
766 impl Clone for CVec_C2Tuple_u64CVec_u8ZZZ {
767 fn clone(&self) -> Self {
768 let mut res = Vec::new();
769 if self.datalen == 0 { return Self::from(res); }
770 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
775 /// The contents of CResult_RecipientOnionFieldsNoneZ
776 pub union CResult_RecipientOnionFieldsNoneZPtr {
777 /// A pointer to the contents in the success state.
778 /// Reading from this pointer when `result_ok` is not set is undefined.
779 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
780 /// Note that this value is always NULL, as there are no contents in the Err variant
781 pub err: *mut core::ffi::c_void,
784 /// A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation,
785 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure.
786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
787 pub struct CResult_RecipientOnionFieldsNoneZ {
788 /// The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either
789 /// `err` or `result` depending on the state of `result_ok`.
790 pub contents: CResult_RecipientOnionFieldsNoneZPtr,
791 /// Whether this CResult_RecipientOnionFieldsNoneZ represents a success state.
795 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the success state.
796 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsNoneZ {
797 CResult_RecipientOnionFieldsNoneZ {
798 contents: CResult_RecipientOnionFieldsNoneZPtr {
799 result: Box::into_raw(Box::new(o)),
805 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the error state.
806 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_err() -> CResult_RecipientOnionFieldsNoneZ {
807 CResult_RecipientOnionFieldsNoneZ {
808 contents: CResult_RecipientOnionFieldsNoneZPtr {
809 err: core::ptr::null_mut(),
814 /// Checks if the given object is currently in the success state
816 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_is_ok(o: &CResult_RecipientOnionFieldsNoneZ) -> bool {
820 /// Frees any resources used by the CResult_RecipientOnionFieldsNoneZ.
821 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_free(_res: CResult_RecipientOnionFieldsNoneZ) { }
822 impl Drop for CResult_RecipientOnionFieldsNoneZ {
825 if unsafe { !(self.contents.result as *mut ()).is_null() } {
826 let _ = unsafe { Box::from_raw(self.contents.result) };
832 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>> for CResult_RecipientOnionFieldsNoneZ {
833 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>) -> Self {
834 let contents = if o.result_ok {
835 let result = unsafe { o.contents.result };
836 unsafe { o.contents.result = core::ptr::null_mut() };
837 CResult_RecipientOnionFieldsNoneZPtr { result }
839 let _ = unsafe { Box::from_raw(o.contents.err) };
840 o.contents.err = core::ptr::null_mut();
841 CResult_RecipientOnionFieldsNoneZPtr { err: core::ptr::null_mut() }
845 result_ok: o.result_ok,
849 impl Clone for CResult_RecipientOnionFieldsNoneZ {
850 fn clone(&self) -> Self {
852 Self { result_ok: true, contents: CResult_RecipientOnionFieldsNoneZPtr {
853 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
856 Self { result_ok: false, contents: CResult_RecipientOnionFieldsNoneZPtr {
857 err: core::ptr::null_mut()
863 /// Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig`
864 /// but with all dynamically-allocated buffers duplicated in new buffers.
865 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) }
867 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
868 /// This corresponds to std::vector in C++
869 pub struct CVec_ThirtyTwoBytesZ {
870 /// The elements in the array.
871 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
872 pub data: *mut crate::c_types::ThirtyTwoBytes,
873 /// The number of elements pointed to by `data`.
876 impl CVec_ThirtyTwoBytesZ {
877 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
878 if self.datalen == 0 { return Vec::new(); }
879 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
880 self.data = core::ptr::null_mut();
884 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
885 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
888 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
889 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
890 let datalen = v.len();
891 let data = Box::into_raw(v.into_boxed_slice());
892 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
896 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
897 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
898 impl Drop for CVec_ThirtyTwoBytesZ {
900 if self.datalen == 0 { return; }
901 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
904 impl Clone for CVec_ThirtyTwoBytesZ {
905 fn clone(&self) -> Self {
906 let mut res = Vec::new();
907 if self.datalen == 0 { return Self::from(res); }
908 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
914 /// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
915 pub enum COption_CVec_ThirtyTwoBytesZZ {
916 /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ
917 Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ),
918 /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing
921 impl COption_CVec_ThirtyTwoBytesZZ {
922 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
923 if let Self::None = self { false } else { true }
925 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
928 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
929 if let Self::Some(v) = self { v } else { unreachable!() }
933 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
934 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ {
935 COption_CVec_ThirtyTwoBytesZZ::Some(o)
938 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
939 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ {
940 COption_CVec_ThirtyTwoBytesZZ::None
943 /// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state
944 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { }
946 /// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
947 /// but with all dynamically-allocated buffers duplicated in new buffers.
948 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) }
950 /// The contents of CResult_ThirtyTwoBytesNoneZ
951 pub union CResult_ThirtyTwoBytesNoneZPtr {
952 /// A pointer to the contents in the success state.
953 /// Reading from this pointer when `result_ok` is not set is undefined.
954 pub result: *mut crate::c_types::ThirtyTwoBytes,
955 /// Note that this value is always NULL, as there are no contents in the Err variant
956 pub err: *mut core::ffi::c_void,
959 /// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation,
960 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
961 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
962 pub struct CResult_ThirtyTwoBytesNoneZ {
963 /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either
964 /// `err` or `result` depending on the state of `result_ok`.
965 pub contents: CResult_ThirtyTwoBytesNoneZPtr,
966 /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state.
970 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state.
971 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ {
972 CResult_ThirtyTwoBytesNoneZ {
973 contents: CResult_ThirtyTwoBytesNoneZPtr {
974 result: Box::into_raw(Box::new(o)),
980 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state.
981 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ {
982 CResult_ThirtyTwoBytesNoneZ {
983 contents: CResult_ThirtyTwoBytesNoneZPtr {
984 err: core::ptr::null_mut(),
989 /// Checks if the given object is currently in the success state
991 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool {
995 /// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ.
996 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { }
997 impl Drop for CResult_ThirtyTwoBytesNoneZ {
1000 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1001 let _ = unsafe { Box::from_raw(self.contents.result) };
1007 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_ThirtyTwoBytesNoneZ {
1008 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1009 let contents = if o.result_ok {
1010 let result = unsafe { o.contents.result };
1011 unsafe { o.contents.result = core::ptr::null_mut() };
1012 CResult_ThirtyTwoBytesNoneZPtr { result }
1014 let _ = unsafe { Box::from_raw(o.contents.err) };
1015 o.contents.err = core::ptr::null_mut();
1016 CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() }
1020 result_ok: o.result_ok,
1024 impl Clone for CResult_ThirtyTwoBytesNoneZ {
1025 fn clone(&self) -> Self {
1027 Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr {
1028 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1031 Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr {
1032 err: core::ptr::null_mut()
1038 /// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig`
1039 /// but with all dynamically-allocated buffers duplicated in new buffers.
1040 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) }
1042 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
1043 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
1044 /// A pointer to the contents in the success state.
1045 /// Reading from this pointer when `result_ok` is not set is undefined.
1046 pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
1047 /// A pointer to the contents in the error state.
1048 /// Reading from this pointer when `result_ok` is set is undefined.
1049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1052 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
1053 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
1054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1055 pub struct CResult_BlindedPayInfoDecodeErrorZ {
1056 /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
1057 /// `err` or `result` depending on the state of `result_ok`.
1058 pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
1059 /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
1060 pub result_ok: bool,
1063 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
1064 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
1065 CResult_BlindedPayInfoDecodeErrorZ {
1066 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1067 result: Box::into_raw(Box::new(o)),
1073 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
1074 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
1075 CResult_BlindedPayInfoDecodeErrorZ {
1076 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1077 err: Box::into_raw(Box::new(e)),
1082 /// Checks if the given object is currently in the success state
1084 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
1088 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
1089 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
1090 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
1091 fn drop(&mut self) {
1093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1094 let _ = unsafe { Box::from_raw(self.contents.result) };
1097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1098 let _ = unsafe { Box::from_raw(self.contents.err) };
1103 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
1104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
1105 let contents = if o.result_ok {
1106 let result = unsafe { o.contents.result };
1107 unsafe { o.contents.result = core::ptr::null_mut() };
1108 CResult_BlindedPayInfoDecodeErrorZPtr { result }
1110 let err = unsafe { o.contents.err };
1111 unsafe { o.contents.err = core::ptr::null_mut(); }
1112 CResult_BlindedPayInfoDecodeErrorZPtr { err }
1116 result_ok: o.result_ok,
1120 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
1121 fn clone(&self) -> Self {
1123 Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1124 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
1127 Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1134 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
1135 /// but with all dynamically-allocated buffers duplicated in new buffers.
1136 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
1138 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
1139 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1140 /// A pointer to the contents in the success state.
1141 /// Reading from this pointer when `result_ok` is not set is undefined.
1142 pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
1143 /// A pointer to the contents in the error state.
1144 /// Reading from this pointer when `result_ok` is set is undefined.
1145 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1148 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1149 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1151 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1152 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
1153 /// `err` or `result` depending on the state of `result_ok`.
1154 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
1155 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
1156 pub result_ok: bool,
1159 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
1160 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1161 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1162 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1163 result: Box::into_raw(Box::new(o)),
1169 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
1170 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1171 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1172 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1173 err: Box::into_raw(Box::new(e)),
1178 /// Checks if the given object is currently in the success state
1180 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
1184 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
1185 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
1186 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1187 fn drop(&mut self) {
1189 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1190 let _ = unsafe { Box::from_raw(self.contents.result) };
1193 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1194 let _ = unsafe { Box::from_raw(self.contents.err) };
1199 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1200 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1201 let contents = if o.result_ok {
1202 let result = unsafe { o.contents.result };
1203 unsafe { o.contents.result = core::ptr::null_mut() };
1204 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
1206 let err = unsafe { o.contents.err };
1207 unsafe { o.contents.err = core::ptr::null_mut(); }
1208 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
1212 result_ok: o.result_ok,
1216 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1217 fn clone(&self) -> Self {
1219 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1220 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1223 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1224 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1230 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1231 /// but with all dynamically-allocated buffers duplicated in new buffers.
1232 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1234 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
1235 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1236 /// A pointer to the contents in the success state.
1237 /// Reading from this pointer when `result_ok` is not set is undefined.
1238 pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
1239 /// A pointer to the contents in the error state.
1240 /// Reading from this pointer when `result_ok` is set is undefined.
1241 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1244 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1245 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1247 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1248 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
1249 /// `err` or `result` depending on the state of `result_ok`.
1250 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
1251 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
1252 pub result_ok: bool,
1255 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
1256 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1257 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1258 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1259 result: Box::into_raw(Box::new(o)),
1265 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
1266 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1267 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1268 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1269 err: Box::into_raw(Box::new(e)),
1274 /// Checks if the given object is currently in the success state
1276 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
1280 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
1281 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
1282 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1283 fn drop(&mut self) {
1285 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1286 let _ = unsafe { Box::from_raw(self.contents.result) };
1289 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1290 let _ = unsafe { Box::from_raw(self.contents.err) };
1295 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1296 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1297 let contents = if o.result_ok {
1298 let result = unsafe { o.contents.result };
1299 unsafe { o.contents.result = core::ptr::null_mut() };
1300 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
1302 let err = unsafe { o.contents.err };
1303 unsafe { o.contents.err = core::ptr::null_mut(); }
1304 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
1308 result_ok: o.result_ok,
1312 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1313 fn clone(&self) -> Self {
1315 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1316 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1319 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1320 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1326 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1327 /// but with all dynamically-allocated buffers duplicated in new buffers.
1328 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1330 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
1331 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1332 /// A pointer to the contents in the success state.
1333 /// Reading from this pointer when `result_ok` is not set is undefined.
1334 pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
1335 /// A pointer to the contents in the error state.
1336 /// Reading from this pointer when `result_ok` is set is undefined.
1337 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1340 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1341 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1343 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
1344 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
1345 /// `err` or `result` depending on the state of `result_ok`.
1346 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
1347 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
1348 pub result_ok: bool,
1351 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
1352 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1353 CResult_SpendableOutputDescriptorDecodeErrorZ {
1354 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1355 result: Box::into_raw(Box::new(o)),
1361 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
1362 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1363 CResult_SpendableOutputDescriptorDecodeErrorZ {
1364 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1365 err: Box::into_raw(Box::new(e)),
1370 /// Checks if the given object is currently in the success state
1372 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
1376 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
1377 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
1378 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
1379 fn drop(&mut self) {
1381 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1382 let _ = unsafe { Box::from_raw(self.contents.result) };
1385 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1386 let _ = unsafe { Box::from_raw(self.contents.err) };
1391 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
1392 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1393 let contents = if o.result_ok {
1394 let result = unsafe { o.contents.result };
1395 unsafe { o.contents.result = core::ptr::null_mut() };
1396 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
1398 let err = unsafe { o.contents.err };
1399 unsafe { o.contents.err = core::ptr::null_mut(); }
1400 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
1404 result_ok: o.result_ok,
1408 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
1409 fn clone(&self) -> Self {
1411 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1412 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1415 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1416 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1422 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1423 /// but with all dynamically-allocated buffers duplicated in new buffers.
1424 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1426 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1427 /// This corresponds to std::vector in C++
1428 pub struct CVec_SpendableOutputDescriptorZ {
1429 /// The elements in the array.
1430 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1431 pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1432 /// The number of elements pointed to by `data`.
1435 impl CVec_SpendableOutputDescriptorZ {
1436 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1437 if self.datalen == 0 { return Vec::new(); }
1438 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1439 self.data = core::ptr::null_mut();
1443 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1444 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1447 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1448 fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1449 let datalen = v.len();
1450 let data = Box::into_raw(v.into_boxed_slice());
1451 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1455 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1456 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
1457 impl Drop for CVec_SpendableOutputDescriptorZ {
1458 fn drop(&mut self) {
1459 if self.datalen == 0 { return; }
1460 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1463 impl Clone for CVec_SpendableOutputDescriptorZ {
1464 fn clone(&self) -> Self {
1465 let mut res = Vec::new();
1466 if self.datalen == 0 { return Self::from(res); }
1467 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1472 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
1473 /// This corresponds to std::vector in C++
1474 pub struct CVec_TxOutZ {
1475 /// The elements in the array.
1476 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1477 pub data: *mut crate::c_types::TxOut,
1478 /// The number of elements pointed to by `data`.
1482 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
1483 if self.datalen == 0 { return Vec::new(); }
1484 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1485 self.data = core::ptr::null_mut();
1489 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
1490 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1493 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
1494 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
1495 let datalen = v.len();
1496 let data = Box::into_raw(v.into_boxed_slice());
1497 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1501 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1502 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
1503 impl Drop for CVec_TxOutZ {
1504 fn drop(&mut self) {
1505 if self.datalen == 0 { return; }
1506 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1509 impl Clone for CVec_TxOutZ {
1510 fn clone(&self) -> Self {
1511 let mut res = Vec::new();
1512 if self.datalen == 0 { return Self::from(res); }
1513 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1519 /// An enum which can either contain a u32 or not
1520 pub enum COption_u32Z {
1521 /// When we're in this state, this COption_u32Z contains a u32
1523 /// When we're in this state, this COption_u32Z contains nothing
1527 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1528 if let Self::None = self { false } else { true }
1530 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1533 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
1534 if let Self::Some(v) = self { v } else { unreachable!() }
1538 /// Constructs a new COption_u32Z containing a u32
1539 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
1540 COption_u32Z::Some(o)
1543 /// Constructs a new COption_u32Z containing nothing
1544 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
1548 /// Frees any resources associated with the u32, if we are in the Some state
1549 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
1551 /// Creates a new COption_u32Z which has the same data as `orig`
1552 /// but with all dynamically-allocated buffers duplicated in new buffers.
1553 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
1555 /// A tuple of 2 elements. See the individual fields for the types contained.
1556 pub struct C2Tuple_CVec_u8Zu64Z {
1557 /// The element at position 0
1558 pub a: crate::c_types::derived::CVec_u8Z,
1559 /// The element at position 1
1562 impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z {
1563 fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self {
1570 impl C2Tuple_CVec_u8Zu64Z {
1571 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) {
1575 impl Clone for C2Tuple_CVec_u8Zu64Z {
1576 fn clone(&self) -> Self {
1578 a: Clone::clone(&self.a),
1579 b: Clone::clone(&self.b),
1584 /// Creates a new tuple which has the same data as `orig`
1585 /// but with all dynamically-allocated buffers duplicated in new buffers.
1586 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) }
1587 /// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements.
1589 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z {
1590 C2Tuple_CVec_u8Zu64Z { a, b, }
1594 /// Frees any resources used by the C2Tuple_CVec_u8Zu64Z.
1595 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { }
1597 /// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ
1598 pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
1599 /// A pointer to the contents in the success state.
1600 /// Reading from this pointer when `result_ok` is not set is undefined.
1601 pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8Zu64Z,
1602 /// Note that this value is always NULL, as there are no contents in the Err variant
1603 pub err: *mut core::ffi::c_void,
1606 /// A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation,
1607 /// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure.
1608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1609 pub struct CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1610 /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either
1611 /// `err` or `result` depending on the state of `result_ok`.
1612 pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr,
1613 /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state.
1614 pub result_ok: bool,
1617 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state.
1618 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1619 CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1620 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
1621 result: Box::into_raw(Box::new(o)),
1627 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state.
1628 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1629 CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1630 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
1631 err: core::ptr::null_mut(),
1636 /// Checks if the given object is currently in the success state
1638 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool {
1642 /// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ.
1643 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { }
1644 impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1645 fn drop(&mut self) {
1647 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1648 let _ = unsafe { Box::from_raw(self.contents.result) };
1654 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1655 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>) -> Self {
1656 let contents = if o.result_ok {
1657 let result = unsafe { o.contents.result };
1658 unsafe { o.contents.result = core::ptr::null_mut() };
1659 CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { result }
1661 let _ = unsafe { Box::from_raw(o.contents.err) };
1662 o.contents.err = core::ptr::null_mut();
1663 CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() }
1667 result_ok: o.result_ok,
1671 impl Clone for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
1672 fn clone(&self) -> Self {
1674 Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
1675 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z>::clone(unsafe { &*self.contents.result })))
1678 Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
1679 err: core::ptr::null_mut()
1685 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig`
1686 /// but with all dynamically-allocated buffers duplicated in new buffers.
1687 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { Clone::clone(&orig) }
1689 /// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
1690 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
1691 /// A pointer to the contents in the success state.
1692 /// Reading from this pointer when `result_ok` is not set is undefined.
1693 pub result: *mut crate::lightning::sign::ChannelDerivationParameters,
1694 /// A pointer to the contents in the error state.
1695 /// Reading from this pointer when `result_ok` is set is undefined.
1696 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1699 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
1700 /// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1702 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
1703 /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
1704 /// `err` or `result` depending on the state of `result_ok`.
1705 pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
1706 /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
1707 pub result_ok: bool,
1710 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
1711 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
1712 CResult_ChannelDerivationParametersDecodeErrorZ {
1713 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1714 result: Box::into_raw(Box::new(o)),
1720 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
1721 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
1722 CResult_ChannelDerivationParametersDecodeErrorZ {
1723 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1724 err: Box::into_raw(Box::new(e)),
1729 /// Checks if the given object is currently in the success state
1731 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
1735 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
1736 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
1737 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
1738 fn drop(&mut self) {
1740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1741 let _ = unsafe { Box::from_raw(self.contents.result) };
1744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1745 let _ = unsafe { Box::from_raw(self.contents.err) };
1750 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
1751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1752 let contents = if o.result_ok {
1753 let result = unsafe { o.contents.result };
1754 unsafe { o.contents.result = core::ptr::null_mut() };
1755 CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
1757 let err = unsafe { o.contents.err };
1758 unsafe { o.contents.err = core::ptr::null_mut(); }
1759 CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
1763 result_ok: o.result_ok,
1767 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
1768 fn clone(&self) -> Self {
1770 Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1771 result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
1774 Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1781 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
1782 /// but with all dynamically-allocated buffers duplicated in new buffers.
1783 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
1785 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
1786 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
1787 /// A pointer to the contents in the success state.
1788 /// Reading from this pointer when `result_ok` is not set is undefined.
1789 pub result: *mut crate::lightning::sign::HTLCDescriptor,
1790 /// A pointer to the contents in the error state.
1791 /// Reading from this pointer when `result_ok` is set is undefined.
1792 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1795 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
1796 /// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1798 pub struct CResult_HTLCDescriptorDecodeErrorZ {
1799 /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
1800 /// `err` or `result` depending on the state of `result_ok`.
1801 pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
1802 /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
1803 pub result_ok: bool,
1806 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
1807 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
1808 CResult_HTLCDescriptorDecodeErrorZ {
1809 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1810 result: Box::into_raw(Box::new(o)),
1816 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
1817 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
1818 CResult_HTLCDescriptorDecodeErrorZ {
1819 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1820 err: Box::into_raw(Box::new(e)),
1825 /// Checks if the given object is currently in the success state
1827 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
1831 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
1832 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
1833 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
1834 fn drop(&mut self) {
1836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1837 let _ = unsafe { Box::from_raw(self.contents.result) };
1840 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1841 let _ = unsafe { Box::from_raw(self.contents.err) };
1846 impl From<crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
1847 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1848 let contents = if o.result_ok {
1849 let result = unsafe { o.contents.result };
1850 unsafe { o.contents.result = core::ptr::null_mut() };
1851 CResult_HTLCDescriptorDecodeErrorZPtr { result }
1853 let err = unsafe { o.contents.err };
1854 unsafe { o.contents.err = core::ptr::null_mut(); }
1855 CResult_HTLCDescriptorDecodeErrorZPtr { err }
1859 result_ok: o.result_ok,
1863 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
1864 fn clone(&self) -> Self {
1866 Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1867 result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
1870 Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1871 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1877 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
1878 /// but with all dynamically-allocated buffers duplicated in new buffers.
1879 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
1881 /// The contents of CResult_NoneNoneZ
1882 pub union CResult_NoneNoneZPtr {
1883 /// Note that this value is always NULL, as there are no contents in the OK variant
1884 pub result: *mut core::ffi::c_void,
1885 /// Note that this value is always NULL, as there are no contents in the Err variant
1886 pub err: *mut core::ffi::c_void,
1889 /// A CResult_NoneNoneZ represents the result of a fallible operation,
1890 /// containing a () on success and a () on failure.
1891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1892 pub struct CResult_NoneNoneZ {
1893 /// The contents of this CResult_NoneNoneZ, accessible via either
1894 /// `err` or `result` depending on the state of `result_ok`.
1895 pub contents: CResult_NoneNoneZPtr,
1896 /// Whether this CResult_NoneNoneZ represents a success state.
1897 pub result_ok: bool,
1900 /// Creates a new CResult_NoneNoneZ in the success state.
1901 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
1903 contents: CResult_NoneNoneZPtr {
1904 result: core::ptr::null_mut(),
1910 /// Creates a new CResult_NoneNoneZ in the error state.
1911 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
1913 contents: CResult_NoneNoneZPtr {
1914 err: core::ptr::null_mut(),
1919 /// Checks if the given object is currently in the success state
1921 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
1925 /// Frees any resources used by the CResult_NoneNoneZ.
1926 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
1927 impl Drop for CResult_NoneNoneZ {
1928 fn drop(&mut self) {
1934 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
1935 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
1936 let contents = if o.result_ok {
1937 let _ = unsafe { Box::from_raw(o.contents.result) };
1938 o.contents.result = core::ptr::null_mut();
1939 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
1941 let _ = unsafe { Box::from_raw(o.contents.err) };
1942 o.contents.err = core::ptr::null_mut();
1943 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
1947 result_ok: o.result_ok,
1951 impl Clone for CResult_NoneNoneZ {
1952 fn clone(&self) -> Self {
1954 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
1955 result: core::ptr::null_mut()
1958 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
1959 err: core::ptr::null_mut()
1965 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
1966 /// but with all dynamically-allocated buffers duplicated in new buffers.
1967 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
1969 /// The contents of CResult_PublicKeyNoneZ
1970 pub union CResult_PublicKeyNoneZPtr {
1971 /// A pointer to the contents in the success state.
1972 /// Reading from this pointer when `result_ok` is not set is undefined.
1973 pub result: *mut crate::c_types::PublicKey,
1974 /// Note that this value is always NULL, as there are no contents in the Err variant
1975 pub err: *mut core::ffi::c_void,
1978 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
1979 /// containing a crate::c_types::PublicKey on success and a () on failure.
1980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1981 pub struct CResult_PublicKeyNoneZ {
1982 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
1983 /// `err` or `result` depending on the state of `result_ok`.
1984 pub contents: CResult_PublicKeyNoneZPtr,
1985 /// Whether this CResult_PublicKeyNoneZ represents a success state.
1986 pub result_ok: bool,
1989 /// Creates a new CResult_PublicKeyNoneZ in the success state.
1990 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
1991 CResult_PublicKeyNoneZ {
1992 contents: CResult_PublicKeyNoneZPtr {
1993 result: Box::into_raw(Box::new(o)),
1999 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2000 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2001 CResult_PublicKeyNoneZ {
2002 contents: CResult_PublicKeyNoneZPtr {
2003 err: core::ptr::null_mut(),
2008 /// Checks if the given object is currently in the success state
2010 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2014 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2015 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2016 impl Drop for CResult_PublicKeyNoneZ {
2017 fn drop(&mut self) {
2019 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2020 let _ = unsafe { Box::from_raw(self.contents.result) };
2026 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2027 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2028 let contents = if o.result_ok {
2029 let result = unsafe { o.contents.result };
2030 unsafe { o.contents.result = core::ptr::null_mut() };
2031 CResult_PublicKeyNoneZPtr { result }
2033 let _ = unsafe { Box::from_raw(o.contents.err) };
2034 o.contents.err = core::ptr::null_mut();
2035 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2039 result_ok: o.result_ok,
2043 impl Clone for CResult_PublicKeyNoneZ {
2044 fn clone(&self) -> Self {
2046 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2047 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2050 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2051 err: core::ptr::null_mut()
2057 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2058 /// but with all dynamically-allocated buffers duplicated in new buffers.
2059 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2062 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2063 pub enum COption_BigEndianScalarZ {
2064 /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2065 Some(crate::c_types::BigEndianScalar),
2066 /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2069 impl COption_BigEndianScalarZ {
2070 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2071 if let Self::None = self { false } else { true }
2073 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2076 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2077 if let Self::Some(v) = self { v } else { unreachable!() }
2081 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2082 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2083 COption_BigEndianScalarZ::Some(o)
2086 /// Constructs a new COption_BigEndianScalarZ containing nothing
2087 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2088 COption_BigEndianScalarZ::None
2091 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2092 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2094 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2095 /// but with all dynamically-allocated buffers duplicated in new buffers.
2096 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2098 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2099 /// This corresponds to std::vector in C++
2100 pub struct CVec_U5Z {
2101 /// The elements in the array.
2102 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2103 pub data: *mut crate::c_types::U5,
2104 /// The number of elements pointed to by `data`.
2108 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2109 if self.datalen == 0 { return Vec::new(); }
2110 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2111 self.data = core::ptr::null_mut();
2115 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2116 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2119 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2120 fn from(v: Vec<crate::c_types::U5>) -> Self {
2121 let datalen = v.len();
2122 let data = Box::into_raw(v.into_boxed_slice());
2123 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2127 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2128 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2129 impl Drop for CVec_U5Z {
2130 fn drop(&mut self) {
2131 if self.datalen == 0 { return; }
2132 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2135 impl Clone for CVec_U5Z {
2136 fn clone(&self) -> Self {
2137 let mut res = Vec::new();
2138 if self.datalen == 0 { return Self::from(res); }
2139 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2144 /// The contents of CResult_RecoverableSignatureNoneZ
2145 pub union CResult_RecoverableSignatureNoneZPtr {
2146 /// A pointer to the contents in the success state.
2147 /// Reading from this pointer when `result_ok` is not set is undefined.
2148 pub result: *mut crate::c_types::RecoverableSignature,
2149 /// Note that this value is always NULL, as there are no contents in the Err variant
2150 pub err: *mut core::ffi::c_void,
2153 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2154 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2156 pub struct CResult_RecoverableSignatureNoneZ {
2157 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2158 /// `err` or `result` depending on the state of `result_ok`.
2159 pub contents: CResult_RecoverableSignatureNoneZPtr,
2160 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2161 pub result_ok: bool,
2164 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2165 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2166 CResult_RecoverableSignatureNoneZ {
2167 contents: CResult_RecoverableSignatureNoneZPtr {
2168 result: Box::into_raw(Box::new(o)),
2174 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2175 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2176 CResult_RecoverableSignatureNoneZ {
2177 contents: CResult_RecoverableSignatureNoneZPtr {
2178 err: core::ptr::null_mut(),
2183 /// Checks if the given object is currently in the success state
2185 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2189 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2190 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2191 impl Drop for CResult_RecoverableSignatureNoneZ {
2192 fn drop(&mut self) {
2194 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2195 let _ = unsafe { Box::from_raw(self.contents.result) };
2201 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2202 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2203 let contents = if o.result_ok {
2204 let result = unsafe { o.contents.result };
2205 unsafe { o.contents.result = core::ptr::null_mut() };
2206 CResult_RecoverableSignatureNoneZPtr { result }
2208 let _ = unsafe { Box::from_raw(o.contents.err) };
2209 o.contents.err = core::ptr::null_mut();
2210 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2214 result_ok: o.result_ok,
2218 impl Clone for CResult_RecoverableSignatureNoneZ {
2219 fn clone(&self) -> Self {
2221 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2222 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2225 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2226 err: core::ptr::null_mut()
2232 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2233 /// but with all dynamically-allocated buffers duplicated in new buffers.
2234 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2236 /// The contents of CResult_SchnorrSignatureNoneZ
2237 pub union CResult_SchnorrSignatureNoneZPtr {
2238 /// A pointer to the contents in the success state.
2239 /// Reading from this pointer when `result_ok` is not set is undefined.
2240 pub result: *mut crate::c_types::SchnorrSignature,
2241 /// Note that this value is always NULL, as there are no contents in the Err variant
2242 pub err: *mut core::ffi::c_void,
2245 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
2246 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
2247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2248 pub struct CResult_SchnorrSignatureNoneZ {
2249 /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
2250 /// `err` or `result` depending on the state of `result_ok`.
2251 pub contents: CResult_SchnorrSignatureNoneZPtr,
2252 /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
2253 pub result_ok: bool,
2256 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
2257 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
2258 CResult_SchnorrSignatureNoneZ {
2259 contents: CResult_SchnorrSignatureNoneZPtr {
2260 result: Box::into_raw(Box::new(o)),
2266 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
2267 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
2268 CResult_SchnorrSignatureNoneZ {
2269 contents: CResult_SchnorrSignatureNoneZPtr {
2270 err: core::ptr::null_mut(),
2275 /// Checks if the given object is currently in the success state
2277 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
2281 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
2282 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
2283 impl Drop for CResult_SchnorrSignatureNoneZ {
2284 fn drop(&mut self) {
2286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2287 let _ = unsafe { Box::from_raw(self.contents.result) };
2293 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
2294 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
2295 let contents = if o.result_ok {
2296 let result = unsafe { o.contents.result };
2297 unsafe { o.contents.result = core::ptr::null_mut() };
2298 CResult_SchnorrSignatureNoneZPtr { result }
2300 let _ = unsafe { Box::from_raw(o.contents.err) };
2301 o.contents.err = core::ptr::null_mut();
2302 CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
2306 result_ok: o.result_ok,
2310 impl Clone for CResult_SchnorrSignatureNoneZ {
2311 fn clone(&self) -> Self {
2313 Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
2314 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
2317 Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
2318 err: core::ptr::null_mut()
2324 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
2325 /// but with all dynamically-allocated buffers duplicated in new buffers.
2326 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
2328 /// The contents of CResult_ECDSASignatureNoneZ
2329 pub union CResult_ECDSASignatureNoneZPtr {
2330 /// A pointer to the contents in the success state.
2331 /// Reading from this pointer when `result_ok` is not set is undefined.
2332 pub result: *mut crate::c_types::ECDSASignature,
2333 /// Note that this value is always NULL, as there are no contents in the Err variant
2334 pub err: *mut core::ffi::c_void,
2337 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2338 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2340 pub struct CResult_ECDSASignatureNoneZ {
2341 /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2342 /// `err` or `result` depending on the state of `result_ok`.
2343 pub contents: CResult_ECDSASignatureNoneZPtr,
2344 /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2345 pub result_ok: bool,
2348 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2349 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2350 CResult_ECDSASignatureNoneZ {
2351 contents: CResult_ECDSASignatureNoneZPtr {
2352 result: Box::into_raw(Box::new(o)),
2358 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2359 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2360 CResult_ECDSASignatureNoneZ {
2361 contents: CResult_ECDSASignatureNoneZPtr {
2362 err: core::ptr::null_mut(),
2367 /// Checks if the given object is currently in the success state
2369 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2373 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2374 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2375 impl Drop for CResult_ECDSASignatureNoneZ {
2376 fn drop(&mut self) {
2378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2379 let _ = unsafe { Box::from_raw(self.contents.result) };
2385 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2386 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2387 let contents = if o.result_ok {
2388 let result = unsafe { o.contents.result };
2389 unsafe { o.contents.result = core::ptr::null_mut() };
2390 CResult_ECDSASignatureNoneZPtr { result }
2392 let _ = unsafe { Box::from_raw(o.contents.err) };
2393 o.contents.err = core::ptr::null_mut();
2394 CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2398 result_ok: o.result_ok,
2402 impl Clone for CResult_ECDSASignatureNoneZ {
2403 fn clone(&self) -> Self {
2405 Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2406 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2409 Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2410 err: core::ptr::null_mut()
2416 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2417 /// but with all dynamically-allocated buffers duplicated in new buffers.
2418 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2420 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2421 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2422 /// A pointer to the contents in the success state.
2423 /// Reading from this pointer when `result_ok` is not set is undefined.
2424 pub result: *mut crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner,
2425 /// A pointer to the contents in the error state.
2426 /// Reading from this pointer when `result_ok` is set is undefined.
2427 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2430 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2431 /// containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2433 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2434 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2435 /// `err` or `result` depending on the state of `result_ok`.
2436 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2437 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2438 pub result_ok: bool,
2441 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2442 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2443 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2444 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2445 result: Box::into_raw(Box::new(o)),
2451 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2452 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2453 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2454 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2455 err: Box::into_raw(Box::new(e)),
2460 /// Checks if the given object is currently in the success state
2462 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2466 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2467 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2468 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2469 fn drop(&mut self) {
2471 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2472 let _ = unsafe { Box::from_raw(self.contents.result) };
2475 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2476 let _ = unsafe { Box::from_raw(self.contents.err) };
2481 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2482 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2483 let contents = if o.result_ok {
2484 let result = unsafe { o.contents.result };
2485 unsafe { o.contents.result = core::ptr::null_mut() };
2486 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2488 let err = unsafe { o.contents.err };
2489 unsafe { o.contents.err = core::ptr::null_mut(); }
2490 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2494 result_ok: o.result_ok,
2498 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2499 fn clone(&self) -> Self {
2501 Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2502 result: Box::into_raw(Box::new(<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
2505 Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2506 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2512 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
2513 /// but with all dynamically-allocated buffers duplicated in new buffers.
2514 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
2516 /// The contents of CResult_CVec_u8ZNoneZ
2517 pub union CResult_CVec_u8ZNoneZPtr {
2518 /// A pointer to the contents in the success state.
2519 /// Reading from this pointer when `result_ok` is not set is undefined.
2520 pub result: *mut crate::c_types::derived::CVec_u8Z,
2521 /// Note that this value is always NULL, as there are no contents in the Err variant
2522 pub err: *mut core::ffi::c_void,
2525 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
2526 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2528 pub struct CResult_CVec_u8ZNoneZ {
2529 /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
2530 /// `err` or `result` depending on the state of `result_ok`.
2531 pub contents: CResult_CVec_u8ZNoneZPtr,
2532 /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
2533 pub result_ok: bool,
2536 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
2537 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
2538 CResult_CVec_u8ZNoneZ {
2539 contents: CResult_CVec_u8ZNoneZPtr {
2540 result: Box::into_raw(Box::new(o)),
2546 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
2547 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
2548 CResult_CVec_u8ZNoneZ {
2549 contents: CResult_CVec_u8ZNoneZPtr {
2550 err: core::ptr::null_mut(),
2555 /// Checks if the given object is currently in the success state
2557 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
2561 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
2562 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
2563 impl Drop for CResult_CVec_u8ZNoneZ {
2564 fn drop(&mut self) {
2566 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2567 let _ = unsafe { Box::from_raw(self.contents.result) };
2573 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
2574 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2575 let contents = if o.result_ok {
2576 let result = unsafe { o.contents.result };
2577 unsafe { o.contents.result = core::ptr::null_mut() };
2578 CResult_CVec_u8ZNoneZPtr { result }
2580 let _ = unsafe { Box::from_raw(o.contents.err) };
2581 o.contents.err = core::ptr::null_mut();
2582 CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
2586 result_ok: o.result_ok,
2590 impl Clone for CResult_CVec_u8ZNoneZ {
2591 fn clone(&self) -> Self {
2593 Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
2594 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2597 Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
2598 err: core::ptr::null_mut()
2604 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
2605 /// but with all dynamically-allocated buffers duplicated in new buffers.
2606 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
2608 /// The contents of CResult_ShutdownScriptNoneZ
2609 pub union CResult_ShutdownScriptNoneZPtr {
2610 /// A pointer to the contents in the success state.
2611 /// Reading from this pointer when `result_ok` is not set is undefined.
2612 pub result: *mut crate::lightning::ln::script::ShutdownScript,
2613 /// Note that this value is always NULL, as there are no contents in the Err variant
2614 pub err: *mut core::ffi::c_void,
2617 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2618 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2619 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2620 pub struct CResult_ShutdownScriptNoneZ {
2621 /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2622 /// `err` or `result` depending on the state of `result_ok`.
2623 pub contents: CResult_ShutdownScriptNoneZPtr,
2624 /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2625 pub result_ok: bool,
2628 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2629 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2630 CResult_ShutdownScriptNoneZ {
2631 contents: CResult_ShutdownScriptNoneZPtr {
2632 result: Box::into_raw(Box::new(o)),
2638 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2639 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2640 CResult_ShutdownScriptNoneZ {
2641 contents: CResult_ShutdownScriptNoneZPtr {
2642 err: core::ptr::null_mut(),
2647 /// Checks if the given object is currently in the success state
2649 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2653 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2654 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2655 impl Drop for CResult_ShutdownScriptNoneZ {
2656 fn drop(&mut self) {
2658 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2659 let _ = unsafe { Box::from_raw(self.contents.result) };
2665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2666 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2667 let contents = if o.result_ok {
2668 let result = unsafe { o.contents.result };
2669 unsafe { o.contents.result = core::ptr::null_mut() };
2670 CResult_ShutdownScriptNoneZPtr { result }
2672 let _ = unsafe { Box::from_raw(o.contents.err) };
2673 o.contents.err = core::ptr::null_mut();
2674 CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2678 result_ok: o.result_ok,
2682 impl Clone for CResult_ShutdownScriptNoneZ {
2683 fn clone(&self) -> Self {
2685 Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2686 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2689 Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2690 err: core::ptr::null_mut()
2696 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2697 /// but with all dynamically-allocated buffers duplicated in new buffers.
2698 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2701 /// An enum which can either contain a u16 or not
2702 pub enum COption_u16Z {
2703 /// When we're in this state, this COption_u16Z contains a u16
2705 /// When we're in this state, this COption_u16Z contains nothing
2709 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2710 if let Self::None = self { false } else { true }
2712 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2715 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
2716 if let Self::Some(v) = self { v } else { unreachable!() }
2720 /// Constructs a new COption_u16Z containing a u16
2721 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
2722 COption_u16Z::Some(o)
2725 /// Constructs a new COption_u16Z containing nothing
2726 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
2730 /// Frees any resources associated with the u16, if we are in the Some state
2731 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
2733 /// Creates a new COption_u16Z which has the same data as `orig`
2734 /// but with all dynamically-allocated buffers duplicated in new buffers.
2735 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
2738 /// An enum which can either contain a bool or not
2739 pub enum COption_boolZ {
2740 /// When we're in this state, this COption_boolZ contains a bool
2742 /// When we're in this state, this COption_boolZ contains nothing
2745 impl COption_boolZ {
2746 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2747 if let Self::None = self { false } else { true }
2749 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2752 #[allow(unused)] pub(crate) fn take(mut self) -> bool {
2753 if let Self::Some(v) = self { v } else { unreachable!() }
2757 /// Constructs a new COption_boolZ containing a bool
2758 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
2759 COption_boolZ::Some(o)
2762 /// Constructs a new COption_boolZ containing nothing
2763 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
2767 /// Frees any resources associated with the bool, if we are in the Some state
2768 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
2770 /// Creates a new COption_boolZ which has the same data as `orig`
2771 /// but with all dynamically-allocated buffers duplicated in new buffers.
2772 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
2774 /// The contents of CResult_WitnessNoneZ
2775 pub union CResult_WitnessNoneZPtr {
2776 /// A pointer to the contents in the success state.
2777 /// Reading from this pointer when `result_ok` is not set is undefined.
2778 pub result: *mut crate::c_types::Witness,
2779 /// Note that this value is always NULL, as there are no contents in the Err variant
2780 pub err: *mut core::ffi::c_void,
2783 /// A CResult_WitnessNoneZ represents the result of a fallible operation,
2784 /// containing a crate::c_types::Witness on success and a () on failure.
2785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2786 pub struct CResult_WitnessNoneZ {
2787 /// The contents of this CResult_WitnessNoneZ, accessible via either
2788 /// `err` or `result` depending on the state of `result_ok`.
2789 pub contents: CResult_WitnessNoneZPtr,
2790 /// Whether this CResult_WitnessNoneZ represents a success state.
2791 pub result_ok: bool,
2794 /// Creates a new CResult_WitnessNoneZ in the success state.
2795 pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ {
2796 CResult_WitnessNoneZ {
2797 contents: CResult_WitnessNoneZPtr {
2798 result: Box::into_raw(Box::new(o)),
2804 /// Creates a new CResult_WitnessNoneZ in the error state.
2805 pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ {
2806 CResult_WitnessNoneZ {
2807 contents: CResult_WitnessNoneZPtr {
2808 err: core::ptr::null_mut(),
2813 /// Checks if the given object is currently in the success state
2815 pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> bool {
2819 /// Frees any resources used by the CResult_WitnessNoneZ.
2820 pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { }
2821 impl Drop for CResult_WitnessNoneZ {
2822 fn drop(&mut self) {
2824 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2825 let _ = unsafe { Box::from_raw(self.contents.result) };
2831 impl From<crate::c_types::CResultTempl<crate::c_types::Witness, ()>> for CResult_WitnessNoneZ {
2832 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Witness, ()>) -> Self {
2833 let contents = if o.result_ok {
2834 let result = unsafe { o.contents.result };
2835 unsafe { o.contents.result = core::ptr::null_mut() };
2836 CResult_WitnessNoneZPtr { result }
2838 let _ = unsafe { Box::from_raw(o.contents.err) };
2839 o.contents.err = core::ptr::null_mut();
2840 CResult_WitnessNoneZPtr { err: core::ptr::null_mut() }
2844 result_ok: o.result_ok,
2848 impl Clone for CResult_WitnessNoneZ {
2849 fn clone(&self) -> Self {
2851 Self { result_ok: true, contents: CResult_WitnessNoneZPtr {
2852 result: Box::into_raw(Box::new(<crate::c_types::Witness>::clone(unsafe { &*self.contents.result })))
2855 Self { result_ok: false, contents: CResult_WitnessNoneZPtr {
2856 err: core::ptr::null_mut()
2862 /// Creates a new CResult_WitnessNoneZ which has the same data as `orig`
2863 /// but with all dynamically-allocated buffers duplicated in new buffers.
2864 pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) }
2866 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
2867 /// This corresponds to std::vector in C++
2868 pub struct CVec_ECDSASignatureZ {
2869 /// The elements in the array.
2870 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2871 pub data: *mut crate::c_types::ECDSASignature,
2872 /// The number of elements pointed to by `data`.
2875 impl CVec_ECDSASignatureZ {
2876 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
2877 if self.datalen == 0 { return Vec::new(); }
2878 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2879 self.data = core::ptr::null_mut();
2883 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
2884 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2887 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
2888 fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
2889 let datalen = v.len();
2890 let data = Box::into_raw(v.into_boxed_slice());
2891 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2896 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
2897 impl Drop for CVec_ECDSASignatureZ {
2898 fn drop(&mut self) {
2899 if self.datalen == 0 { return; }
2900 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2903 impl Clone for CVec_ECDSASignatureZ {
2904 fn clone(&self) -> Self {
2905 let mut res = Vec::new();
2906 if self.datalen == 0 { return Self::from(res); }
2907 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2912 /// A tuple of 2 elements. See the individual fields for the types contained.
2913 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2914 /// The element at position 0
2915 pub a: crate::c_types::ECDSASignature,
2916 /// The element at position 1
2917 pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
2919 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2920 fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
2927 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2928 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
2932 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2933 fn clone(&self) -> Self {
2935 a: Clone::clone(&self.a),
2936 b: Clone::clone(&self.b),
2941 /// Creates a new tuple which has the same data as `orig`
2942 /// but with all dynamically-allocated buffers duplicated in new buffers.
2943 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
2944 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
2946 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2947 C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
2951 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
2952 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
2954 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
2955 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2956 /// A pointer to the contents in the success state.
2957 /// Reading from this pointer when `result_ok` is not set is undefined.
2958 pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
2959 /// Note that this value is always NULL, as there are no contents in the Err variant
2960 pub err: *mut core::ffi::c_void,
2963 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
2964 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
2965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2966 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2967 /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
2968 /// `err` or `result` depending on the state of `result_ok`.
2969 pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
2970 /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
2971 pub result_ok: bool,
2974 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
2975 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2976 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2977 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2978 result: Box::into_raw(Box::new(o)),
2984 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
2985 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2986 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2987 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2988 err: core::ptr::null_mut(),
2993 /// Checks if the given object is currently in the success state
2995 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
2999 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
3000 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
3001 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3002 fn drop(&mut self) {
3004 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3005 let _ = unsafe { Box::from_raw(self.contents.result) };
3011 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3012 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
3013 let contents = if o.result_ok {
3014 let result = unsafe { o.contents.result };
3015 unsafe { o.contents.result = core::ptr::null_mut() };
3016 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
3018 let _ = unsafe { Box::from_raw(o.contents.err) };
3019 o.contents.err = core::ptr::null_mut();
3020 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
3024 result_ok: o.result_ok,
3028 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3029 fn clone(&self) -> Self {
3031 Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3032 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
3035 Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3036 err: core::ptr::null_mut()
3042 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
3043 /// but with all dynamically-allocated buffers duplicated in new buffers.
3044 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
3046 /// The contents of CResult_InMemorySignerDecodeErrorZ
3047 pub union CResult_InMemorySignerDecodeErrorZPtr {
3048 /// A pointer to the contents in the success state.
3049 /// Reading from this pointer when `result_ok` is not set is undefined.
3050 pub result: *mut crate::lightning::sign::InMemorySigner,
3051 /// A pointer to the contents in the error state.
3052 /// Reading from this pointer when `result_ok` is set is undefined.
3053 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3056 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3057 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3058 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3059 pub struct CResult_InMemorySignerDecodeErrorZ {
3060 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3061 /// `err` or `result` depending on the state of `result_ok`.
3062 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3063 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3064 pub result_ok: bool,
3067 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3068 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3069 CResult_InMemorySignerDecodeErrorZ {
3070 contents: CResult_InMemorySignerDecodeErrorZPtr {
3071 result: Box::into_raw(Box::new(o)),
3077 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3078 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3079 CResult_InMemorySignerDecodeErrorZ {
3080 contents: CResult_InMemorySignerDecodeErrorZPtr {
3081 err: Box::into_raw(Box::new(e)),
3086 /// Checks if the given object is currently in the success state
3088 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3092 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3093 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3094 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3095 fn drop(&mut self) {
3097 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3098 let _ = unsafe { Box::from_raw(self.contents.result) };
3101 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3102 let _ = unsafe { Box::from_raw(self.contents.err) };
3107 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3108 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3109 let contents = if o.result_ok {
3110 let result = unsafe { o.contents.result };
3111 unsafe { o.contents.result = core::ptr::null_mut() };
3112 CResult_InMemorySignerDecodeErrorZPtr { result }
3114 let err = unsafe { o.contents.err };
3115 unsafe { o.contents.err = core::ptr::null_mut(); }
3116 CResult_InMemorySignerDecodeErrorZPtr { err }
3120 result_ok: o.result_ok,
3124 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3125 fn clone(&self) -> Self {
3127 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3128 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3131 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3132 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3138 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3139 /// but with all dynamically-allocated buffers duplicated in new buffers.
3140 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3142 /// The contents of CResult_TransactionNoneZ
3143 pub union CResult_TransactionNoneZPtr {
3144 /// A pointer to the contents in the success state.
3145 /// Reading from this pointer when `result_ok` is not set is undefined.
3146 pub result: *mut crate::c_types::Transaction,
3147 /// Note that this value is always NULL, as there are no contents in the Err variant
3148 pub err: *mut core::ffi::c_void,
3151 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3152 /// containing a crate::c_types::Transaction on success and a () on failure.
3153 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3154 pub struct CResult_TransactionNoneZ {
3155 /// The contents of this CResult_TransactionNoneZ, accessible via either
3156 /// `err` or `result` depending on the state of `result_ok`.
3157 pub contents: CResult_TransactionNoneZPtr,
3158 /// Whether this CResult_TransactionNoneZ represents a success state.
3159 pub result_ok: bool,
3162 /// Creates a new CResult_TransactionNoneZ in the success state.
3163 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3164 CResult_TransactionNoneZ {
3165 contents: CResult_TransactionNoneZPtr {
3166 result: Box::into_raw(Box::new(o)),
3172 /// Creates a new CResult_TransactionNoneZ in the error state.
3173 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3174 CResult_TransactionNoneZ {
3175 contents: CResult_TransactionNoneZPtr {
3176 err: core::ptr::null_mut(),
3181 /// Checks if the given object is currently in the success state
3183 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
3187 /// Frees any resources used by the CResult_TransactionNoneZ.
3188 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3189 impl Drop for CResult_TransactionNoneZ {
3190 fn drop(&mut self) {
3192 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3193 let _ = unsafe { Box::from_raw(self.contents.result) };
3199 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3200 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3201 let contents = if o.result_ok {
3202 let result = unsafe { o.contents.result };
3203 unsafe { o.contents.result = core::ptr::null_mut() };
3204 CResult_TransactionNoneZPtr { result }
3206 let _ = unsafe { Box::from_raw(o.contents.err) };
3207 o.contents.err = core::ptr::null_mut();
3208 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
3212 result_ok: o.result_ok,
3216 impl Clone for CResult_TransactionNoneZ {
3217 fn clone(&self) -> Self {
3219 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3220 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3223 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3224 err: core::ptr::null_mut()
3230 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3231 /// but with all dynamically-allocated buffers duplicated in new buffers.
3232 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
3234 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3235 pub enum COption_WriteableScoreZ {
3236 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3237 Some(crate::lightning::routing::scoring::WriteableScore),
3238 /// When we're in this state, this COption_WriteableScoreZ contains nothing
3241 impl COption_WriteableScoreZ {
3242 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243 if let Self::None = self { false } else { true }
3245 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3248 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3249 if let Self::Some(v) = self { v } else { unreachable!() }
3253 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3254 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3255 COption_WriteableScoreZ::Some(o)
3258 /// Constructs a new COption_WriteableScoreZ containing nothing
3259 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3260 COption_WriteableScoreZ::None
3263 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3264 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3266 /// The contents of CResult_NoneIOErrorZ
3267 pub union CResult_NoneIOErrorZPtr {
3268 /// Note that this value is always NULL, as there are no contents in the OK variant
3269 pub result: *mut core::ffi::c_void,
3270 /// A pointer to the contents in the error state.
3271 /// Reading from this pointer when `result_ok` is set is undefined.
3272 pub err: *mut crate::c_types::IOError,
3275 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3276 /// containing a () on success and a crate::c_types::IOError on failure.
3277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3278 pub struct CResult_NoneIOErrorZ {
3279 /// The contents of this CResult_NoneIOErrorZ, accessible via either
3280 /// `err` or `result` depending on the state of `result_ok`.
3281 pub contents: CResult_NoneIOErrorZPtr,
3282 /// Whether this CResult_NoneIOErrorZ represents a success state.
3283 pub result_ok: bool,
3286 /// Creates a new CResult_NoneIOErrorZ in the success state.
3287 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3288 CResult_NoneIOErrorZ {
3289 contents: CResult_NoneIOErrorZPtr {
3290 result: core::ptr::null_mut(),
3296 /// Creates a new CResult_NoneIOErrorZ in the error state.
3297 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3298 CResult_NoneIOErrorZ {
3299 contents: CResult_NoneIOErrorZPtr {
3300 err: Box::into_raw(Box::new(e)),
3305 /// Checks if the given object is currently in the success state
3307 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3311 /// Frees any resources used by the CResult_NoneIOErrorZ.
3312 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3313 impl Drop for CResult_NoneIOErrorZ {
3314 fn drop(&mut self) {
3317 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3318 let _ = unsafe { Box::from_raw(self.contents.err) };
3323 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3324 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3325 let contents = if o.result_ok {
3326 let _ = unsafe { Box::from_raw(o.contents.result) };
3327 o.contents.result = core::ptr::null_mut();
3328 CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3330 let err = unsafe { o.contents.err };
3331 unsafe { o.contents.err = core::ptr::null_mut(); }
3332 CResult_NoneIOErrorZPtr { err }
3336 result_ok: o.result_ok,
3340 impl Clone for CResult_NoneIOErrorZ {
3341 fn clone(&self) -> Self {
3343 Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3344 result: core::ptr::null_mut()
3347 Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3348 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3354 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3355 /// but with all dynamically-allocated buffers duplicated in new buffers.
3356 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3358 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3359 /// This corresponds to std::vector in C++
3360 pub struct CVec_ChannelDetailsZ {
3361 /// The elements in the array.
3362 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3363 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3364 /// The number of elements pointed to by `data`.
3367 impl CVec_ChannelDetailsZ {
3368 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3369 if self.datalen == 0 { return Vec::new(); }
3370 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3371 self.data = core::ptr::null_mut();
3375 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3376 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3379 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3380 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3381 let datalen = v.len();
3382 let data = Box::into_raw(v.into_boxed_slice());
3383 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3387 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3388 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3389 impl Drop for CVec_ChannelDetailsZ {
3390 fn drop(&mut self) {
3391 if self.datalen == 0 { return; }
3392 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3395 impl Clone for CVec_ChannelDetailsZ {
3396 fn clone(&self) -> Self {
3397 let mut res = Vec::new();
3398 if self.datalen == 0 { return Self::from(res); }
3399 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3404 /// The contents of CResult_RouteLightningErrorZ
3405 pub union CResult_RouteLightningErrorZPtr {
3406 /// A pointer to the contents in the success state.
3407 /// Reading from this pointer when `result_ok` is not set is undefined.
3408 pub result: *mut crate::lightning::routing::router::Route,
3409 /// A pointer to the contents in the error state.
3410 /// Reading from this pointer when `result_ok` is set is undefined.
3411 pub err: *mut crate::lightning::ln::msgs::LightningError,
3414 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3415 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3417 pub struct CResult_RouteLightningErrorZ {
3418 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3419 /// `err` or `result` depending on the state of `result_ok`.
3420 pub contents: CResult_RouteLightningErrorZPtr,
3421 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3422 pub result_ok: bool,
3425 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3426 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3427 CResult_RouteLightningErrorZ {
3428 contents: CResult_RouteLightningErrorZPtr {
3429 result: Box::into_raw(Box::new(o)),
3435 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3436 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3437 CResult_RouteLightningErrorZ {
3438 contents: CResult_RouteLightningErrorZPtr {
3439 err: Box::into_raw(Box::new(e)),
3444 /// Checks if the given object is currently in the success state
3446 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3450 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3451 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3452 impl Drop for CResult_RouteLightningErrorZ {
3453 fn drop(&mut self) {
3455 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3456 let _ = unsafe { Box::from_raw(self.contents.result) };
3459 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3460 let _ = unsafe { Box::from_raw(self.contents.err) };
3465 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3466 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3467 let contents = if o.result_ok {
3468 let result = unsafe { o.contents.result };
3469 unsafe { o.contents.result = core::ptr::null_mut() };
3470 CResult_RouteLightningErrorZPtr { result }
3472 let err = unsafe { o.contents.err };
3473 unsafe { o.contents.err = core::ptr::null_mut(); }
3474 CResult_RouteLightningErrorZPtr { err }
3478 result_ok: o.result_ok,
3482 impl Clone for CResult_RouteLightningErrorZ {
3483 fn clone(&self) -> Self {
3485 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3486 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3489 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3490 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3496 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3497 /// but with all dynamically-allocated buffers duplicated in new buffers.
3498 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3500 /// A tuple of 2 elements. See the individual fields for the types contained.
3501 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3502 /// The element at position 0
3503 pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3504 /// The element at position 1
3505 pub b: crate::lightning::blinded_path::BlindedPath,
3507 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3508 fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3515 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3516 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3520 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3521 fn clone(&self) -> Self {
3523 a: Clone::clone(&self.a),
3524 b: Clone::clone(&self.b),
3529 /// Creates a new tuple which has the same data as `orig`
3530 /// but with all dynamically-allocated buffers duplicated in new buffers.
3531 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3532 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3534 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3535 C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3539 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3540 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3542 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3543 /// This corresponds to std::vector in C++
3544 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3545 /// The elements in the array.
3546 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3547 pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3548 /// The number of elements pointed to by `data`.
3551 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3552 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3553 if self.datalen == 0 { return Vec::new(); }
3554 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3555 self.data = core::ptr::null_mut();
3559 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3560 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3563 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3564 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3565 let datalen = v.len();
3566 let data = Box::into_raw(v.into_boxed_slice());
3567 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3571 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3572 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3573 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3574 fn drop(&mut self) {
3575 if self.datalen == 0 { return; }
3576 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3579 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3580 fn clone(&self) -> Self {
3581 let mut res = Vec::new();
3582 if self.datalen == 0 { return Self::from(res); }
3583 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3588 /// The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ
3589 pub union CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3590 /// A pointer to the contents in the success state.
3591 /// Reading from this pointer when `result_ok` is not set is undefined.
3592 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ,
3593 /// Note that this value is always NULL, as there are no contents in the Err variant
3594 pub err: *mut core::ffi::c_void,
3597 /// A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation,
3598 /// containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure.
3599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3600 pub struct CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3601 /// The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either
3602 /// `err` or `result` depending on the state of `result_ok`.
3603 pub contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr,
3604 /// Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state.
3605 pub result_ok: bool,
3608 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state.
3609 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3610 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3611 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3612 result: Box::into_raw(Box::new(o)),
3618 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state.
3619 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3620 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3621 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3622 err: core::ptr::null_mut(),
3627 /// Checks if the given object is currently in the success state
3629 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> bool {
3633 /// Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.
3634 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) { }
3635 impl Drop for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3636 fn drop(&mut self) {
3638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3639 let _ = unsafe { Box::from_raw(self.contents.result) };
3645 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>> for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3646 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>) -> Self {
3647 let contents = if o.result_ok {
3648 let result = unsafe { o.contents.result };
3649 unsafe { o.contents.result = core::ptr::null_mut() };
3650 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { result }
3652 let _ = unsafe { Box::from_raw(o.contents.err) };
3653 o.contents.err = core::ptr::null_mut();
3654 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { err: core::ptr::null_mut() }
3658 result_ok: o.result_ok,
3662 impl Clone for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
3663 fn clone(&self) -> Self {
3665 Self { result_ok: true, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3666 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ>::clone(unsafe { &*self.contents.result })))
3669 Self { result_ok: false, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
3670 err: core::ptr::null_mut()
3676 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig`
3677 /// but with all dynamically-allocated buffers duplicated in new buffers.
3678 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ { Clone::clone(&orig) }
3680 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3681 /// This corresponds to std::vector in C++
3682 pub struct CVec_PublicKeyZ {
3683 /// The elements in the array.
3684 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3685 pub data: *mut crate::c_types::PublicKey,
3686 /// The number of elements pointed to by `data`.
3689 impl CVec_PublicKeyZ {
3690 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3691 if self.datalen == 0 { return Vec::new(); }
3692 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3693 self.data = core::ptr::null_mut();
3697 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3698 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3701 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3702 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3703 let datalen = v.len();
3704 let data = Box::into_raw(v.into_boxed_slice());
3705 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3709 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3710 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3711 impl Drop for CVec_PublicKeyZ {
3712 fn drop(&mut self) {
3713 if self.datalen == 0 { return; }
3714 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3717 impl Clone for CVec_PublicKeyZ {
3718 fn clone(&self) -> Self {
3719 let mut res = Vec::new();
3720 if self.datalen == 0 { return Self::from(res); }
3721 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3726 /// The contents of CResult_OnionMessagePathNoneZ
3727 pub union CResult_OnionMessagePathNoneZPtr {
3728 /// A pointer to the contents in the success state.
3729 /// Reading from this pointer when `result_ok` is not set is undefined.
3730 pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
3731 /// Note that this value is always NULL, as there are no contents in the Err variant
3732 pub err: *mut core::ffi::c_void,
3735 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
3736 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
3737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3738 pub struct CResult_OnionMessagePathNoneZ {
3739 /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
3740 /// `err` or `result` depending on the state of `result_ok`.
3741 pub contents: CResult_OnionMessagePathNoneZPtr,
3742 /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
3743 pub result_ok: bool,
3746 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
3747 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
3748 CResult_OnionMessagePathNoneZ {
3749 contents: CResult_OnionMessagePathNoneZPtr {
3750 result: Box::into_raw(Box::new(o)),
3756 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
3757 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
3758 CResult_OnionMessagePathNoneZ {
3759 contents: CResult_OnionMessagePathNoneZPtr {
3760 err: core::ptr::null_mut(),
3765 /// Checks if the given object is currently in the success state
3767 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
3771 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
3772 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
3773 impl Drop for CResult_OnionMessagePathNoneZ {
3774 fn drop(&mut self) {
3776 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3777 let _ = unsafe { Box::from_raw(self.contents.result) };
3783 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
3784 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
3785 let contents = if o.result_ok {
3786 let result = unsafe { o.contents.result };
3787 unsafe { o.contents.result = core::ptr::null_mut() };
3788 CResult_OnionMessagePathNoneZPtr { result }
3790 let _ = unsafe { Box::from_raw(o.contents.err) };
3791 o.contents.err = core::ptr::null_mut();
3792 CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
3796 result_ok: o.result_ok,
3800 impl Clone for CResult_OnionMessagePathNoneZ {
3801 fn clone(&self) -> Self {
3803 Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
3804 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
3807 Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
3808 err: core::ptr::null_mut()
3814 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
3815 /// but with all dynamically-allocated buffers duplicated in new buffers.
3816 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
3818 /// The contents of CResult_CVec_BlindedPathZNoneZ
3819 pub union CResult_CVec_BlindedPathZNoneZPtr {
3820 /// A pointer to the contents in the success state.
3821 /// Reading from this pointer when `result_ok` is not set is undefined.
3822 pub result: *mut crate::c_types::derived::CVec_BlindedPathZ,
3823 /// Note that this value is always NULL, as there are no contents in the Err variant
3824 pub err: *mut core::ffi::c_void,
3827 /// A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation,
3828 /// containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure.
3829 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3830 pub struct CResult_CVec_BlindedPathZNoneZ {
3831 /// The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either
3832 /// `err` or `result` depending on the state of `result_ok`.
3833 pub contents: CResult_CVec_BlindedPathZNoneZPtr,
3834 /// Whether this CResult_CVec_BlindedPathZNoneZ represents a success state.
3835 pub result_ok: bool,
3838 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the success state.
3839 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPathZ) -> CResult_CVec_BlindedPathZNoneZ {
3840 CResult_CVec_BlindedPathZNoneZ {
3841 contents: CResult_CVec_BlindedPathZNoneZPtr {
3842 result: Box::into_raw(Box::new(o)),
3848 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the error state.
3849 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_err() -> CResult_CVec_BlindedPathZNoneZ {
3850 CResult_CVec_BlindedPathZNoneZ {
3851 contents: CResult_CVec_BlindedPathZNoneZPtr {
3852 err: core::ptr::null_mut(),
3857 /// Checks if the given object is currently in the success state
3859 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPathZNoneZ) -> bool {
3863 /// Frees any resources used by the CResult_CVec_BlindedPathZNoneZ.
3864 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_free(_res: CResult_CVec_BlindedPathZNoneZ) { }
3865 impl Drop for CResult_CVec_BlindedPathZNoneZ {
3866 fn drop(&mut self) {
3868 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3869 let _ = unsafe { Box::from_raw(self.contents.result) };
3875 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>> for CResult_CVec_BlindedPathZNoneZ {
3876 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>) -> Self {
3877 let contents = if o.result_ok {
3878 let result = unsafe { o.contents.result };
3879 unsafe { o.contents.result = core::ptr::null_mut() };
3880 CResult_CVec_BlindedPathZNoneZPtr { result }
3882 let _ = unsafe { Box::from_raw(o.contents.err) };
3883 o.contents.err = core::ptr::null_mut();
3884 CResult_CVec_BlindedPathZNoneZPtr { err: core::ptr::null_mut() }
3888 result_ok: o.result_ok,
3892 impl Clone for CResult_CVec_BlindedPathZNoneZ {
3893 fn clone(&self) -> Self {
3895 Self { result_ok: true, contents: CResult_CVec_BlindedPathZNoneZPtr {
3896 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_BlindedPathZ>::clone(unsafe { &*self.contents.result })))
3899 Self { result_ok: false, contents: CResult_CVec_BlindedPathZNoneZPtr {
3900 err: core::ptr::null_mut()
3906 /// Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig`
3907 /// but with all dynamically-allocated buffers duplicated in new buffers.
3908 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_clone(orig: &CResult_CVec_BlindedPathZNoneZ) -> CResult_CVec_BlindedPathZNoneZ { Clone::clone(&orig) }
3910 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
3911 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
3912 /// A pointer to the contents in the success state.
3913 /// Reading from this pointer when `result_ok` is not set is undefined.
3914 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
3915 /// A pointer to the contents in the error state.
3916 /// Reading from this pointer when `result_ok` is set is undefined.
3917 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3920 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
3921 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
3922 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3923 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3924 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3925 /// `err` or `result` depending on the state of `result_ok`.
3926 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3927 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3928 pub result_ok: bool,
3931 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3932 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3933 CResult_InFlightHtlcsDecodeErrorZ {
3934 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3935 result: Box::into_raw(Box::new(o)),
3941 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3942 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3943 CResult_InFlightHtlcsDecodeErrorZ {
3944 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3945 err: Box::into_raw(Box::new(e)),
3950 /// Checks if the given object is currently in the success state
3952 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3956 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3957 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3958 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3959 fn drop(&mut self) {
3961 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3962 let _ = unsafe { Box::from_raw(self.contents.result) };
3965 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3966 let _ = unsafe { Box::from_raw(self.contents.err) };
3971 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3972 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3973 let contents = if o.result_ok {
3974 let result = unsafe { o.contents.result };
3975 unsafe { o.contents.result = core::ptr::null_mut() };
3976 CResult_InFlightHtlcsDecodeErrorZPtr { result }
3978 let err = unsafe { o.contents.err };
3979 unsafe { o.contents.err = core::ptr::null_mut(); }
3980 CResult_InFlightHtlcsDecodeErrorZPtr { err }
3984 result_ok: o.result_ok,
3988 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3989 fn clone(&self) -> Self {
3991 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3992 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3995 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3996 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4002 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
4003 /// but with all dynamically-allocated buffers duplicated in new buffers.
4004 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
4006 /// The contents of CResult_RouteHopDecodeErrorZ
4007 pub union CResult_RouteHopDecodeErrorZPtr {
4008 /// A pointer to the contents in the success state.
4009 /// Reading from this pointer when `result_ok` is not set is undefined.
4010 pub result: *mut crate::lightning::routing::router::RouteHop,
4011 /// A pointer to the contents in the error state.
4012 /// Reading from this pointer when `result_ok` is set is undefined.
4013 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4016 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
4017 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4018 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4019 pub struct CResult_RouteHopDecodeErrorZ {
4020 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
4021 /// `err` or `result` depending on the state of `result_ok`.
4022 pub contents: CResult_RouteHopDecodeErrorZPtr,
4023 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
4024 pub result_ok: bool,
4027 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
4028 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
4029 CResult_RouteHopDecodeErrorZ {
4030 contents: CResult_RouteHopDecodeErrorZPtr {
4031 result: Box::into_raw(Box::new(o)),
4037 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
4038 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
4039 CResult_RouteHopDecodeErrorZ {
4040 contents: CResult_RouteHopDecodeErrorZPtr {
4041 err: Box::into_raw(Box::new(e)),
4046 /// Checks if the given object is currently in the success state
4048 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
4052 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
4053 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
4054 impl Drop for CResult_RouteHopDecodeErrorZ {
4055 fn drop(&mut self) {
4057 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4058 let _ = unsafe { Box::from_raw(self.contents.result) };
4061 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4062 let _ = unsafe { Box::from_raw(self.contents.err) };
4067 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
4068 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4069 let contents = if o.result_ok {
4070 let result = unsafe { o.contents.result };
4071 unsafe { o.contents.result = core::ptr::null_mut() };
4072 CResult_RouteHopDecodeErrorZPtr { result }
4074 let err = unsafe { o.contents.err };
4075 unsafe { o.contents.err = core::ptr::null_mut(); }
4076 CResult_RouteHopDecodeErrorZPtr { err }
4080 result_ok: o.result_ok,
4084 impl Clone for CResult_RouteHopDecodeErrorZ {
4085 fn clone(&self) -> Self {
4087 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
4088 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
4091 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
4092 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4098 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
4099 /// but with all dynamically-allocated buffers duplicated in new buffers.
4100 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
4102 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
4103 /// This corresponds to std::vector in C++
4104 pub struct CVec_BlindedHopZ {
4105 /// The elements in the array.
4106 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4107 pub data: *mut crate::lightning::blinded_path::BlindedHop,
4108 /// The number of elements pointed to by `data`.
4111 impl CVec_BlindedHopZ {
4112 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
4113 if self.datalen == 0 { return Vec::new(); }
4114 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4115 self.data = core::ptr::null_mut();
4119 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
4120 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4123 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
4124 fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
4125 let datalen = v.len();
4126 let data = Box::into_raw(v.into_boxed_slice());
4127 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4132 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
4133 impl Drop for CVec_BlindedHopZ {
4134 fn drop(&mut self) {
4135 if self.datalen == 0 { return; }
4136 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4139 impl Clone for CVec_BlindedHopZ {
4140 fn clone(&self) -> Self {
4141 let mut res = Vec::new();
4142 if self.datalen == 0 { return Self::from(res); }
4143 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4148 /// The contents of CResult_BlindedTailDecodeErrorZ
4149 pub union CResult_BlindedTailDecodeErrorZPtr {
4150 /// A pointer to the contents in the success state.
4151 /// Reading from this pointer when `result_ok` is not set is undefined.
4152 pub result: *mut crate::lightning::routing::router::BlindedTail,
4153 /// A pointer to the contents in the error state.
4154 /// Reading from this pointer when `result_ok` is set is undefined.
4155 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4158 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
4159 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
4160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4161 pub struct CResult_BlindedTailDecodeErrorZ {
4162 /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
4163 /// `err` or `result` depending on the state of `result_ok`.
4164 pub contents: CResult_BlindedTailDecodeErrorZPtr,
4165 /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
4166 pub result_ok: bool,
4169 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
4170 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
4171 CResult_BlindedTailDecodeErrorZ {
4172 contents: CResult_BlindedTailDecodeErrorZPtr {
4173 result: Box::into_raw(Box::new(o)),
4179 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
4180 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
4181 CResult_BlindedTailDecodeErrorZ {
4182 contents: CResult_BlindedTailDecodeErrorZPtr {
4183 err: Box::into_raw(Box::new(e)),
4188 /// Checks if the given object is currently in the success state
4190 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
4194 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
4195 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
4196 impl Drop for CResult_BlindedTailDecodeErrorZ {
4197 fn drop(&mut self) {
4199 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4200 let _ = unsafe { Box::from_raw(self.contents.result) };
4203 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4204 let _ = unsafe { Box::from_raw(self.contents.err) };
4209 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
4210 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
4211 let contents = if o.result_ok {
4212 let result = unsafe { o.contents.result };
4213 unsafe { o.contents.result = core::ptr::null_mut() };
4214 CResult_BlindedTailDecodeErrorZPtr { result }
4216 let err = unsafe { o.contents.err };
4217 unsafe { o.contents.err = core::ptr::null_mut(); }
4218 CResult_BlindedTailDecodeErrorZPtr { err }
4222 result_ok: o.result_ok,
4226 impl Clone for CResult_BlindedTailDecodeErrorZ {
4227 fn clone(&self) -> Self {
4229 Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
4230 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
4233 Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
4234 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4240 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
4241 /// but with all dynamically-allocated buffers duplicated in new buffers.
4242 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
4244 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
4245 /// This corresponds to std::vector in C++
4246 pub struct CVec_RouteHopZ {
4247 /// The elements in the array.
4248 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4249 pub data: *mut crate::lightning::routing::router::RouteHop,
4250 /// The number of elements pointed to by `data`.
4253 impl CVec_RouteHopZ {
4254 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
4255 if self.datalen == 0 { return Vec::new(); }
4256 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4257 self.data = core::ptr::null_mut();
4261 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
4262 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4265 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
4266 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
4267 let datalen = v.len();
4268 let data = Box::into_raw(v.into_boxed_slice());
4269 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4273 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4274 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4275 impl Drop for CVec_RouteHopZ {
4276 fn drop(&mut self) {
4277 if self.datalen == 0 { return; }
4278 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4281 impl Clone for CVec_RouteHopZ {
4282 fn clone(&self) -> Self {
4283 let mut res = Vec::new();
4284 if self.datalen == 0 { return Self::from(res); }
4285 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4290 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
4291 /// This corresponds to std::vector in C++
4292 pub struct CVec_PathZ {
4293 /// The elements in the array.
4294 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4295 pub data: *mut crate::lightning::routing::router::Path,
4296 /// The number of elements pointed to by `data`.
4300 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
4301 if self.datalen == 0 { return Vec::new(); }
4302 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4303 self.data = core::ptr::null_mut();
4307 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
4308 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4311 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
4312 fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
4313 let datalen = v.len();
4314 let data = Box::into_raw(v.into_boxed_slice());
4315 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4319 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4320 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
4321 impl Drop for CVec_PathZ {
4322 fn drop(&mut self) {
4323 if self.datalen == 0 { return; }
4324 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4327 impl Clone for CVec_PathZ {
4328 fn clone(&self) -> Self {
4329 let mut res = Vec::new();
4330 if self.datalen == 0 { return Self::from(res); }
4331 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4336 /// The contents of CResult_RouteDecodeErrorZ
4337 pub union CResult_RouteDecodeErrorZPtr {
4338 /// A pointer to the contents in the success state.
4339 /// Reading from this pointer when `result_ok` is not set is undefined.
4340 pub result: *mut crate::lightning::routing::router::Route,
4341 /// A pointer to the contents in the error state.
4342 /// Reading from this pointer when `result_ok` is set is undefined.
4343 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4346 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
4347 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
4348 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4349 pub struct CResult_RouteDecodeErrorZ {
4350 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
4351 /// `err` or `result` depending on the state of `result_ok`.
4352 pub contents: CResult_RouteDecodeErrorZPtr,
4353 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
4354 pub result_ok: bool,
4357 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
4358 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4359 CResult_RouteDecodeErrorZ {
4360 contents: CResult_RouteDecodeErrorZPtr {
4361 result: Box::into_raw(Box::new(o)),
4367 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4368 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4369 CResult_RouteDecodeErrorZ {
4370 contents: CResult_RouteDecodeErrorZPtr {
4371 err: Box::into_raw(Box::new(e)),
4376 /// Checks if the given object is currently in the success state
4378 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4382 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4383 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4384 impl Drop for CResult_RouteDecodeErrorZ {
4385 fn drop(&mut self) {
4387 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4388 let _ = unsafe { Box::from_raw(self.contents.result) };
4391 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4392 let _ = unsafe { Box::from_raw(self.contents.err) };
4397 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4398 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4399 let contents = if o.result_ok {
4400 let result = unsafe { o.contents.result };
4401 unsafe { o.contents.result = core::ptr::null_mut() };
4402 CResult_RouteDecodeErrorZPtr { result }
4404 let err = unsafe { o.contents.err };
4405 unsafe { o.contents.err = core::ptr::null_mut(); }
4406 CResult_RouteDecodeErrorZPtr { err }
4410 result_ok: o.result_ok,
4414 impl Clone for CResult_RouteDecodeErrorZ {
4415 fn clone(&self) -> Self {
4417 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4418 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4421 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4422 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4428 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4429 /// but with all dynamically-allocated buffers duplicated in new buffers.
4430 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4432 /// The contents of CResult_RouteParametersDecodeErrorZ
4433 pub union CResult_RouteParametersDecodeErrorZPtr {
4434 /// A pointer to the contents in the success state.
4435 /// Reading from this pointer when `result_ok` is not set is undefined.
4436 pub result: *mut crate::lightning::routing::router::RouteParameters,
4437 /// A pointer to the contents in the error state.
4438 /// Reading from this pointer when `result_ok` is set is undefined.
4439 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4442 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4443 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4445 pub struct CResult_RouteParametersDecodeErrorZ {
4446 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4447 /// `err` or `result` depending on the state of `result_ok`.
4448 pub contents: CResult_RouteParametersDecodeErrorZPtr,
4449 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4450 pub result_ok: bool,
4453 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4454 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4455 CResult_RouteParametersDecodeErrorZ {
4456 contents: CResult_RouteParametersDecodeErrorZPtr {
4457 result: Box::into_raw(Box::new(o)),
4463 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4464 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4465 CResult_RouteParametersDecodeErrorZ {
4466 contents: CResult_RouteParametersDecodeErrorZPtr {
4467 err: Box::into_raw(Box::new(e)),
4472 /// Checks if the given object is currently in the success state
4474 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4478 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4479 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4480 impl Drop for CResult_RouteParametersDecodeErrorZ {
4481 fn drop(&mut self) {
4483 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4484 let _ = unsafe { Box::from_raw(self.contents.result) };
4487 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4488 let _ = unsafe { Box::from_raw(self.contents.err) };
4493 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4494 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4495 let contents = if o.result_ok {
4496 let result = unsafe { o.contents.result };
4497 unsafe { o.contents.result = core::ptr::null_mut() };
4498 CResult_RouteParametersDecodeErrorZPtr { result }
4500 let err = unsafe { o.contents.err };
4501 unsafe { o.contents.err = core::ptr::null_mut(); }
4502 CResult_RouteParametersDecodeErrorZPtr { err }
4506 result_ok: o.result_ok,
4510 impl Clone for CResult_RouteParametersDecodeErrorZ {
4511 fn clone(&self) -> Self {
4513 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4514 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4517 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4518 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4524 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4525 /// but with all dynamically-allocated buffers duplicated in new buffers.
4526 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4528 /// A dynamically-allocated array of u64s of arbitrary size.
4529 /// This corresponds to std::vector in C++
4530 pub struct CVec_u64Z {
4531 /// The elements in the array.
4532 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4534 /// The number of elements pointed to by `data`.
4538 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4539 if self.datalen == 0 { return Vec::new(); }
4540 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4541 self.data = core::ptr::null_mut();
4545 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4546 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4549 impl From<Vec<u64>> for CVec_u64Z {
4550 fn from(v: Vec<u64>) -> Self {
4551 let datalen = v.len();
4552 let data = Box::into_raw(v.into_boxed_slice());
4553 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4557 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4558 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4559 impl Drop for CVec_u64Z {
4560 fn drop(&mut self) {
4561 if self.datalen == 0 { return; }
4562 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4565 impl Clone for CVec_u64Z {
4566 fn clone(&self) -> Self {
4567 let mut res = Vec::new();
4568 if self.datalen == 0 { return Self::from(res); }
4569 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4574 /// The contents of CResult_PaymentParametersDecodeErrorZ
4575 pub union CResult_PaymentParametersDecodeErrorZPtr {
4576 /// A pointer to the contents in the success state.
4577 /// Reading from this pointer when `result_ok` is not set is undefined.
4578 pub result: *mut crate::lightning::routing::router::PaymentParameters,
4579 /// A pointer to the contents in the error state.
4580 /// Reading from this pointer when `result_ok` is set is undefined.
4581 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4584 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
4585 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4587 pub struct CResult_PaymentParametersDecodeErrorZ {
4588 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
4589 /// `err` or `result` depending on the state of `result_ok`.
4590 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
4591 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
4592 pub result_ok: bool,
4595 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
4596 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
4597 CResult_PaymentParametersDecodeErrorZ {
4598 contents: CResult_PaymentParametersDecodeErrorZPtr {
4599 result: Box::into_raw(Box::new(o)),
4605 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
4606 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
4607 CResult_PaymentParametersDecodeErrorZ {
4608 contents: CResult_PaymentParametersDecodeErrorZPtr {
4609 err: Box::into_raw(Box::new(e)),
4614 /// Checks if the given object is currently in the success state
4616 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
4620 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
4621 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
4622 impl Drop for CResult_PaymentParametersDecodeErrorZ {
4623 fn drop(&mut self) {
4625 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4626 let _ = unsafe { Box::from_raw(self.contents.result) };
4629 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4630 let _ = unsafe { Box::from_raw(self.contents.err) };
4635 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
4636 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4637 let contents = if o.result_ok {
4638 let result = unsafe { o.contents.result };
4639 unsafe { o.contents.result = core::ptr::null_mut() };
4640 CResult_PaymentParametersDecodeErrorZPtr { result }
4642 let err = unsafe { o.contents.err };
4643 unsafe { o.contents.err = core::ptr::null_mut(); }
4644 CResult_PaymentParametersDecodeErrorZPtr { err }
4648 result_ok: o.result_ok,
4652 impl Clone for CResult_PaymentParametersDecodeErrorZ {
4653 fn clone(&self) -> Self {
4655 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
4656 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
4659 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
4660 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4666 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
4667 /// but with all dynamically-allocated buffers duplicated in new buffers.
4668 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
4670 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
4671 /// This corresponds to std::vector in C++
4672 pub struct CVec_RouteHintZ {
4673 /// The elements in the array.
4674 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4675 pub data: *mut crate::lightning::routing::router::RouteHint,
4676 /// The number of elements pointed to by `data`.
4679 impl CVec_RouteHintZ {
4680 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
4681 if self.datalen == 0 { return Vec::new(); }
4682 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4683 self.data = core::ptr::null_mut();
4687 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
4688 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4691 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
4692 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
4693 let datalen = v.len();
4694 let data = Box::into_raw(v.into_boxed_slice());
4695 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4699 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4700 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4701 impl Drop for CVec_RouteHintZ {
4702 fn drop(&mut self) {
4703 if self.datalen == 0 { return; }
4704 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4707 impl Clone for CVec_RouteHintZ {
4708 fn clone(&self) -> Self {
4709 let mut res = Vec::new();
4710 if self.datalen == 0 { return Self::from(res); }
4711 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4716 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
4717 /// This corresponds to std::vector in C++
4718 pub struct CVec_RouteHintHopZ {
4719 /// The elements in the array.
4720 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4721 pub data: *mut crate::lightning::routing::router::RouteHintHop,
4722 /// The number of elements pointed to by `data`.
4725 impl CVec_RouteHintHopZ {
4726 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
4727 if self.datalen == 0 { return Vec::new(); }
4728 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4729 self.data = core::ptr::null_mut();
4733 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
4734 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4737 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
4738 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
4739 let datalen = v.len();
4740 let data = Box::into_raw(v.into_boxed_slice());
4741 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4745 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4746 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
4747 impl Drop for CVec_RouteHintHopZ {
4748 fn drop(&mut self) {
4749 if self.datalen == 0 { return; }
4750 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4753 impl Clone for CVec_RouteHintHopZ {
4754 fn clone(&self) -> Self {
4755 let mut res = Vec::new();
4756 if self.datalen == 0 { return Self::from(res); }
4757 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4762 /// The contents of CResult_RouteHintDecodeErrorZ
4763 pub union CResult_RouteHintDecodeErrorZPtr {
4764 /// A pointer to the contents in the success state.
4765 /// Reading from this pointer when `result_ok` is not set is undefined.
4766 pub result: *mut crate::lightning::routing::router::RouteHint,
4767 /// A pointer to the contents in the error state.
4768 /// Reading from this pointer when `result_ok` is set is undefined.
4769 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4772 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
4773 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4775 pub struct CResult_RouteHintDecodeErrorZ {
4776 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
4777 /// `err` or `result` depending on the state of `result_ok`.
4778 pub contents: CResult_RouteHintDecodeErrorZPtr,
4779 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
4780 pub result_ok: bool,
4783 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
4784 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
4785 CResult_RouteHintDecodeErrorZ {
4786 contents: CResult_RouteHintDecodeErrorZPtr {
4787 result: Box::into_raw(Box::new(o)),
4793 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
4794 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
4795 CResult_RouteHintDecodeErrorZ {
4796 contents: CResult_RouteHintDecodeErrorZPtr {
4797 err: Box::into_raw(Box::new(e)),
4802 /// Checks if the given object is currently in the success state
4804 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4808 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4809 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4810 impl Drop for CResult_RouteHintDecodeErrorZ {
4811 fn drop(&mut self) {
4813 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4814 let _ = unsafe { Box::from_raw(self.contents.result) };
4817 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4818 let _ = unsafe { Box::from_raw(self.contents.err) };
4823 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4824 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4825 let contents = if o.result_ok {
4826 let result = unsafe { o.contents.result };
4827 unsafe { o.contents.result = core::ptr::null_mut() };
4828 CResult_RouteHintDecodeErrorZPtr { result }
4830 let err = unsafe { o.contents.err };
4831 unsafe { o.contents.err = core::ptr::null_mut(); }
4832 CResult_RouteHintDecodeErrorZPtr { err }
4836 result_ok: o.result_ok,
4840 impl Clone for CResult_RouteHintDecodeErrorZ {
4841 fn clone(&self) -> Self {
4843 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4844 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4847 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4848 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4854 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4855 /// but with all dynamically-allocated buffers duplicated in new buffers.
4856 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4858 /// The contents of CResult_RouteHintHopDecodeErrorZ
4859 pub union CResult_RouteHintHopDecodeErrorZPtr {
4860 /// A pointer to the contents in the success state.
4861 /// Reading from this pointer when `result_ok` is not set is undefined.
4862 pub result: *mut crate::lightning::routing::router::RouteHintHop,
4863 /// A pointer to the contents in the error state.
4864 /// Reading from this pointer when `result_ok` is set is undefined.
4865 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4868 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4869 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4871 pub struct CResult_RouteHintHopDecodeErrorZ {
4872 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4873 /// `err` or `result` depending on the state of `result_ok`.
4874 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4875 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4876 pub result_ok: bool,
4879 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4880 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4881 CResult_RouteHintHopDecodeErrorZ {
4882 contents: CResult_RouteHintHopDecodeErrorZPtr {
4883 result: Box::into_raw(Box::new(o)),
4889 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4890 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4891 CResult_RouteHintHopDecodeErrorZ {
4892 contents: CResult_RouteHintHopDecodeErrorZPtr {
4893 err: Box::into_raw(Box::new(e)),
4898 /// Checks if the given object is currently in the success state
4900 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4904 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4905 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4906 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4907 fn drop(&mut self) {
4909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4910 let _ = unsafe { Box::from_raw(self.contents.result) };
4913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4914 let _ = unsafe { Box::from_raw(self.contents.err) };
4919 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4921 let contents = if o.result_ok {
4922 let result = unsafe { o.contents.result };
4923 unsafe { o.contents.result = core::ptr::null_mut() };
4924 CResult_RouteHintHopDecodeErrorZPtr { result }
4926 let err = unsafe { o.contents.err };
4927 unsafe { o.contents.err = core::ptr::null_mut(); }
4928 CResult_RouteHintHopDecodeErrorZPtr { err }
4932 result_ok: o.result_ok,
4936 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4937 fn clone(&self) -> Self {
4939 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4940 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4943 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4944 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4950 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4951 /// but with all dynamically-allocated buffers duplicated in new buffers.
4952 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4954 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4955 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4956 /// A pointer to the contents in the success state.
4957 /// Reading from this pointer when `result_ok` is not set is undefined.
4958 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4959 /// A pointer to the contents in the error state.
4960 /// Reading from this pointer when `result_ok` is set is undefined.
4961 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4964 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4965 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4967 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4968 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4969 /// `err` or `result` depending on the state of `result_ok`.
4970 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4971 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4972 pub result_ok: bool,
4975 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4976 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4977 CResult_FixedPenaltyScorerDecodeErrorZ {
4978 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4979 result: Box::into_raw(Box::new(o)),
4985 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4986 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4987 CResult_FixedPenaltyScorerDecodeErrorZ {
4988 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4989 err: Box::into_raw(Box::new(e)),
4994 /// Checks if the given object is currently in the success state
4996 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
5000 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
5001 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
5002 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
5003 fn drop(&mut self) {
5005 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5006 let _ = unsafe { Box::from_raw(self.contents.result) };
5009 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5010 let _ = unsafe { Box::from_raw(self.contents.err) };
5015 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
5016 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5017 let contents = if o.result_ok {
5018 let result = unsafe { o.contents.result };
5019 unsafe { o.contents.result = core::ptr::null_mut() };
5020 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
5022 let err = unsafe { o.contents.err };
5023 unsafe { o.contents.err = core::ptr::null_mut(); }
5024 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
5028 result_ok: o.result_ok,
5032 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
5033 fn clone(&self) -> Self {
5035 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5036 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
5039 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5040 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5046 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
5047 /// but with all dynamically-allocated buffers duplicated in new buffers.
5048 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
5050 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5051 /// This corresponds to std::vector in C++
5052 pub struct CVec_NodeIdZ {
5053 /// The elements in the array.
5054 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5055 pub data: *mut crate::lightning::routing::gossip::NodeId,
5056 /// The number of elements pointed to by `data`.
5060 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
5061 if self.datalen == 0 { return Vec::new(); }
5062 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5063 self.data = core::ptr::null_mut();
5067 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
5068 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5071 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
5072 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
5073 let datalen = v.len();
5074 let data = Box::into_raw(v.into_boxed_slice());
5075 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5080 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
5081 impl Drop for CVec_NodeIdZ {
5082 fn drop(&mut self) {
5083 if self.datalen == 0 { return; }
5084 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5087 impl Clone for CVec_NodeIdZ {
5088 fn clone(&self) -> Self {
5089 let mut res = Vec::new();
5090 if self.datalen == 0 { return Self::from(res); }
5091 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5096 /// A tuple of 2 elements. See the individual fields for the types contained.
5097 pub struct C2Tuple_u64u64Z {
5098 /// The element at position 0
5100 /// The element at position 1
5103 impl From<(u64, u64)> for C2Tuple_u64u64Z {
5104 fn from (tup: (u64, u64)) -> Self {
5111 impl C2Tuple_u64u64Z {
5112 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
5116 impl Clone for C2Tuple_u64u64Z {
5117 fn clone(&self) -> Self {
5119 a: Clone::clone(&self.a),
5120 b: Clone::clone(&self.b),
5125 /// Creates a new tuple which has the same data as `orig`
5126 /// but with all dynamically-allocated buffers duplicated in new buffers.
5127 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
5128 /// Creates a new C2Tuple_u64u64Z from the contained elements.
5130 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
5131 C2Tuple_u64u64Z { a, b, }
5135 /// Frees any resources used by the C2Tuple_u64u64Z.
5136 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
5139 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5140 pub enum COption_C2Tuple_u64u64ZZ {
5141 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5142 Some(crate::c_types::derived::C2Tuple_u64u64Z),
5143 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5146 impl COption_C2Tuple_u64u64ZZ {
5147 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5148 if let Self::None = self { false } else { true }
5150 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5153 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
5154 if let Self::Some(v) = self { v } else { unreachable!() }
5158 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
5159 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
5160 COption_C2Tuple_u64u64ZZ::Some(o)
5163 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
5164 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
5165 COption_C2Tuple_u64u64ZZ::None
5168 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
5169 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
5171 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
5172 /// but with all dynamically-allocated buffers duplicated in new buffers.
5173 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
5175 /// A tuple of 2 elements. See the individual fields for the types contained.
5176 pub struct C2Tuple_Z {
5177 /// The element at position 0
5178 pub a: crate::c_types::ThirtyTwoU16s,
5179 /// The element at position 1
5180 pub b: crate::c_types::ThirtyTwoU16s,
5182 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
5183 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5191 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5195 /// Creates a new C2Tuple_Z from the contained elements.
5197 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
5202 /// Frees any resources used by the C2Tuple_Z.
5203 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
5205 /// A tuple of 2 elements. See the individual fields for the types contained.
5206 pub struct C2Tuple__u1632_u1632Z {
5207 /// The element at position 0
5208 pub a: crate::c_types::ThirtyTwoU16s,
5209 /// The element at position 1
5210 pub b: crate::c_types::ThirtyTwoU16s,
5212 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
5213 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5220 impl C2Tuple__u1632_u1632Z {
5221 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5225 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
5227 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
5228 C2Tuple__u1632_u1632Z { a, b, }
5232 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5233 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5235 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5236 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5237 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5238 Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5239 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5242 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5243 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5244 if let Self::None = self { false } else { true }
5246 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5249 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5250 if let Self::Some(v) = self { v } else { unreachable!() }
5254 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5255 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5256 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5259 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5260 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5261 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5264 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5265 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5268 /// An enum which can either contain a f64 or not
5269 pub enum COption_f64Z {
5270 /// When we're in this state, this COption_f64Z contains a f64
5272 /// When we're in this state, this COption_f64Z contains nothing
5276 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5277 if let Self::None = self { false } else { true }
5279 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5282 #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5283 if let Self::Some(v) = self { v } else { unreachable!() }
5287 /// Constructs a new COption_f64Z containing a f64
5288 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5289 COption_f64Z::Some(o)
5292 /// Constructs a new COption_f64Z containing nothing
5293 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5297 /// Frees any resources associated with the f64, if we are in the Some state
5298 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5300 /// Creates a new COption_f64Z which has the same data as `orig`
5301 /// but with all dynamically-allocated buffers duplicated in new buffers.
5302 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5304 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5305 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5306 /// A pointer to the contents in the success state.
5307 /// Reading from this pointer when `result_ok` is not set is undefined.
5308 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5309 /// A pointer to the contents in the error state.
5310 /// Reading from this pointer when `result_ok` is set is undefined.
5311 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5314 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5315 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5316 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5317 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5318 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5319 /// `err` or `result` depending on the state of `result_ok`.
5320 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5321 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5322 pub result_ok: bool,
5325 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5326 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5327 CResult_ProbabilisticScorerDecodeErrorZ {
5328 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5329 result: Box::into_raw(Box::new(o)),
5335 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5336 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5337 CResult_ProbabilisticScorerDecodeErrorZ {
5338 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5339 err: Box::into_raw(Box::new(e)),
5344 /// Checks if the given object is currently in the success state
5346 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5350 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5351 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5352 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5353 fn drop(&mut self) {
5355 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5356 let _ = unsafe { Box::from_raw(self.contents.result) };
5359 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5360 let _ = unsafe { Box::from_raw(self.contents.err) };
5365 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5366 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5367 let contents = if o.result_ok {
5368 let result = unsafe { o.contents.result };
5369 unsafe { o.contents.result = core::ptr::null_mut() };
5370 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5372 let err = unsafe { o.contents.err };
5373 unsafe { o.contents.err = core::ptr::null_mut(); }
5374 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5378 result_ok: o.result_ok,
5383 /// A tuple of 2 elements. See the individual fields for the types contained.
5384 pub struct C2Tuple_usizeTransactionZ {
5385 /// The element at position 0
5387 /// The element at position 1
5388 pub b: crate::c_types::Transaction,
5390 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5391 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5398 impl C2Tuple_usizeTransactionZ {
5399 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5403 impl Clone for C2Tuple_usizeTransactionZ {
5404 fn clone(&self) -> Self {
5406 a: Clone::clone(&self.a),
5407 b: Clone::clone(&self.b),
5412 /// Creates a new tuple which has the same data as `orig`
5413 /// but with all dynamically-allocated buffers duplicated in new buffers.
5414 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5415 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5417 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5418 C2Tuple_usizeTransactionZ { a, b, }
5422 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5423 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5425 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5426 /// This corresponds to std::vector in C++
5427 pub struct CVec_C2Tuple_usizeTransactionZZ {
5428 /// The elements in the array.
5429 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5430 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5431 /// The number of elements pointed to by `data`.
5434 impl CVec_C2Tuple_usizeTransactionZZ {
5435 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5436 if self.datalen == 0 { return Vec::new(); }
5437 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5438 self.data = core::ptr::null_mut();
5442 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5443 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5446 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5447 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5448 let datalen = v.len();
5449 let data = Box::into_raw(v.into_boxed_slice());
5450 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5455 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5456 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5457 fn drop(&mut self) {
5458 if self.datalen == 0 { return; }
5459 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5462 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5463 fn clone(&self) -> Self {
5464 let mut res = Vec::new();
5465 if self.datalen == 0 { return Self::from(res); }
5466 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5471 /// A tuple of 3 elements. See the individual fields for the types contained.
5472 pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5473 /// The element at position 0
5474 pub a: crate::c_types::ThirtyTwoBytes,
5475 /// The element at position 1
5477 /// The element at position 2
5478 pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ,
5480 impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5481 fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
5489 impl C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5490 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
5491 (self.a, self.b, self.c)
5494 impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5495 fn clone(&self) -> Self {
5497 a: Clone::clone(&self.a),
5498 b: Clone::clone(&self.b),
5499 c: Clone::clone(&self.c),
5504 /// Creates a new tuple which has the same data as `orig`
5505 /// but with all dynamically-allocated buffers duplicated in new buffers.
5506 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
5507 /// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements.
5509 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: u32, c: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5510 C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, }
5514 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.
5515 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { }
5517 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size.
5518 /// This corresponds to std::vector in C++
5519 pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5520 /// The elements in the array.
5521 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5522 pub data: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ,
5523 /// The number of elements pointed to by `data`.
5526 impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5527 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ> {
5528 if self.datalen == 0 { return Vec::new(); }
5529 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5530 self.data = core::ptr::null_mut();
5534 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] {
5535 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5538 impl From<Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5539 fn from(v: Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>) -> Self {
5540 let datalen = v.len();
5541 let data = Box::into_raw(v.into_boxed_slice());
5542 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5546 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5547 pub extern "C" fn CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res: CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ) { }
5548 impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5549 fn drop(&mut self) {
5550 if self.datalen == 0 { return; }
5551 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5554 impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5555 fn clone(&self) -> Self {
5556 let mut res = Vec::new();
5557 if self.datalen == 0 { return Self::from(res); }
5558 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5563 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
5564 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
5565 /// A pointer to the contents in the success state.
5566 /// Reading from this pointer when `result_ok` is not set is undefined.
5567 pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
5568 /// Note that this value is always NULL, as there are no contents in the Err variant
5569 pub err: *mut core::ffi::c_void,
5572 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
5573 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
5574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5575 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
5576 /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
5577 /// `err` or `result` depending on the state of `result_ok`.
5578 pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
5579 /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
5580 pub result_ok: bool,
5583 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
5584 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
5585 CResult_ChannelMonitorUpdateStatusNoneZ {
5586 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5587 result: Box::into_raw(Box::new(o)),
5593 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
5594 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
5595 CResult_ChannelMonitorUpdateStatusNoneZ {
5596 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5597 err: core::ptr::null_mut(),
5602 /// Checks if the given object is currently in the success state
5604 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
5608 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
5609 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
5610 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
5611 fn drop(&mut self) {
5613 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5614 let _ = unsafe { Box::from_raw(self.contents.result) };
5620 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
5621 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
5622 let contents = if o.result_ok {
5623 let result = unsafe { o.contents.result };
5624 unsafe { o.contents.result = core::ptr::null_mut() };
5625 CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
5627 let _ = unsafe { Box::from_raw(o.contents.err) };
5628 o.contents.err = core::ptr::null_mut();
5629 CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
5633 result_ok: o.result_ok,
5637 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
5638 fn clone(&self) -> Self {
5640 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5641 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
5644 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5645 err: core::ptr::null_mut()
5651 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
5652 /// but with all dynamically-allocated buffers duplicated in new buffers.
5653 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
5655 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5656 /// This corresponds to std::vector in C++
5657 pub struct CVec_MonitorEventZ {
5658 /// The elements in the array.
5659 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5660 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
5661 /// The number of elements pointed to by `data`.
5664 impl CVec_MonitorEventZ {
5665 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
5666 if self.datalen == 0 { return Vec::new(); }
5667 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5668 self.data = core::ptr::null_mut();
5672 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
5673 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5676 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
5677 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
5678 let datalen = v.len();
5679 let data = Box::into_raw(v.into_boxed_slice());
5680 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5684 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5685 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
5686 impl Drop for CVec_MonitorEventZ {
5687 fn drop(&mut self) {
5688 if self.datalen == 0 { return; }
5689 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5692 impl Clone for CVec_MonitorEventZ {
5693 fn clone(&self) -> Self {
5694 let mut res = Vec::new();
5695 if self.datalen == 0 { return Self::from(res); }
5696 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5701 /// A tuple of 3 elements. See the individual fields for the types contained.
5702 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5703 /// The element at position 0
5704 pub a: crate::lightning::chain::transaction::OutPoint,
5705 /// The element at position 1
5706 pub b: crate::c_types::derived::CVec_MonitorEventZ,
5707 /// The element at position 2
5708 pub c: crate::c_types::PublicKey,
5710 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5711 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
5719 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5720 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
5721 (self.a, self.b, self.c)
5724 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5725 fn clone(&self) -> Self {
5727 a: Clone::clone(&self.a),
5728 b: Clone::clone(&self.b),
5729 c: Clone::clone(&self.c),
5734 /// Creates a new tuple which has the same data as `orig`
5735 /// but with all dynamically-allocated buffers duplicated in new buffers.
5736 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
5737 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
5739 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5740 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
5744 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
5745 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
5747 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5748 /// This corresponds to std::vector in C++
5749 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5750 /// The elements in the array.
5751 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5752 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
5753 /// The number of elements pointed to by `data`.
5756 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5757 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
5758 if self.datalen == 0 { return Vec::new(); }
5759 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5760 self.data = core::ptr::null_mut();
5764 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
5765 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5768 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5769 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
5770 let datalen = v.len();
5771 let data = Box::into_raw(v.into_boxed_slice());
5772 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5777 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
5778 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5779 fn drop(&mut self) {
5780 if self.datalen == 0 { return; }
5781 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5784 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5785 fn clone(&self) -> Self {
5786 let mut res = Vec::new();
5787 if self.datalen == 0 { return Self::from(res); }
5788 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5793 /// The contents of CResult_InitFeaturesDecodeErrorZ
5794 pub union CResult_InitFeaturesDecodeErrorZPtr {
5795 /// A pointer to the contents in the success state.
5796 /// Reading from this pointer when `result_ok` is not set is undefined.
5797 pub result: *mut crate::lightning::ln::features::InitFeatures,
5798 /// A pointer to the contents in the error state.
5799 /// Reading from this pointer when `result_ok` is set is undefined.
5800 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5803 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5804 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5806 pub struct CResult_InitFeaturesDecodeErrorZ {
5807 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5808 /// `err` or `result` depending on the state of `result_ok`.
5809 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5810 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5811 pub result_ok: bool,
5814 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5815 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5816 CResult_InitFeaturesDecodeErrorZ {
5817 contents: CResult_InitFeaturesDecodeErrorZPtr {
5818 result: Box::into_raw(Box::new(o)),
5824 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5825 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5826 CResult_InitFeaturesDecodeErrorZ {
5827 contents: CResult_InitFeaturesDecodeErrorZPtr {
5828 err: Box::into_raw(Box::new(e)),
5833 /// Checks if the given object is currently in the success state
5835 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5839 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5840 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5841 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5842 fn drop(&mut self) {
5844 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5845 let _ = unsafe { Box::from_raw(self.contents.result) };
5848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5849 let _ = unsafe { Box::from_raw(self.contents.err) };
5854 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5855 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5856 let contents = if o.result_ok {
5857 let result = unsafe { o.contents.result };
5858 unsafe { o.contents.result = core::ptr::null_mut() };
5859 CResult_InitFeaturesDecodeErrorZPtr { result }
5861 let err = unsafe { o.contents.err };
5862 unsafe { o.contents.err = core::ptr::null_mut(); }
5863 CResult_InitFeaturesDecodeErrorZPtr { err }
5867 result_ok: o.result_ok,
5871 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5872 fn clone(&self) -> Self {
5874 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5875 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5878 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
5879 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5885 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
5886 /// but with all dynamically-allocated buffers duplicated in new buffers.
5887 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5889 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5890 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5891 /// A pointer to the contents in the success state.
5892 /// Reading from this pointer when `result_ok` is not set is undefined.
5893 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5894 /// A pointer to the contents in the error state.
5895 /// Reading from this pointer when `result_ok` is set is undefined.
5896 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5899 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5900 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5902 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5903 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5904 /// `err` or `result` depending on the state of `result_ok`.
5905 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5906 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5907 pub result_ok: bool,
5910 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5911 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5912 CResult_ChannelFeaturesDecodeErrorZ {
5913 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5914 result: Box::into_raw(Box::new(o)),
5920 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5921 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5922 CResult_ChannelFeaturesDecodeErrorZ {
5923 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5924 err: Box::into_raw(Box::new(e)),
5929 /// Checks if the given object is currently in the success state
5931 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5935 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5936 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5937 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5938 fn drop(&mut self) {
5940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5941 let _ = unsafe { Box::from_raw(self.contents.result) };
5944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5945 let _ = unsafe { Box::from_raw(self.contents.err) };
5950 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5952 let contents = if o.result_ok {
5953 let result = unsafe { o.contents.result };
5954 unsafe { o.contents.result = core::ptr::null_mut() };
5955 CResult_ChannelFeaturesDecodeErrorZPtr { result }
5957 let err = unsafe { o.contents.err };
5958 unsafe { o.contents.err = core::ptr::null_mut(); }
5959 CResult_ChannelFeaturesDecodeErrorZPtr { err }
5963 result_ok: o.result_ok,
5967 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5968 fn clone(&self) -> Self {
5970 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5971 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5974 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5981 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5982 /// but with all dynamically-allocated buffers duplicated in new buffers.
5983 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5985 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5986 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5987 /// A pointer to the contents in the success state.
5988 /// Reading from this pointer when `result_ok` is not set is undefined.
5989 pub result: *mut crate::lightning::ln::features::NodeFeatures,
5990 /// A pointer to the contents in the error state.
5991 /// Reading from this pointer when `result_ok` is set is undefined.
5992 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5995 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5996 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5998 pub struct CResult_NodeFeaturesDecodeErrorZ {
5999 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
6000 /// `err` or `result` depending on the state of `result_ok`.
6001 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
6002 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
6003 pub result_ok: bool,
6006 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
6007 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
6008 CResult_NodeFeaturesDecodeErrorZ {
6009 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6010 result: Box::into_raw(Box::new(o)),
6016 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
6017 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
6018 CResult_NodeFeaturesDecodeErrorZ {
6019 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6020 err: Box::into_raw(Box::new(e)),
6025 /// Checks if the given object is currently in the success state
6027 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
6031 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
6032 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
6033 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
6034 fn drop(&mut self) {
6036 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6037 let _ = unsafe { Box::from_raw(self.contents.result) };
6040 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6041 let _ = unsafe { Box::from_raw(self.contents.err) };
6046 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
6047 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6048 let contents = if o.result_ok {
6049 let result = unsafe { o.contents.result };
6050 unsafe { o.contents.result = core::ptr::null_mut() };
6051 CResult_NodeFeaturesDecodeErrorZPtr { result }
6053 let err = unsafe { o.contents.err };
6054 unsafe { o.contents.err = core::ptr::null_mut(); }
6055 CResult_NodeFeaturesDecodeErrorZPtr { err }
6059 result_ok: o.result_ok,
6063 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
6064 fn clone(&self) -> Self {
6066 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6067 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
6070 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6071 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6077 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
6078 /// but with all dynamically-allocated buffers duplicated in new buffers.
6079 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6081 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
6082 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6083 /// A pointer to the contents in the success state.
6084 /// Reading from this pointer when `result_ok` is not set is undefined.
6085 pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
6086 /// A pointer to the contents in the error state.
6087 /// Reading from this pointer when `result_ok` is set is undefined.
6088 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6091 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6092 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6094 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6095 /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
6096 /// `err` or `result` depending on the state of `result_ok`.
6097 pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
6098 /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
6099 pub result_ok: bool,
6102 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
6103 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6104 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6105 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6106 result: Box::into_raw(Box::new(o)),
6112 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
6113 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6114 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6115 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6116 err: Box::into_raw(Box::new(e)),
6121 /// Checks if the given object is currently in the success state
6123 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
6127 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
6128 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
6129 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6130 fn drop(&mut self) {
6132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6133 let _ = unsafe { Box::from_raw(self.contents.result) };
6136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6137 let _ = unsafe { Box::from_raw(self.contents.err) };
6142 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6143 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6144 let contents = if o.result_ok {
6145 let result = unsafe { o.contents.result };
6146 unsafe { o.contents.result = core::ptr::null_mut() };
6147 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
6149 let err = unsafe { o.contents.err };
6150 unsafe { o.contents.err = core::ptr::null_mut(); }
6151 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
6155 result_ok: o.result_ok,
6159 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6160 fn clone(&self) -> Self {
6162 Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6163 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6166 Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6167 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6173 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6174 /// but with all dynamically-allocated buffers duplicated in new buffers.
6175 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6177 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
6178 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6179 /// A pointer to the contents in the success state.
6180 /// Reading from this pointer when `result_ok` is not set is undefined.
6181 pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
6182 /// A pointer to the contents in the error state.
6183 /// Reading from this pointer when `result_ok` is set is undefined.
6184 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6187 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6188 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6190 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6191 /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
6192 /// `err` or `result` depending on the state of `result_ok`.
6193 pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
6194 /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
6195 pub result_ok: bool,
6198 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
6199 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6200 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6201 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6202 result: Box::into_raw(Box::new(o)),
6208 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
6209 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6210 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6211 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6212 err: Box::into_raw(Box::new(e)),
6217 /// Checks if the given object is currently in the success state
6219 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
6223 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
6224 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
6225 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6226 fn drop(&mut self) {
6228 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6229 let _ = unsafe { Box::from_raw(self.contents.result) };
6232 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6233 let _ = unsafe { Box::from_raw(self.contents.err) };
6238 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6239 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6240 let contents = if o.result_ok {
6241 let result = unsafe { o.contents.result };
6242 unsafe { o.contents.result = core::ptr::null_mut() };
6243 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6245 let err = unsafe { o.contents.err };
6246 unsafe { o.contents.err = core::ptr::null_mut(); }
6247 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6251 result_ok: o.result_ok,
6255 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6256 fn clone(&self) -> Self {
6258 Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6259 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6262 Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6263 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6269 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6270 /// but with all dynamically-allocated buffers duplicated in new buffers.
6271 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6273 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6274 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
6275 /// A pointer to the contents in the success state.
6276 /// Reading from this pointer when `result_ok` is not set is undefined.
6277 pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
6278 /// A pointer to the contents in the error state.
6279 /// Reading from this pointer when `result_ok` is set is undefined.
6280 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6283 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6284 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6286 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6287 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6288 /// `err` or `result` depending on the state of `result_ok`.
6289 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6290 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6291 pub result_ok: bool,
6294 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6295 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6296 CResult_BlindedHopFeaturesDecodeErrorZ {
6297 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6298 result: Box::into_raw(Box::new(o)),
6304 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6305 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6306 CResult_BlindedHopFeaturesDecodeErrorZ {
6307 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6308 err: Box::into_raw(Box::new(e)),
6313 /// Checks if the given object is currently in the success state
6315 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6319 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6320 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6321 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
6322 fn drop(&mut self) {
6324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6325 let _ = unsafe { Box::from_raw(self.contents.result) };
6328 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6329 let _ = unsafe { Box::from_raw(self.contents.err) };
6334 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6335 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6336 let contents = if o.result_ok {
6337 let result = unsafe { o.contents.result };
6338 unsafe { o.contents.result = core::ptr::null_mut() };
6339 CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
6341 let err = unsafe { o.contents.err };
6342 unsafe { o.contents.err = core::ptr::null_mut(); }
6343 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6347 result_ok: o.result_ok,
6351 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6352 fn clone(&self) -> Self {
6354 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6355 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6358 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6359 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6365 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6366 /// but with all dynamically-allocated buffers duplicated in new buffers.
6367 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6369 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6370 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6371 /// A pointer to the contents in the success state.
6372 /// Reading from this pointer when `result_ok` is not set is undefined.
6373 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
6374 /// A pointer to the contents in the error state.
6375 /// Reading from this pointer when `result_ok` is set is undefined.
6376 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6379 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6380 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6382 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6383 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6384 /// `err` or `result` depending on the state of `result_ok`.
6385 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6386 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6387 pub result_ok: bool,
6390 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6391 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6392 CResult_ChannelTypeFeaturesDecodeErrorZ {
6393 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6394 result: Box::into_raw(Box::new(o)),
6400 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6401 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6402 CResult_ChannelTypeFeaturesDecodeErrorZ {
6403 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6404 err: Box::into_raw(Box::new(e)),
6409 /// Checks if the given object is currently in the success state
6411 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6415 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6416 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6417 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
6418 fn drop(&mut self) {
6420 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6421 let _ = unsafe { Box::from_raw(self.contents.result) };
6424 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6425 let _ = unsafe { Box::from_raw(self.contents.err) };
6430 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6431 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6432 let contents = if o.result_ok {
6433 let result = unsafe { o.contents.result };
6434 unsafe { o.contents.result = core::ptr::null_mut() };
6435 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6437 let err = unsafe { o.contents.err };
6438 unsafe { o.contents.err = core::ptr::null_mut(); }
6439 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6443 result_ok: o.result_ok,
6447 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6448 fn clone(&self) -> Self {
6450 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6451 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6454 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6455 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6461 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6462 /// but with all dynamically-allocated buffers duplicated in new buffers.
6463 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6465 /// The contents of CResult_OfferBolt12ParseErrorZ
6466 pub union CResult_OfferBolt12ParseErrorZPtr {
6467 /// A pointer to the contents in the success state.
6468 /// Reading from this pointer when `result_ok` is not set is undefined.
6469 pub result: *mut crate::lightning::offers::offer::Offer,
6470 /// A pointer to the contents in the error state.
6471 /// Reading from this pointer when `result_ok` is set is undefined.
6472 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
6475 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
6476 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
6477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6478 pub struct CResult_OfferBolt12ParseErrorZ {
6479 /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
6480 /// `err` or `result` depending on the state of `result_ok`.
6481 pub contents: CResult_OfferBolt12ParseErrorZPtr,
6482 /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
6483 pub result_ok: bool,
6486 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
6487 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
6488 CResult_OfferBolt12ParseErrorZ {
6489 contents: CResult_OfferBolt12ParseErrorZPtr {
6490 result: Box::into_raw(Box::new(o)),
6496 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
6497 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
6498 CResult_OfferBolt12ParseErrorZ {
6499 contents: CResult_OfferBolt12ParseErrorZPtr {
6500 err: Box::into_raw(Box::new(e)),
6505 /// Checks if the given object is currently in the success state
6507 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
6511 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
6512 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
6513 impl Drop for CResult_OfferBolt12ParseErrorZ {
6514 fn drop(&mut self) {
6516 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6517 let _ = unsafe { Box::from_raw(self.contents.result) };
6520 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6521 let _ = unsafe { Box::from_raw(self.contents.err) };
6526 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
6527 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
6528 let contents = if o.result_ok {
6529 let result = unsafe { o.contents.result };
6530 unsafe { o.contents.result = core::ptr::null_mut() };
6531 CResult_OfferBolt12ParseErrorZPtr { result }
6533 let err = unsafe { o.contents.err };
6534 unsafe { o.contents.err = core::ptr::null_mut(); }
6535 CResult_OfferBolt12ParseErrorZPtr { err }
6539 result_ok: o.result_ok,
6543 impl Clone for CResult_OfferBolt12ParseErrorZ {
6544 fn clone(&self) -> Self {
6546 Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
6547 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
6550 Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
6551 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
6557 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
6558 /// but with all dynamically-allocated buffers duplicated in new buffers.
6559 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
6561 /// The contents of CResult_PublicKeySecp256k1ErrorZ
6562 pub union CResult_PublicKeySecp256k1ErrorZPtr {
6563 /// A pointer to the contents in the success state.
6564 /// Reading from this pointer when `result_ok` is not set is undefined.
6565 pub result: *mut crate::c_types::PublicKey,
6566 /// A pointer to the contents in the error state.
6567 /// Reading from this pointer when `result_ok` is set is undefined.
6568 pub err: *mut crate::c_types::Secp256k1Error,
6571 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
6572 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6574 pub struct CResult_PublicKeySecp256k1ErrorZ {
6575 /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
6576 /// `err` or `result` depending on the state of `result_ok`.
6577 pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
6578 /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
6579 pub result_ok: bool,
6582 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
6583 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
6584 CResult_PublicKeySecp256k1ErrorZ {
6585 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6586 result: Box::into_raw(Box::new(o)),
6592 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
6593 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
6594 CResult_PublicKeySecp256k1ErrorZ {
6595 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6596 err: Box::into_raw(Box::new(e)),
6601 /// Checks if the given object is currently in the success state
6603 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
6607 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
6608 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
6609 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
6610 fn drop(&mut self) {
6612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6613 let _ = unsafe { Box::from_raw(self.contents.result) };
6616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6617 let _ = unsafe { Box::from_raw(self.contents.err) };
6622 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
6623 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
6624 let contents = if o.result_ok {
6625 let result = unsafe { o.contents.result };
6626 unsafe { o.contents.result = core::ptr::null_mut() };
6627 CResult_PublicKeySecp256k1ErrorZPtr { result }
6629 let err = unsafe { o.contents.err };
6630 unsafe { o.contents.err = core::ptr::null_mut(); }
6631 CResult_PublicKeySecp256k1ErrorZPtr { err }
6635 result_ok: o.result_ok,
6639 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
6640 fn clone(&self) -> Self {
6642 Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6643 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
6646 Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6647 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6653 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
6654 /// but with all dynamically-allocated buffers duplicated in new buffers.
6655 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
6657 /// The contents of CResult_NodeIdDecodeErrorZ
6658 pub union CResult_NodeIdDecodeErrorZPtr {
6659 /// A pointer to the contents in the success state.
6660 /// Reading from this pointer when `result_ok` is not set is undefined.
6661 pub result: *mut crate::lightning::routing::gossip::NodeId,
6662 /// A pointer to the contents in the error state.
6663 /// Reading from this pointer when `result_ok` is set is undefined.
6664 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6667 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6668 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6670 pub struct CResult_NodeIdDecodeErrorZ {
6671 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6672 /// `err` or `result` depending on the state of `result_ok`.
6673 pub contents: CResult_NodeIdDecodeErrorZPtr,
6674 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6675 pub result_ok: bool,
6678 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
6679 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
6680 CResult_NodeIdDecodeErrorZ {
6681 contents: CResult_NodeIdDecodeErrorZPtr {
6682 result: Box::into_raw(Box::new(o)),
6688 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
6689 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
6690 CResult_NodeIdDecodeErrorZ {
6691 contents: CResult_NodeIdDecodeErrorZPtr {
6692 err: Box::into_raw(Box::new(e)),
6697 /// Checks if the given object is currently in the success state
6699 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
6703 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
6704 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
6705 impl Drop for CResult_NodeIdDecodeErrorZ {
6706 fn drop(&mut self) {
6708 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6709 let _ = unsafe { Box::from_raw(self.contents.result) };
6712 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6713 let _ = unsafe { Box::from_raw(self.contents.err) };
6718 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6719 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6720 let contents = if o.result_ok {
6721 let result = unsafe { o.contents.result };
6722 unsafe { o.contents.result = core::ptr::null_mut() };
6723 CResult_NodeIdDecodeErrorZPtr { result }
6725 let err = unsafe { o.contents.err };
6726 unsafe { o.contents.err = core::ptr::null_mut(); }
6727 CResult_NodeIdDecodeErrorZPtr { err }
6731 result_ok: o.result_ok,
6735 impl Clone for CResult_NodeIdDecodeErrorZ {
6736 fn clone(&self) -> Self {
6738 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6739 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6742 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6743 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6749 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6750 /// but with all dynamically-allocated buffers duplicated in new buffers.
6751 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6754 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
6755 pub enum COption_NetworkUpdateZ {
6756 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
6757 Some(crate::lightning::routing::gossip::NetworkUpdate),
6758 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
6761 impl COption_NetworkUpdateZ {
6762 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6763 if let Self::None = self { false } else { true }
6765 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6768 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
6769 if let Self::Some(v) = self { v } else { unreachable!() }
6773 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6774 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6775 COption_NetworkUpdateZ::Some(o)
6778 /// Constructs a new COption_NetworkUpdateZ containing nothing
6779 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6780 COption_NetworkUpdateZ::None
6783 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6784 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6786 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6787 /// but with all dynamically-allocated buffers duplicated in new buffers.
6788 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6790 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6791 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6792 /// A pointer to the contents in the success state.
6793 /// Reading from this pointer when `result_ok` is not set is undefined.
6794 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6795 /// A pointer to the contents in the error state.
6796 /// Reading from this pointer when `result_ok` is set is undefined.
6797 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6800 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6801 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6803 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6804 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6805 /// `err` or `result` depending on the state of `result_ok`.
6806 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6807 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6808 pub result_ok: bool,
6811 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6812 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6813 CResult_COption_NetworkUpdateZDecodeErrorZ {
6814 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6815 result: Box::into_raw(Box::new(o)),
6821 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6822 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6823 CResult_COption_NetworkUpdateZDecodeErrorZ {
6824 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6825 err: Box::into_raw(Box::new(e)),
6830 /// Checks if the given object is currently in the success state
6832 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6836 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6837 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6838 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6839 fn drop(&mut self) {
6841 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6842 let _ = unsafe { Box::from_raw(self.contents.result) };
6845 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6846 let _ = unsafe { Box::from_raw(self.contents.err) };
6851 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6852 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6853 let contents = if o.result_ok {
6854 let result = unsafe { o.contents.result };
6855 unsafe { o.contents.result = core::ptr::null_mut() };
6856 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6858 let err = unsafe { o.contents.err };
6859 unsafe { o.contents.err = core::ptr::null_mut(); }
6860 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6864 result_ok: o.result_ok,
6868 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6869 fn clone(&self) -> Self {
6871 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6872 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6875 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6876 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6882 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6883 /// but with all dynamically-allocated buffers duplicated in new buffers.
6884 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6886 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6887 pub enum COption_UtxoLookupZ {
6888 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6889 Some(crate::lightning::routing::utxo::UtxoLookup),
6890 /// When we're in this state, this COption_UtxoLookupZ contains nothing
6893 impl COption_UtxoLookupZ {
6894 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6895 if let Self::None = self { false } else { true }
6897 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6900 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6901 if let Self::Some(v) = self { v } else { unreachable!() }
6905 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6906 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6907 COption_UtxoLookupZ::Some(o)
6910 /// Constructs a new COption_UtxoLookupZ containing nothing
6911 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6912 COption_UtxoLookupZ::None
6915 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6916 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6918 /// The contents of CResult_NoneLightningErrorZ
6919 pub union CResult_NoneLightningErrorZPtr {
6920 /// Note that this value is always NULL, as there are no contents in the OK variant
6921 pub result: *mut core::ffi::c_void,
6922 /// A pointer to the contents in the error state.
6923 /// Reading from this pointer when `result_ok` is set is undefined.
6924 pub err: *mut crate::lightning::ln::msgs::LightningError,
6927 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6928 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6930 pub struct CResult_NoneLightningErrorZ {
6931 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6932 /// `err` or `result` depending on the state of `result_ok`.
6933 pub contents: CResult_NoneLightningErrorZPtr,
6934 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6935 pub result_ok: bool,
6938 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6939 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6940 CResult_NoneLightningErrorZ {
6941 contents: CResult_NoneLightningErrorZPtr {
6942 result: core::ptr::null_mut(),
6948 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6949 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6950 CResult_NoneLightningErrorZ {
6951 contents: CResult_NoneLightningErrorZPtr {
6952 err: Box::into_raw(Box::new(e)),
6957 /// Checks if the given object is currently in the success state
6959 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6963 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6964 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6965 impl Drop for CResult_NoneLightningErrorZ {
6966 fn drop(&mut self) {
6969 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6970 let _ = unsafe { Box::from_raw(self.contents.err) };
6975 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6976 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6977 let contents = if o.result_ok {
6978 let _ = unsafe { Box::from_raw(o.contents.result) };
6979 o.contents.result = core::ptr::null_mut();
6980 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6982 let err = unsafe { o.contents.err };
6983 unsafe { o.contents.err = core::ptr::null_mut(); }
6984 CResult_NoneLightningErrorZPtr { err }
6988 result_ok: o.result_ok,
6992 impl Clone for CResult_NoneLightningErrorZ {
6993 fn clone(&self) -> Self {
6995 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6996 result: core::ptr::null_mut()
6999 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7000 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7006 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7007 /// but with all dynamically-allocated buffers duplicated in new buffers.
7008 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7010 /// The contents of CResult_boolLightningErrorZ
7011 pub union CResult_boolLightningErrorZPtr {
7012 /// A pointer to the contents in the success state.
7013 /// Reading from this pointer when `result_ok` is not set is undefined.
7014 pub result: *mut bool,
7015 /// A pointer to the contents in the error state.
7016 /// Reading from this pointer when `result_ok` is set is undefined.
7017 pub err: *mut crate::lightning::ln::msgs::LightningError,
7020 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7021 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7023 pub struct CResult_boolLightningErrorZ {
7024 /// The contents of this CResult_boolLightningErrorZ, accessible via either
7025 /// `err` or `result` depending on the state of `result_ok`.
7026 pub contents: CResult_boolLightningErrorZPtr,
7027 /// Whether this CResult_boolLightningErrorZ represents a success state.
7028 pub result_ok: bool,
7031 /// Creates a new CResult_boolLightningErrorZ in the success state.
7032 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7033 CResult_boolLightningErrorZ {
7034 contents: CResult_boolLightningErrorZPtr {
7035 result: Box::into_raw(Box::new(o)),
7041 /// Creates a new CResult_boolLightningErrorZ in the error state.
7042 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7043 CResult_boolLightningErrorZ {
7044 contents: CResult_boolLightningErrorZPtr {
7045 err: Box::into_raw(Box::new(e)),
7050 /// Checks if the given object is currently in the success state
7052 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
7056 /// Frees any resources used by the CResult_boolLightningErrorZ.
7057 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7058 impl Drop for CResult_boolLightningErrorZ {
7059 fn drop(&mut self) {
7061 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7062 let _ = unsafe { Box::from_raw(self.contents.result) };
7065 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7066 let _ = unsafe { Box::from_raw(self.contents.err) };
7071 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7072 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7073 let contents = if o.result_ok {
7074 let result = unsafe { o.contents.result };
7075 unsafe { o.contents.result = core::ptr::null_mut() };
7076 CResult_boolLightningErrorZPtr { result }
7078 let err = unsafe { o.contents.err };
7079 unsafe { o.contents.err = core::ptr::null_mut(); }
7080 CResult_boolLightningErrorZPtr { err }
7084 result_ok: o.result_ok,
7088 impl Clone for CResult_boolLightningErrorZ {
7089 fn clone(&self) -> Self {
7091 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7092 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7095 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7096 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7102 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7103 /// but with all dynamically-allocated buffers duplicated in new buffers.
7104 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7106 /// A tuple of 3 elements. See the individual fields for the types contained.
7107 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7108 /// The element at position 0
7109 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7110 /// The element at position 1
7111 pub b: crate::lightning::ln::msgs::ChannelUpdate,
7112 /// The element at position 2
7113 pub c: crate::lightning::ln::msgs::ChannelUpdate,
7115 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7116 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7124 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7125 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7126 (self.a, self.b, self.c)
7129 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7130 fn clone(&self) -> Self {
7132 a: Clone::clone(&self.a),
7133 b: Clone::clone(&self.b),
7134 c: Clone::clone(&self.c),
7139 /// Creates a new tuple which has the same data as `orig`
7140 /// but with all dynamically-allocated buffers duplicated in new buffers.
7141 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7142 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7144 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7145 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7149 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7150 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7153 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
7154 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7155 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7156 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
7157 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
7160 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7161 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7162 if let Self::None = self { false } else { true }
7164 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7167 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7168 if let Self::Some(v) = self { v } else { unreachable!() }
7172 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7173 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7174 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
7177 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
7178 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7179 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
7182 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
7183 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7185 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
7186 /// but with all dynamically-allocated buffers duplicated in new buffers.
7187 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
7189 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
7190 /// This corresponds to std::vector in C++
7191 pub struct CVec_MessageSendEventZ {
7192 /// The elements in the array.
7193 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7194 pub data: *mut crate::lightning::events::MessageSendEvent,
7195 /// The number of elements pointed to by `data`.
7198 impl CVec_MessageSendEventZ {
7199 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
7200 if self.datalen == 0 { return Vec::new(); }
7201 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7202 self.data = core::ptr::null_mut();
7206 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
7207 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7210 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
7211 fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
7212 let datalen = v.len();
7213 let data = Box::into_raw(v.into_boxed_slice());
7214 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7219 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
7220 impl Drop for CVec_MessageSendEventZ {
7221 fn drop(&mut self) {
7222 if self.datalen == 0 { return; }
7223 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7226 impl Clone for CVec_MessageSendEventZ {
7227 fn clone(&self) -> Self {
7228 let mut res = Vec::new();
7229 if self.datalen == 0 { return Self::from(res); }
7230 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7235 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
7236 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
7237 /// A pointer to the contents in the success state.
7238 /// Reading from this pointer when `result_ok` is not set is undefined.
7239 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
7240 /// A pointer to the contents in the error state.
7241 /// Reading from this pointer when `result_ok` is set is undefined.
7242 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7245 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
7246 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7248 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
7249 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
7250 /// `err` or `result` depending on the state of `result_ok`.
7251 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
7252 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
7253 pub result_ok: bool,
7256 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
7257 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7258 CResult_ChannelUpdateInfoDecodeErrorZ {
7259 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7260 result: Box::into_raw(Box::new(o)),
7266 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
7267 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7268 CResult_ChannelUpdateInfoDecodeErrorZ {
7269 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7270 err: Box::into_raw(Box::new(e)),
7275 /// Checks if the given object is currently in the success state
7277 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
7281 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
7282 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
7283 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
7284 fn drop(&mut self) {
7286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7287 let _ = unsafe { Box::from_raw(self.contents.result) };
7290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7291 let _ = unsafe { Box::from_raw(self.contents.err) };
7296 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
7297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7298 let contents = if o.result_ok {
7299 let result = unsafe { o.contents.result };
7300 unsafe { o.contents.result = core::ptr::null_mut() };
7301 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
7303 let err = unsafe { o.contents.err };
7304 unsafe { o.contents.err = core::ptr::null_mut(); }
7305 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
7309 result_ok: o.result_ok,
7313 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
7314 fn clone(&self) -> Self {
7316 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7317 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
7320 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7327 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
7328 /// but with all dynamically-allocated buffers duplicated in new buffers.
7329 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
7331 /// The contents of CResult_ChannelInfoDecodeErrorZ
7332 pub union CResult_ChannelInfoDecodeErrorZPtr {
7333 /// A pointer to the contents in the success state.
7334 /// Reading from this pointer when `result_ok` is not set is undefined.
7335 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
7336 /// A pointer to the contents in the error state.
7337 /// Reading from this pointer when `result_ok` is set is undefined.
7338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7341 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7342 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7344 pub struct CResult_ChannelInfoDecodeErrorZ {
7345 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7346 /// `err` or `result` depending on the state of `result_ok`.
7347 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7348 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7349 pub result_ok: bool,
7352 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7353 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7354 CResult_ChannelInfoDecodeErrorZ {
7355 contents: CResult_ChannelInfoDecodeErrorZPtr {
7356 result: Box::into_raw(Box::new(o)),
7362 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7363 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7364 CResult_ChannelInfoDecodeErrorZ {
7365 contents: CResult_ChannelInfoDecodeErrorZPtr {
7366 err: Box::into_raw(Box::new(e)),
7371 /// Checks if the given object is currently in the success state
7373 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
7377 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7378 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7379 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7380 fn drop(&mut self) {
7382 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7383 let _ = unsafe { Box::from_raw(self.contents.result) };
7386 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7387 let _ = unsafe { Box::from_raw(self.contents.err) };
7392 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7393 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7394 let contents = if o.result_ok {
7395 let result = unsafe { o.contents.result };
7396 unsafe { o.contents.result = core::ptr::null_mut() };
7397 CResult_ChannelInfoDecodeErrorZPtr { result }
7399 let err = unsafe { o.contents.err };
7400 unsafe { o.contents.err = core::ptr::null_mut(); }
7401 CResult_ChannelInfoDecodeErrorZPtr { err }
7405 result_ok: o.result_ok,
7409 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7410 fn clone(&self) -> Self {
7412 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7413 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7416 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7417 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7423 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7424 /// but with all dynamically-allocated buffers duplicated in new buffers.
7425 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7427 /// The contents of CResult_RoutingFeesDecodeErrorZ
7428 pub union CResult_RoutingFeesDecodeErrorZPtr {
7429 /// A pointer to the contents in the success state.
7430 /// Reading from this pointer when `result_ok` is not set is undefined.
7431 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
7432 /// A pointer to the contents in the error state.
7433 /// Reading from this pointer when `result_ok` is set is undefined.
7434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7437 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7438 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7440 pub struct CResult_RoutingFeesDecodeErrorZ {
7441 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7442 /// `err` or `result` depending on the state of `result_ok`.
7443 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7444 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7445 pub result_ok: bool,
7448 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7449 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7450 CResult_RoutingFeesDecodeErrorZ {
7451 contents: CResult_RoutingFeesDecodeErrorZPtr {
7452 result: Box::into_raw(Box::new(o)),
7458 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7459 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7460 CResult_RoutingFeesDecodeErrorZ {
7461 contents: CResult_RoutingFeesDecodeErrorZPtr {
7462 err: Box::into_raw(Box::new(e)),
7467 /// Checks if the given object is currently in the success state
7469 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
7473 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7474 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7475 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7476 fn drop(&mut self) {
7478 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7479 let _ = unsafe { Box::from_raw(self.contents.result) };
7482 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7483 let _ = unsafe { Box::from_raw(self.contents.err) };
7488 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7489 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7490 let contents = if o.result_ok {
7491 let result = unsafe { o.contents.result };
7492 unsafe { o.contents.result = core::ptr::null_mut() };
7493 CResult_RoutingFeesDecodeErrorZPtr { result }
7495 let err = unsafe { o.contents.err };
7496 unsafe { o.contents.err = core::ptr::null_mut(); }
7497 CResult_RoutingFeesDecodeErrorZPtr { err }
7501 result_ok: o.result_ok,
7505 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7506 fn clone(&self) -> Self {
7508 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7509 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
7512 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7513 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7519 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7520 /// but with all dynamically-allocated buffers duplicated in new buffers.
7521 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
7523 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
7524 /// This corresponds to std::vector in C++
7525 pub struct CVec_SocketAddressZ {
7526 /// The elements in the array.
7527 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7528 pub data: *mut crate::lightning::ln::msgs::SocketAddress,
7529 /// The number of elements pointed to by `data`.
7532 impl CVec_SocketAddressZ {
7533 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
7534 if self.datalen == 0 { return Vec::new(); }
7535 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7536 self.data = core::ptr::null_mut();
7540 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
7541 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7544 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
7545 fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
7546 let datalen = v.len();
7547 let data = Box::into_raw(v.into_boxed_slice());
7548 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7553 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
7554 impl Drop for CVec_SocketAddressZ {
7555 fn drop(&mut self) {
7556 if self.datalen == 0 { return; }
7557 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7560 impl Clone for CVec_SocketAddressZ {
7561 fn clone(&self) -> Self {
7562 let mut res = Vec::new();
7563 if self.datalen == 0 { return Self::from(res); }
7564 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7569 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7570 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7571 /// A pointer to the contents in the success state.
7572 /// Reading from this pointer when `result_ok` is not set is undefined.
7573 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
7574 /// A pointer to the contents in the error state.
7575 /// Reading from this pointer when `result_ok` is set is undefined.
7576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7579 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7580 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7582 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7583 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7584 /// `err` or `result` depending on the state of `result_ok`.
7585 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7586 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7587 pub result_ok: bool,
7590 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7591 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7592 CResult_NodeAnnouncementInfoDecodeErrorZ {
7593 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7594 result: Box::into_raw(Box::new(o)),
7600 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7601 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7602 CResult_NodeAnnouncementInfoDecodeErrorZ {
7603 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7604 err: Box::into_raw(Box::new(e)),
7609 /// Checks if the given object is currently in the success state
7611 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
7615 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7616 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7617 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7618 fn drop(&mut self) {
7620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7621 let _ = unsafe { Box::from_raw(self.contents.result) };
7624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7625 let _ = unsafe { Box::from_raw(self.contents.err) };
7630 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7632 let contents = if o.result_ok {
7633 let result = unsafe { o.contents.result };
7634 unsafe { o.contents.result = core::ptr::null_mut() };
7635 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7637 let err = unsafe { o.contents.err };
7638 unsafe { o.contents.err = core::ptr::null_mut(); }
7639 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7643 result_ok: o.result_ok,
7647 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7648 fn clone(&self) -> Self {
7650 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7651 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7654 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7661 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7662 /// but with all dynamically-allocated buffers duplicated in new buffers.
7663 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
7665 /// The contents of CResult_NodeAliasDecodeErrorZ
7666 pub union CResult_NodeAliasDecodeErrorZPtr {
7667 /// A pointer to the contents in the success state.
7668 /// Reading from this pointer when `result_ok` is not set is undefined.
7669 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
7670 /// A pointer to the contents in the error state.
7671 /// Reading from this pointer when `result_ok` is set is undefined.
7672 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7675 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7676 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
7677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7678 pub struct CResult_NodeAliasDecodeErrorZ {
7679 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7680 /// `err` or `result` depending on the state of `result_ok`.
7681 pub contents: CResult_NodeAliasDecodeErrorZPtr,
7682 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7683 pub result_ok: bool,
7686 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
7687 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
7688 CResult_NodeAliasDecodeErrorZ {
7689 contents: CResult_NodeAliasDecodeErrorZPtr {
7690 result: Box::into_raw(Box::new(o)),
7696 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
7697 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
7698 CResult_NodeAliasDecodeErrorZ {
7699 contents: CResult_NodeAliasDecodeErrorZPtr {
7700 err: Box::into_raw(Box::new(e)),
7705 /// Checks if the given object is currently in the success state
7707 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
7711 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
7712 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
7713 impl Drop for CResult_NodeAliasDecodeErrorZ {
7714 fn drop(&mut self) {
7716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7717 let _ = unsafe { Box::from_raw(self.contents.result) };
7720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7721 let _ = unsafe { Box::from_raw(self.contents.err) };
7726 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
7727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
7728 let contents = if o.result_ok {
7729 let result = unsafe { o.contents.result };
7730 unsafe { o.contents.result = core::ptr::null_mut() };
7731 CResult_NodeAliasDecodeErrorZPtr { result }
7733 let err = unsafe { o.contents.err };
7734 unsafe { o.contents.err = core::ptr::null_mut(); }
7735 CResult_NodeAliasDecodeErrorZPtr { err }
7739 result_ok: o.result_ok,
7743 impl Clone for CResult_NodeAliasDecodeErrorZ {
7744 fn clone(&self) -> Self {
7746 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
7747 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
7750 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
7751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7757 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
7758 /// but with all dynamically-allocated buffers duplicated in new buffers.
7759 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
7761 /// The contents of CResult_NodeInfoDecodeErrorZ
7762 pub union CResult_NodeInfoDecodeErrorZPtr {
7763 /// A pointer to the contents in the success state.
7764 /// Reading from this pointer when `result_ok` is not set is undefined.
7765 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
7766 /// A pointer to the contents in the error state.
7767 /// Reading from this pointer when `result_ok` is set is undefined.
7768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7771 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7772 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7774 pub struct CResult_NodeInfoDecodeErrorZ {
7775 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7776 /// `err` or `result` depending on the state of `result_ok`.
7777 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7778 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7779 pub result_ok: bool,
7782 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7783 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7784 CResult_NodeInfoDecodeErrorZ {
7785 contents: CResult_NodeInfoDecodeErrorZPtr {
7786 result: Box::into_raw(Box::new(o)),
7792 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7793 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7794 CResult_NodeInfoDecodeErrorZ {
7795 contents: CResult_NodeInfoDecodeErrorZPtr {
7796 err: Box::into_raw(Box::new(e)),
7801 /// Checks if the given object is currently in the success state
7803 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7807 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7808 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7809 impl Drop for CResult_NodeInfoDecodeErrorZ {
7810 fn drop(&mut self) {
7812 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7813 let _ = unsafe { Box::from_raw(self.contents.result) };
7816 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7817 let _ = unsafe { Box::from_raw(self.contents.err) };
7822 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7823 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7824 let contents = if o.result_ok {
7825 let result = unsafe { o.contents.result };
7826 unsafe { o.contents.result = core::ptr::null_mut() };
7827 CResult_NodeInfoDecodeErrorZPtr { result }
7829 let err = unsafe { o.contents.err };
7830 unsafe { o.contents.err = core::ptr::null_mut(); }
7831 CResult_NodeInfoDecodeErrorZPtr { err }
7835 result_ok: o.result_ok,
7839 impl Clone for CResult_NodeInfoDecodeErrorZ {
7840 fn clone(&self) -> Self {
7842 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7843 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7846 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7847 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7853 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7854 /// but with all dynamically-allocated buffers duplicated in new buffers.
7855 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7857 /// The contents of CResult_NetworkGraphDecodeErrorZ
7858 pub union CResult_NetworkGraphDecodeErrorZPtr {
7859 /// A pointer to the contents in the success state.
7860 /// Reading from this pointer when `result_ok` is not set is undefined.
7861 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7862 /// A pointer to the contents in the error state.
7863 /// Reading from this pointer when `result_ok` is set is undefined.
7864 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7867 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7868 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7870 pub struct CResult_NetworkGraphDecodeErrorZ {
7871 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7872 /// `err` or `result` depending on the state of `result_ok`.
7873 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7874 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7875 pub result_ok: bool,
7878 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7879 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7880 CResult_NetworkGraphDecodeErrorZ {
7881 contents: CResult_NetworkGraphDecodeErrorZPtr {
7882 result: Box::into_raw(Box::new(o)),
7888 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7889 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7890 CResult_NetworkGraphDecodeErrorZ {
7891 contents: CResult_NetworkGraphDecodeErrorZPtr {
7892 err: Box::into_raw(Box::new(e)),
7897 /// Checks if the given object is currently in the success state
7899 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7903 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7904 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7905 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7906 fn drop(&mut self) {
7908 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7909 let _ = unsafe { Box::from_raw(self.contents.result) };
7912 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7913 let _ = unsafe { Box::from_raw(self.contents.err) };
7918 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7919 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7920 let contents = if o.result_ok {
7921 let result = unsafe { o.contents.result };
7922 unsafe { o.contents.result = core::ptr::null_mut() };
7923 CResult_NetworkGraphDecodeErrorZPtr { result }
7925 let err = unsafe { o.contents.err };
7926 unsafe { o.contents.err = core::ptr::null_mut(); }
7927 CResult_NetworkGraphDecodeErrorZPtr { err }
7931 result_ok: o.result_ok,
7937 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
7938 pub enum COption_CVec_SocketAddressZZ {
7939 /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
7940 Some(crate::c_types::derived::CVec_SocketAddressZ),
7941 /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
7944 impl COption_CVec_SocketAddressZZ {
7945 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7946 if let Self::None = self { false } else { true }
7948 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7951 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
7952 if let Self::Some(v) = self { v } else { unreachable!() }
7956 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
7957 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
7958 COption_CVec_SocketAddressZZ::Some(o)
7961 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
7962 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
7963 COption_CVec_SocketAddressZZ::None
7966 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
7967 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
7969 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
7970 /// but with all dynamically-allocated buffers duplicated in new buffers.
7971 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
7973 /// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ
7974 pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr {
7975 /// A pointer to the contents in the success state.
7976 /// Reading from this pointer when `result_ok` is not set is undefined.
7977 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
7978 /// A pointer to the contents in the error state.
7979 /// Reading from this pointer when `result_ok` is set is undefined.
7980 pub err: *mut crate::lightning::ln::onion_payment::InboundHTLCErr,
7983 /// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation,
7984 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure.
7985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7986 pub struct CResult_PendingHTLCInfoInboundHTLCErrZ {
7987 /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either
7988 /// `err` or `result` depending on the state of `result_ok`.
7989 pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr,
7990 /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state.
7991 pub result_ok: bool,
7994 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
7995 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
7996 CResult_PendingHTLCInfoInboundHTLCErrZ {
7997 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
7998 result: Box::into_raw(Box::new(o)),
8004 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
8005 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
8006 CResult_PendingHTLCInfoInboundHTLCErrZ {
8007 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8008 err: Box::into_raw(Box::new(e)),
8013 /// Checks if the given object is currently in the success state
8015 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool {
8019 /// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ.
8020 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { }
8021 impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ {
8022 fn drop(&mut self) {
8024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8025 let _ = unsafe { Box::from_raw(self.contents.result) };
8028 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8029 let _ = unsafe { Box::from_raw(self.contents.err) };
8034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>> for CResult_PendingHTLCInfoInboundHTLCErrZ {
8035 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>) -> Self {
8036 let contents = if o.result_ok {
8037 let result = unsafe { o.contents.result };
8038 unsafe { o.contents.result = core::ptr::null_mut() };
8039 CResult_PendingHTLCInfoInboundHTLCErrZPtr { result }
8041 let err = unsafe { o.contents.err };
8042 unsafe { o.contents.err = core::ptr::null_mut(); }
8043 CResult_PendingHTLCInfoInboundHTLCErrZPtr { err }
8047 result_ok: o.result_ok,
8052 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
8053 /// This corresponds to std::vector in C++
8054 pub struct CVec_HTLCOutputInCommitmentZ {
8055 /// The elements in the array.
8056 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8057 pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
8058 /// The number of elements pointed to by `data`.
8061 impl CVec_HTLCOutputInCommitmentZ {
8062 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
8063 if self.datalen == 0 { return Vec::new(); }
8064 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8065 self.data = core::ptr::null_mut();
8069 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
8070 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8073 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
8074 fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
8075 let datalen = v.len();
8076 let data = Box::into_raw(v.into_boxed_slice());
8077 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8081 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8082 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
8083 impl Drop for CVec_HTLCOutputInCommitmentZ {
8084 fn drop(&mut self) {
8085 if self.datalen == 0 { return; }
8086 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8089 impl Clone for CVec_HTLCOutputInCommitmentZ {
8090 fn clone(&self) -> Self {
8091 let mut res = Vec::new();
8092 if self.datalen == 0 { return Self::from(res); }
8093 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8098 /// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
8099 /// This corresponds to std::vector in C++
8100 pub struct CVec_HTLCDescriptorZ {
8101 /// The elements in the array.
8102 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8103 pub data: *mut crate::lightning::sign::HTLCDescriptor,
8104 /// The number of elements pointed to by `data`.
8107 impl CVec_HTLCDescriptorZ {
8108 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::HTLCDescriptor> {
8109 if self.datalen == 0 { return Vec::new(); }
8110 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8111 self.data = core::ptr::null_mut();
8115 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::HTLCDescriptor] {
8116 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8119 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
8120 fn from(v: Vec<crate::lightning::sign::HTLCDescriptor>) -> Self {
8121 let datalen = v.len();
8122 let data = Box::into_raw(v.into_boxed_slice());
8123 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8127 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8128 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
8129 impl Drop for CVec_HTLCDescriptorZ {
8130 fn drop(&mut self) {
8131 if self.datalen == 0 { return; }
8132 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8135 impl Clone for CVec_HTLCDescriptorZ {
8136 fn clone(&self) -> Self {
8137 let mut res = Vec::new();
8138 if self.datalen == 0 { return Self::from(res); }
8139 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8144 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
8145 /// This corresponds to std::vector in C++
8146 pub struct CVec_UtxoZ {
8147 /// The elements in the array.
8148 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8149 pub data: *mut crate::lightning::events::bump_transaction::Utxo,
8150 /// The number of elements pointed to by `data`.
8154 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
8155 if self.datalen == 0 { return Vec::new(); }
8156 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8157 self.data = core::ptr::null_mut();
8161 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
8162 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8165 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
8166 fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
8167 let datalen = v.len();
8168 let data = Box::into_raw(v.into_boxed_slice());
8169 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8173 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8174 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
8175 impl Drop for CVec_UtxoZ {
8176 fn drop(&mut self) {
8177 if self.datalen == 0 { return; }
8178 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8181 impl Clone for CVec_UtxoZ {
8182 fn clone(&self) -> Self {
8183 let mut res = Vec::new();
8184 if self.datalen == 0 { return Self::from(res); }
8185 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8191 /// An enum which can either contain a crate::c_types::TxOut or not
8192 pub enum COption_TxOutZ {
8193 /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
8194 Some(crate::c_types::TxOut),
8195 /// When we're in this state, this COption_TxOutZ contains nothing
8198 impl COption_TxOutZ {
8199 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8200 if let Self::None = self { false } else { true }
8202 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8205 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
8206 if let Self::Some(v) = self { v } else { unreachable!() }
8210 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
8211 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
8212 COption_TxOutZ::Some(o)
8215 /// Constructs a new COption_TxOutZ containing nothing
8216 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
8217 COption_TxOutZ::None
8220 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
8221 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
8223 /// Creates a new COption_TxOutZ which has the same data as `orig`
8224 /// but with all dynamically-allocated buffers duplicated in new buffers.
8225 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
8227 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
8228 /// This corresponds to std::vector in C++
8229 pub struct CVec_InputZ {
8230 /// The elements in the array.
8231 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8232 pub data: *mut crate::lightning::events::bump_transaction::Input,
8233 /// The number of elements pointed to by `data`.
8237 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
8238 if self.datalen == 0 { return Vec::new(); }
8239 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8240 self.data = core::ptr::null_mut();
8244 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
8245 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8248 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
8249 fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
8250 let datalen = v.len();
8251 let data = Box::into_raw(v.into_boxed_slice());
8252 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8256 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8257 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
8258 impl Drop for CVec_InputZ {
8259 fn drop(&mut self) {
8260 if self.datalen == 0 { return; }
8261 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8264 impl Clone for CVec_InputZ {
8265 fn clone(&self) -> Self {
8266 let mut res = Vec::new();
8267 if self.datalen == 0 { return Self::from(res); }
8268 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8273 /// The contents of CResult_CoinSelectionNoneZ
8274 pub union CResult_CoinSelectionNoneZPtr {
8275 /// A pointer to the contents in the success state.
8276 /// Reading from this pointer when `result_ok` is not set is undefined.
8277 pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
8278 /// Note that this value is always NULL, as there are no contents in the Err variant
8279 pub err: *mut core::ffi::c_void,
8282 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
8283 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
8284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8285 pub struct CResult_CoinSelectionNoneZ {
8286 /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
8287 /// `err` or `result` depending on the state of `result_ok`.
8288 pub contents: CResult_CoinSelectionNoneZPtr,
8289 /// Whether this CResult_CoinSelectionNoneZ represents a success state.
8290 pub result_ok: bool,
8293 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
8294 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
8295 CResult_CoinSelectionNoneZ {
8296 contents: CResult_CoinSelectionNoneZPtr {
8297 result: Box::into_raw(Box::new(o)),
8303 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
8304 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
8305 CResult_CoinSelectionNoneZ {
8306 contents: CResult_CoinSelectionNoneZPtr {
8307 err: core::ptr::null_mut(),
8312 /// Checks if the given object is currently in the success state
8314 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
8318 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
8319 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
8320 impl Drop for CResult_CoinSelectionNoneZ {
8321 fn drop(&mut self) {
8323 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8324 let _ = unsafe { Box::from_raw(self.contents.result) };
8330 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
8331 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
8332 let contents = if o.result_ok {
8333 let result = unsafe { o.contents.result };
8334 unsafe { o.contents.result = core::ptr::null_mut() };
8335 CResult_CoinSelectionNoneZPtr { result }
8337 let _ = unsafe { Box::from_raw(o.contents.err) };
8338 o.contents.err = core::ptr::null_mut();
8339 CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
8343 result_ok: o.result_ok,
8347 impl Clone for CResult_CoinSelectionNoneZ {
8348 fn clone(&self) -> Self {
8350 Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
8351 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
8354 Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
8355 err: core::ptr::null_mut()
8361 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
8362 /// but with all dynamically-allocated buffers duplicated in new buffers.
8363 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
8365 /// The contents of CResult_CVec_UtxoZNoneZ
8366 pub union CResult_CVec_UtxoZNoneZPtr {
8367 /// A pointer to the contents in the success state.
8368 /// Reading from this pointer when `result_ok` is not set is undefined.
8369 pub result: *mut crate::c_types::derived::CVec_UtxoZ,
8370 /// Note that this value is always NULL, as there are no contents in the Err variant
8371 pub err: *mut core::ffi::c_void,
8374 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
8375 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
8376 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8377 pub struct CResult_CVec_UtxoZNoneZ {
8378 /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
8379 /// `err` or `result` depending on the state of `result_ok`.
8380 pub contents: CResult_CVec_UtxoZNoneZPtr,
8381 /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
8382 pub result_ok: bool,
8385 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
8386 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
8387 CResult_CVec_UtxoZNoneZ {
8388 contents: CResult_CVec_UtxoZNoneZPtr {
8389 result: Box::into_raw(Box::new(o)),
8395 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
8396 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
8397 CResult_CVec_UtxoZNoneZ {
8398 contents: CResult_CVec_UtxoZNoneZPtr {
8399 err: core::ptr::null_mut(),
8404 /// Checks if the given object is currently in the success state
8406 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
8410 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
8411 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
8412 impl Drop for CResult_CVec_UtxoZNoneZ {
8413 fn drop(&mut self) {
8415 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8416 let _ = unsafe { Box::from_raw(self.contents.result) };
8422 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
8423 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
8424 let contents = if o.result_ok {
8425 let result = unsafe { o.contents.result };
8426 unsafe { o.contents.result = core::ptr::null_mut() };
8427 CResult_CVec_UtxoZNoneZPtr { result }
8429 let _ = unsafe { Box::from_raw(o.contents.err) };
8430 o.contents.err = core::ptr::null_mut();
8431 CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
8435 result_ok: o.result_ok,
8439 impl Clone for CResult_CVec_UtxoZNoneZ {
8440 fn clone(&self) -> Self {
8442 Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
8443 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
8446 Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
8447 err: core::ptr::null_mut()
8453 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
8454 /// but with all dynamically-allocated buffers duplicated in new buffers.
8455 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
8457 /// A tuple of 2 elements. See the individual fields for the types contained.
8458 pub struct C2Tuple_u64u16Z {
8459 /// The element at position 0
8461 /// The element at position 1
8464 impl From<(u64, u16)> for C2Tuple_u64u16Z {
8465 fn from (tup: (u64, u16)) -> Self {
8472 impl C2Tuple_u64u16Z {
8473 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
8477 impl Clone for C2Tuple_u64u16Z {
8478 fn clone(&self) -> Self {
8480 a: Clone::clone(&self.a),
8481 b: Clone::clone(&self.b),
8486 /// Creates a new tuple which has the same data as `orig`
8487 /// but with all dynamically-allocated buffers duplicated in new buffers.
8488 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
8489 /// Creates a new C2Tuple_u64u16Z from the contained elements.
8491 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
8492 C2Tuple_u64u16Z { a, b, }
8496 /// Frees any resources used by the C2Tuple_u64u16Z.
8497 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
8500 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
8501 pub enum COption_C2Tuple_u64u16ZZ {
8502 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
8503 Some(crate::c_types::derived::C2Tuple_u64u16Z),
8504 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
8507 impl COption_C2Tuple_u64u16ZZ {
8508 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8509 if let Self::None = self { false } else { true }
8511 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8514 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
8515 if let Self::Some(v) = self { v } else { unreachable!() }
8519 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
8520 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
8521 COption_C2Tuple_u64u16ZZ::Some(o)
8524 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
8525 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
8526 COption_C2Tuple_u64u16ZZ::None
8529 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
8530 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
8532 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
8533 /// but with all dynamically-allocated buffers duplicated in new buffers.
8534 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
8537 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
8538 pub enum COption_ChannelShutdownStateZ {
8539 /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
8540 Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
8541 /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
8544 impl COption_ChannelShutdownStateZ {
8545 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8546 if let Self::None = self { false } else { true }
8548 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8551 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
8552 if let Self::Some(v) = self { v } else { unreachable!() }
8556 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
8557 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
8558 COption_ChannelShutdownStateZ::Some(o)
8561 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
8562 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
8563 COption_ChannelShutdownStateZ::None
8566 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
8567 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
8569 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
8570 /// but with all dynamically-allocated buffers duplicated in new buffers.
8571 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
8573 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
8574 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
8575 /// A pointer to the contents in the success state.
8576 /// Reading from this pointer when `result_ok` is not set is undefined.
8577 pub result: *mut crate::c_types::ThirtyTwoBytes,
8578 /// A pointer to the contents in the error state.
8579 /// Reading from this pointer when `result_ok` is set is undefined.
8580 pub err: *mut crate::lightning::util::errors::APIError,
8583 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
8584 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8586 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
8587 /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
8588 /// `err` or `result` depending on the state of `result_ok`.
8589 pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
8590 /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
8591 pub result_ok: bool,
8594 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
8595 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
8596 CResult_ThirtyTwoBytesAPIErrorZ {
8597 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8598 result: Box::into_raw(Box::new(o)),
8604 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
8605 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
8606 CResult_ThirtyTwoBytesAPIErrorZ {
8607 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8608 err: Box::into_raw(Box::new(e)),
8613 /// Checks if the given object is currently in the success state
8615 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
8619 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
8620 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
8621 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
8622 fn drop(&mut self) {
8624 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8625 let _ = unsafe { Box::from_raw(self.contents.result) };
8628 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8629 let _ = unsafe { Box::from_raw(self.contents.err) };
8634 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
8635 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8636 let contents = if o.result_ok {
8637 let result = unsafe { o.contents.result };
8638 unsafe { o.contents.result = core::ptr::null_mut() };
8639 CResult_ThirtyTwoBytesAPIErrorZPtr { result }
8641 let err = unsafe { o.contents.err };
8642 unsafe { o.contents.err = core::ptr::null_mut(); }
8643 CResult_ThirtyTwoBytesAPIErrorZPtr { err }
8647 result_ok: o.result_ok,
8651 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
8652 fn clone(&self) -> Self {
8654 Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8655 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8658 Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8659 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8665 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
8666 /// but with all dynamically-allocated buffers duplicated in new buffers.
8667 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
8669 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8670 /// This corresponds to std::vector in C++
8671 pub struct CVec_RecentPaymentDetailsZ {
8672 /// The elements in the array.
8673 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8674 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8675 /// The number of elements pointed to by `data`.
8678 impl CVec_RecentPaymentDetailsZ {
8679 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8680 if self.datalen == 0 { return Vec::new(); }
8681 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8682 self.data = core::ptr::null_mut();
8686 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8687 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8690 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8691 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8692 let datalen = v.len();
8693 let data = Box::into_raw(v.into_boxed_slice());
8694 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8698 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8699 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8700 impl Drop for CVec_RecentPaymentDetailsZ {
8701 fn drop(&mut self) {
8702 if self.datalen == 0 { return; }
8703 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8707 /// The contents of CResult_NonePaymentSendFailureZ
8708 pub union CResult_NonePaymentSendFailureZPtr {
8709 /// Note that this value is always NULL, as there are no contents in the OK variant
8710 pub result: *mut core::ffi::c_void,
8711 /// A pointer to the contents in the error state.
8712 /// Reading from this pointer when `result_ok` is set is undefined.
8713 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8716 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8717 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8719 pub struct CResult_NonePaymentSendFailureZ {
8720 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8721 /// `err` or `result` depending on the state of `result_ok`.
8722 pub contents: CResult_NonePaymentSendFailureZPtr,
8723 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8724 pub result_ok: bool,
8727 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8728 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8729 CResult_NonePaymentSendFailureZ {
8730 contents: CResult_NonePaymentSendFailureZPtr {
8731 result: core::ptr::null_mut(),
8737 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8738 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8739 CResult_NonePaymentSendFailureZ {
8740 contents: CResult_NonePaymentSendFailureZPtr {
8741 err: Box::into_raw(Box::new(e)),
8746 /// Checks if the given object is currently in the success state
8748 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8752 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8753 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8754 impl Drop for CResult_NonePaymentSendFailureZ {
8755 fn drop(&mut self) {
8758 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8759 let _ = unsafe { Box::from_raw(self.contents.err) };
8764 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8765 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8766 let contents = if o.result_ok {
8767 let _ = unsafe { Box::from_raw(o.contents.result) };
8768 o.contents.result = core::ptr::null_mut();
8769 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8771 let err = unsafe { o.contents.err };
8772 unsafe { o.contents.err = core::ptr::null_mut(); }
8773 CResult_NonePaymentSendFailureZPtr { err }
8777 result_ok: o.result_ok,
8781 impl Clone for CResult_NonePaymentSendFailureZ {
8782 fn clone(&self) -> Self {
8784 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8785 result: core::ptr::null_mut()
8788 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8789 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8795 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8796 /// but with all dynamically-allocated buffers duplicated in new buffers.
8797 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8799 /// The contents of CResult_NoneRetryableSendFailureZ
8800 pub union CResult_NoneRetryableSendFailureZPtr {
8801 /// Note that this value is always NULL, as there are no contents in the OK variant
8802 pub result: *mut core::ffi::c_void,
8803 /// A pointer to the contents in the error state.
8804 /// Reading from this pointer when `result_ok` is set is undefined.
8805 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8808 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8809 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8811 pub struct CResult_NoneRetryableSendFailureZ {
8812 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8813 /// `err` or `result` depending on the state of `result_ok`.
8814 pub contents: CResult_NoneRetryableSendFailureZPtr,
8815 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8816 pub result_ok: bool,
8819 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8820 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8821 CResult_NoneRetryableSendFailureZ {
8822 contents: CResult_NoneRetryableSendFailureZPtr {
8823 result: core::ptr::null_mut(),
8829 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8830 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8831 CResult_NoneRetryableSendFailureZ {
8832 contents: CResult_NoneRetryableSendFailureZPtr {
8833 err: Box::into_raw(Box::new(e)),
8838 /// Checks if the given object is currently in the success state
8840 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8844 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8845 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8846 impl Drop for CResult_NoneRetryableSendFailureZ {
8847 fn drop(&mut self) {
8850 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8851 let _ = unsafe { Box::from_raw(self.contents.err) };
8856 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8857 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8858 let contents = if o.result_ok {
8859 let _ = unsafe { Box::from_raw(o.contents.result) };
8860 o.contents.result = core::ptr::null_mut();
8861 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8863 let err = unsafe { o.contents.err };
8864 unsafe { o.contents.err = core::ptr::null_mut(); }
8865 CResult_NoneRetryableSendFailureZPtr { err }
8869 result_ok: o.result_ok,
8873 impl Clone for CResult_NoneRetryableSendFailureZ {
8874 fn clone(&self) -> Self {
8876 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8877 result: core::ptr::null_mut()
8880 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8881 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8887 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8888 /// but with all dynamically-allocated buffers duplicated in new buffers.
8889 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8891 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
8892 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8893 /// A pointer to the contents in the success state.
8894 /// Reading from this pointer when `result_ok` is not set is undefined.
8895 pub result: *mut crate::c_types::ThirtyTwoBytes,
8896 /// A pointer to the contents in the error state.
8897 /// Reading from this pointer when `result_ok` is set is undefined.
8898 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8901 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
8902 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8903 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8904 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
8905 /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
8906 /// `err` or `result` depending on the state of `result_ok`.
8907 pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
8908 /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
8909 pub result_ok: bool,
8912 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
8913 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8914 CResult_ThirtyTwoBytesPaymentSendFailureZ {
8915 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8916 result: Box::into_raw(Box::new(o)),
8922 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
8923 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8924 CResult_ThirtyTwoBytesPaymentSendFailureZ {
8925 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8926 err: Box::into_raw(Box::new(e)),
8931 /// Checks if the given object is currently in the success state
8933 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
8937 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
8938 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
8939 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8940 fn drop(&mut self) {
8942 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8943 let _ = unsafe { Box::from_raw(self.contents.result) };
8946 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8947 let _ = unsafe { Box::from_raw(self.contents.err) };
8952 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8953 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8954 let contents = if o.result_ok {
8955 let result = unsafe { o.contents.result };
8956 unsafe { o.contents.result = core::ptr::null_mut() };
8957 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
8959 let err = unsafe { o.contents.err };
8960 unsafe { o.contents.err = core::ptr::null_mut(); }
8961 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
8965 result_ok: o.result_ok,
8969 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8970 fn clone(&self) -> Self {
8972 Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8973 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8976 Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8977 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8983 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
8984 /// but with all dynamically-allocated buffers duplicated in new buffers.
8985 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
8987 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
8988 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8989 /// A pointer to the contents in the success state.
8990 /// Reading from this pointer when `result_ok` is not set is undefined.
8991 pub result: *mut crate::c_types::ThirtyTwoBytes,
8992 /// A pointer to the contents in the error state.
8993 /// Reading from this pointer when `result_ok` is set is undefined.
8994 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8997 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
8998 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9000 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
9001 /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
9002 /// `err` or `result` depending on the state of `result_ok`.
9003 pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
9004 /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
9005 pub result_ok: bool,
9008 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
9009 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9010 CResult_ThirtyTwoBytesRetryableSendFailureZ {
9011 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9012 result: Box::into_raw(Box::new(o)),
9018 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
9019 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9020 CResult_ThirtyTwoBytesRetryableSendFailureZ {
9021 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9022 err: Box::into_raw(Box::new(e)),
9027 /// Checks if the given object is currently in the success state
9029 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
9033 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
9034 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
9035 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9036 fn drop(&mut self) {
9038 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9039 let _ = unsafe { Box::from_raw(self.contents.result) };
9042 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9043 let _ = unsafe { Box::from_raw(self.contents.err) };
9048 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9049 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9050 let contents = if o.result_ok {
9051 let result = unsafe { o.contents.result };
9052 unsafe { o.contents.result = core::ptr::null_mut() };
9053 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
9055 let err = unsafe { o.contents.err };
9056 unsafe { o.contents.err = core::ptr::null_mut(); }
9057 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
9061 result_ok: o.result_ok,
9065 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9066 fn clone(&self) -> Self {
9068 Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9069 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9072 Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9073 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9079 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
9080 /// but with all dynamically-allocated buffers duplicated in new buffers.
9081 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
9083 /// A tuple of 2 elements. See the individual fields for the types contained.
9084 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9085 /// The element at position 0
9086 pub a: crate::c_types::ThirtyTwoBytes,
9087 /// The element at position 1
9088 pub b: crate::c_types::ThirtyTwoBytes,
9090 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9091 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9098 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9099 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9103 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9104 fn clone(&self) -> Self {
9106 a: Clone::clone(&self.a),
9107 b: Clone::clone(&self.b),
9112 /// Creates a new tuple which has the same data as `orig`
9113 /// but with all dynamically-allocated buffers duplicated in new buffers.
9114 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
9115 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
9117 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9118 C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
9122 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
9123 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
9125 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
9126 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9127 /// A pointer to the contents in the success state.
9128 /// Reading from this pointer when `result_ok` is not set is undefined.
9129 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9130 /// A pointer to the contents in the error state.
9131 /// Reading from this pointer when `result_ok` is set is undefined.
9132 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9135 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
9136 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9138 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9139 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
9140 /// `err` or `result` depending on the state of `result_ok`.
9141 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
9142 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
9143 pub result_ok: bool,
9146 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
9147 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9148 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9149 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9150 result: Box::into_raw(Box::new(o)),
9156 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
9157 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9158 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9159 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9160 err: Box::into_raw(Box::new(e)),
9165 /// Checks if the given object is currently in the success state
9167 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
9171 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
9172 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
9173 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9174 fn drop(&mut self) {
9176 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9177 let _ = unsafe { Box::from_raw(self.contents.result) };
9180 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9181 let _ = unsafe { Box::from_raw(self.contents.err) };
9186 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9187 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9188 let contents = if o.result_ok {
9189 let result = unsafe { o.contents.result };
9190 unsafe { o.contents.result = core::ptr::null_mut() };
9191 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
9193 let err = unsafe { o.contents.err };
9194 unsafe { o.contents.err = core::ptr::null_mut(); }
9195 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
9199 result_ok: o.result_ok,
9203 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
9204 fn clone(&self) -> Self {
9206 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9207 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9210 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
9211 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9217 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
9218 /// but with all dynamically-allocated buffers duplicated in new buffers.
9219 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
9221 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
9222 /// This corresponds to std::vector in C++
9223 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9224 /// The elements in the array.
9225 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9226 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9227 /// The number of elements pointed to by `data`.
9230 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9231 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
9232 if self.datalen == 0 { return Vec::new(); }
9233 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9234 self.data = core::ptr::null_mut();
9238 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
9239 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9242 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9243 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
9244 let datalen = v.len();
9245 let data = Box::into_raw(v.into_boxed_slice());
9246 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9250 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9251 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
9252 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9253 fn drop(&mut self) {
9254 if self.datalen == 0 { return; }
9255 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9258 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
9259 fn clone(&self) -> Self {
9260 let mut res = Vec::new();
9261 if self.datalen == 0 { return Self::from(res); }
9262 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9267 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
9268 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9269 /// A pointer to the contents in the success state.
9270 /// Reading from this pointer when `result_ok` is not set is undefined.
9271 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
9272 /// A pointer to the contents in the error state.
9273 /// Reading from this pointer when `result_ok` is set is undefined.
9274 pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
9277 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
9278 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
9279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9280 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9281 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
9282 /// `err` or `result` depending on the state of `result_ok`.
9283 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
9284 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
9285 pub result_ok: bool,
9288 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
9289 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9290 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9291 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9292 result: Box::into_raw(Box::new(o)),
9298 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
9299 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9300 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9301 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9302 err: Box::into_raw(Box::new(e)),
9307 /// Checks if the given object is currently in the success state
9309 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
9313 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
9314 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
9315 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9316 fn drop(&mut self) {
9318 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9319 let _ = unsafe { Box::from_raw(self.contents.result) };
9322 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9323 let _ = unsafe { Box::from_raw(self.contents.err) };
9328 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9329 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
9330 let contents = if o.result_ok {
9331 let result = unsafe { o.contents.result };
9332 unsafe { o.contents.result = core::ptr::null_mut() };
9333 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
9335 let err = unsafe { o.contents.err };
9336 unsafe { o.contents.err = core::ptr::null_mut(); }
9337 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
9341 result_ok: o.result_ok,
9345 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9346 fn clone(&self) -> Self {
9348 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9349 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
9352 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9353 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
9359 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
9360 /// but with all dynamically-allocated buffers duplicated in new buffers.
9361 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
9363 /// A tuple of 2 elements. See the individual fields for the types contained.
9364 pub struct C2Tuple_ThirtyTwoBytesPublicKeyZ {
9365 /// The element at position 0
9366 pub a: crate::c_types::ThirtyTwoBytes,
9367 /// The element at position 1
9368 pub b: crate::c_types::PublicKey,
9370 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)> for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9371 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)) -> Self {
9378 impl C2Tuple_ThirtyTwoBytesPublicKeyZ {
9379 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey) {
9383 impl Clone for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9384 fn clone(&self) -> Self {
9386 a: Clone::clone(&self.a),
9387 b: Clone::clone(&self.b),
9392 /// Creates a new tuple which has the same data as `orig`
9393 /// but with all dynamically-allocated buffers duplicated in new buffers.
9394 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig: &C2Tuple_ThirtyTwoBytesPublicKeyZ) -> C2Tuple_ThirtyTwoBytesPublicKeyZ { Clone::clone(&orig) }
9395 /// Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements.
9397 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::PublicKey) -> C2Tuple_ThirtyTwoBytesPublicKeyZ {
9398 C2Tuple_ThirtyTwoBytesPublicKeyZ { a, b, }
9402 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ.
9403 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res: C2Tuple_ThirtyTwoBytesPublicKeyZ) { }
9405 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size.
9406 /// This corresponds to std::vector in C++
9407 pub struct CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9408 /// The elements in the array.
9409 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9410 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ,
9411 /// The number of elements pointed to by `data`.
9414 impl CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9415 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ> {
9416 if self.datalen == 0 { return Vec::new(); }
9417 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9418 self.data = core::ptr::null_mut();
9422 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ] {
9423 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9426 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>> for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9427 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>) -> Self {
9428 let datalen = v.len();
9429 let data = Box::into_raw(v.into_boxed_slice());
9430 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9434 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9435 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ) { }
9436 impl Drop for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9437 fn drop(&mut self) {
9438 if self.datalen == 0 { return; }
9439 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9442 impl Clone for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9443 fn clone(&self) -> Self {
9444 let mut res = Vec::new();
9445 if self.datalen == 0 { return Self::from(res); }
9446 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9452 /// An enum which can either contain a crate::c_types::Str or not
9453 pub enum COption_StrZ {
9454 /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
9455 Some(crate::c_types::Str),
9456 /// When we're in this state, this COption_StrZ contains nothing
9460 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9461 if let Self::None = self { false } else { true }
9463 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9466 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
9467 if let Self::Some(v) = self { v } else { unreachable!() }
9471 /// Constructs a new COption_StrZ containing a crate::c_types::Str
9472 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
9473 COption_StrZ::Some(o)
9476 /// Constructs a new COption_StrZ containing nothing
9477 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
9481 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
9482 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
9484 /// Creates a new COption_StrZ which has the same data as `orig`
9485 /// but with all dynamically-allocated buffers duplicated in new buffers.
9486 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
9488 /// The contents of CResult_NoneBolt12SemanticErrorZ
9489 pub union CResult_NoneBolt12SemanticErrorZPtr {
9490 /// Note that this value is always NULL, as there are no contents in the OK variant
9491 pub result: *mut core::ffi::c_void,
9492 /// A pointer to the contents in the error state.
9493 /// Reading from this pointer when `result_ok` is set is undefined.
9494 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
9497 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
9498 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
9499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9500 pub struct CResult_NoneBolt12SemanticErrorZ {
9501 /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
9502 /// `err` or `result` depending on the state of `result_ok`.
9503 pub contents: CResult_NoneBolt12SemanticErrorZPtr,
9504 /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
9505 pub result_ok: bool,
9508 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
9509 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
9510 CResult_NoneBolt12SemanticErrorZ {
9511 contents: CResult_NoneBolt12SemanticErrorZPtr {
9512 result: core::ptr::null_mut(),
9518 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
9519 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
9520 CResult_NoneBolt12SemanticErrorZ {
9521 contents: CResult_NoneBolt12SemanticErrorZPtr {
9522 err: Box::into_raw(Box::new(e)),
9527 /// Checks if the given object is currently in the success state
9529 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
9533 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
9534 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
9535 impl Drop for CResult_NoneBolt12SemanticErrorZ {
9536 fn drop(&mut self) {
9539 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9540 let _ = unsafe { Box::from_raw(self.contents.err) };
9545 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
9546 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
9547 let contents = if o.result_ok {
9548 let _ = unsafe { Box::from_raw(o.contents.result) };
9549 o.contents.result = core::ptr::null_mut();
9550 CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
9552 let err = unsafe { o.contents.err };
9553 unsafe { o.contents.err = core::ptr::null_mut(); }
9554 CResult_NoneBolt12SemanticErrorZPtr { err }
9558 result_ok: o.result_ok,
9562 impl Clone for CResult_NoneBolt12SemanticErrorZ {
9563 fn clone(&self) -> Self {
9565 Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
9566 result: core::ptr::null_mut()
9569 Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
9570 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
9576 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
9577 /// but with all dynamically-allocated buffers duplicated in new buffers.
9578 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
9580 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
9581 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9582 /// A pointer to the contents in the success state.
9583 /// Reading from this pointer when `result_ok` is not set is undefined.
9584 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9585 /// Note that this value is always NULL, as there are no contents in the Err variant
9586 pub err: *mut core::ffi::c_void,
9589 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
9590 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
9591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9592 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9593 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
9594 /// `err` or `result` depending on the state of `result_ok`.
9595 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
9596 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
9597 pub result_ok: bool,
9600 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
9601 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9602 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9603 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9604 result: Box::into_raw(Box::new(o)),
9610 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
9611 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9612 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9613 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9614 err: core::ptr::null_mut(),
9619 /// Checks if the given object is currently in the success state
9621 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
9625 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
9626 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
9627 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9628 fn drop(&mut self) {
9630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9631 let _ = unsafe { Box::from_raw(self.contents.result) };
9637 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9638 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
9639 let contents = if o.result_ok {
9640 let result = unsafe { o.contents.result };
9641 unsafe { o.contents.result = core::ptr::null_mut() };
9642 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
9644 let _ = unsafe { Box::from_raw(o.contents.err) };
9645 o.contents.err = core::ptr::null_mut();
9646 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
9650 result_ok: o.result_ok,
9654 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9655 fn clone(&self) -> Self {
9657 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9658 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9661 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9662 err: core::ptr::null_mut()
9668 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
9669 /// but with all dynamically-allocated buffers duplicated in new buffers.
9670 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
9673 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
9674 pub enum COption_OffersMessageZ {
9675 /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
9676 Some(crate::lightning::onion_message::offers::OffersMessage),
9677 /// When we're in this state, this COption_OffersMessageZ contains nothing
9680 impl COption_OffersMessageZ {
9681 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9682 if let Self::None = self { false } else { true }
9684 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9687 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
9688 if let Self::Some(v) = self { v } else { unreachable!() }
9692 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
9693 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
9694 COption_OffersMessageZ::Some(o)
9697 /// Constructs a new COption_OffersMessageZ containing nothing
9698 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
9699 COption_OffersMessageZ::None
9702 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
9703 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
9705 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
9706 /// but with all dynamically-allocated buffers duplicated in new buffers.
9707 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
9709 /// A tuple of 3 elements. See the individual fields for the types contained.
9710 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
9711 /// The element at position 0
9712 pub a: crate::lightning::onion_message::offers::OffersMessage,
9713 /// The element at position 1
9714 pub b: crate::lightning::onion_message::messenger::Destination,
9715 /// The element at position 2
9716 pub c: crate::lightning::blinded_path::BlindedPath,
9718 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
9719 fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
9727 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
9728 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
9729 (self.a, self.b, self.c)
9732 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
9733 fn clone(&self) -> Self {
9735 a: Clone::clone(&self.a),
9736 b: Clone::clone(&self.b),
9737 c: Clone::clone(&self.c),
9742 /// Creates a new tuple which has the same data as `orig`
9743 /// but with all dynamically-allocated buffers duplicated in new buffers.
9744 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
9745 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
9747 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OffersMessageDestinationBlindedPathZ {
9748 C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
9752 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
9753 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
9755 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
9756 /// This corresponds to std::vector in C++
9757 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9758 /// The elements in the array.
9759 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9760 pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
9761 /// The number of elements pointed to by `data`.
9764 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9765 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
9766 if self.datalen == 0 { return Vec::new(); }
9767 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9768 self.data = core::ptr::null_mut();
9772 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
9773 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9776 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9777 fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
9778 let datalen = v.len();
9779 let data = Box::into_raw(v.into_boxed_slice());
9780 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9784 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9785 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
9786 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9787 fn drop(&mut self) {
9788 if self.datalen == 0 { return; }
9789 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9792 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9793 fn clone(&self) -> Self {
9794 let mut res = Vec::new();
9795 if self.datalen == 0 { return Self::from(res); }
9796 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9801 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9802 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9803 /// A pointer to the contents in the success state.
9804 /// Reading from this pointer when `result_ok` is not set is undefined.
9805 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9806 /// A pointer to the contents in the error state.
9807 /// Reading from this pointer when `result_ok` is set is undefined.
9808 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9811 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9812 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9814 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9815 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9816 /// `err` or `result` depending on the state of `result_ok`.
9817 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9818 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9819 pub result_ok: bool,
9822 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9823 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9824 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9825 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9826 result: Box::into_raw(Box::new(o)),
9832 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9833 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9834 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9835 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9836 err: Box::into_raw(Box::new(e)),
9841 /// Checks if the given object is currently in the success state
9843 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9847 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9848 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9849 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9850 fn drop(&mut self) {
9852 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9853 let _ = unsafe { Box::from_raw(self.contents.result) };
9856 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9857 let _ = unsafe { Box::from_raw(self.contents.err) };
9862 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9863 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9864 let contents = if o.result_ok {
9865 let result = unsafe { o.contents.result };
9866 unsafe { o.contents.result = core::ptr::null_mut() };
9867 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9869 let err = unsafe { o.contents.err };
9870 unsafe { o.contents.err = core::ptr::null_mut(); }
9871 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9875 result_ok: o.result_ok,
9879 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9880 fn clone(&self) -> Self {
9882 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9883 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9886 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9887 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9893 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9894 /// but with all dynamically-allocated buffers duplicated in new buffers.
9895 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9897 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9898 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9899 /// A pointer to the contents in the success state.
9900 /// Reading from this pointer when `result_ok` is not set is undefined.
9901 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9902 /// A pointer to the contents in the error state.
9903 /// Reading from this pointer when `result_ok` is set is undefined.
9904 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9907 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9908 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9910 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9911 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9912 /// `err` or `result` depending on the state of `result_ok`.
9913 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9914 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9915 pub result_ok: bool,
9918 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9919 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9920 CResult_ChannelCounterpartyDecodeErrorZ {
9921 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9922 result: Box::into_raw(Box::new(o)),
9928 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9929 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9930 CResult_ChannelCounterpartyDecodeErrorZ {
9931 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9932 err: Box::into_raw(Box::new(e)),
9937 /// Checks if the given object is currently in the success state
9939 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9943 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9944 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9945 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9946 fn drop(&mut self) {
9948 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9949 let _ = unsafe { Box::from_raw(self.contents.result) };
9952 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9953 let _ = unsafe { Box::from_raw(self.contents.err) };
9958 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9959 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9960 let contents = if o.result_ok {
9961 let result = unsafe { o.contents.result };
9962 unsafe { o.contents.result = core::ptr::null_mut() };
9963 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9965 let err = unsafe { o.contents.err };
9966 unsafe { o.contents.err = core::ptr::null_mut(); }
9967 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9971 result_ok: o.result_ok,
9975 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9976 fn clone(&self) -> Self {
9978 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9979 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9982 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9983 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9989 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9990 /// but with all dynamically-allocated buffers duplicated in new buffers.
9991 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9993 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9994 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9995 /// A pointer to the contents in the success state.
9996 /// Reading from this pointer when `result_ok` is not set is undefined.
9997 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9998 /// A pointer to the contents in the error state.
9999 /// Reading from this pointer when `result_ok` is set is undefined.
10000 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10003 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
10004 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
10005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10006 pub struct CResult_ChannelDetailsDecodeErrorZ {
10007 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
10008 /// `err` or `result` depending on the state of `result_ok`.
10009 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
10010 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
10011 pub result_ok: bool,
10014 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
10015 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
10016 CResult_ChannelDetailsDecodeErrorZ {
10017 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10018 result: Box::into_raw(Box::new(o)),
10024 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
10025 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
10026 CResult_ChannelDetailsDecodeErrorZ {
10027 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10028 err: Box::into_raw(Box::new(e)),
10033 /// Checks if the given object is currently in the success state
10035 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
10039 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
10040 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
10041 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
10042 fn drop(&mut self) {
10043 if self.result_ok {
10044 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10045 let _ = unsafe { Box::from_raw(self.contents.result) };
10048 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10049 let _ = unsafe { Box::from_raw(self.contents.err) };
10054 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
10055 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
10056 let contents = if o.result_ok {
10057 let result = unsafe { o.contents.result };
10058 unsafe { o.contents.result = core::ptr::null_mut() };
10059 CResult_ChannelDetailsDecodeErrorZPtr { result }
10061 let err = unsafe { o.contents.err };
10062 unsafe { o.contents.err = core::ptr::null_mut(); }
10063 CResult_ChannelDetailsDecodeErrorZPtr { err }
10067 result_ok: o.result_ok,
10071 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
10072 fn clone(&self) -> Self {
10073 if self.result_ok {
10074 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10075 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
10078 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10079 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10085 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
10086 /// but with all dynamically-allocated buffers duplicated in new buffers.
10087 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
10089 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
10090 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
10091 /// A pointer to the contents in the success state.
10092 /// Reading from this pointer when `result_ok` is not set is undefined.
10093 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
10094 /// A pointer to the contents in the error state.
10095 /// Reading from this pointer when `result_ok` is set is undefined.
10096 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10099 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
10100 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
10101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10102 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
10103 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
10104 /// `err` or `result` depending on the state of `result_ok`.
10105 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
10106 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
10107 pub result_ok: bool,
10110 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
10111 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
10112 CResult_PhantomRouteHintsDecodeErrorZ {
10113 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10114 result: Box::into_raw(Box::new(o)),
10120 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
10121 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
10122 CResult_PhantomRouteHintsDecodeErrorZ {
10123 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10124 err: Box::into_raw(Box::new(e)),
10129 /// Checks if the given object is currently in the success state
10131 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
10135 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
10136 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
10137 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
10138 fn drop(&mut self) {
10139 if self.result_ok {
10140 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10141 let _ = unsafe { Box::from_raw(self.contents.result) };
10144 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10145 let _ = unsafe { Box::from_raw(self.contents.err) };
10150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
10151 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
10152 let contents = if o.result_ok {
10153 let result = unsafe { o.contents.result };
10154 unsafe { o.contents.result = core::ptr::null_mut() };
10155 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
10157 let err = unsafe { o.contents.err };
10158 unsafe { o.contents.err = core::ptr::null_mut(); }
10159 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
10163 result_ok: o.result_ok,
10167 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
10168 fn clone(&self) -> Self {
10169 if self.result_ok {
10170 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10171 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
10174 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10175 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10181 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
10182 /// but with all dynamically-allocated buffers duplicated in new buffers.
10183 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
10185 /// The contents of CResult_BlindedForwardDecodeErrorZ
10186 pub union CResult_BlindedForwardDecodeErrorZPtr {
10187 /// A pointer to the contents in the success state.
10188 /// Reading from this pointer when `result_ok` is not set is undefined.
10189 pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
10190 /// A pointer to the contents in the error state.
10191 /// Reading from this pointer when `result_ok` is set is undefined.
10192 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10195 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
10196 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
10197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10198 pub struct CResult_BlindedForwardDecodeErrorZ {
10199 /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
10200 /// `err` or `result` depending on the state of `result_ok`.
10201 pub contents: CResult_BlindedForwardDecodeErrorZPtr,
10202 /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
10203 pub result_ok: bool,
10206 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
10207 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
10208 CResult_BlindedForwardDecodeErrorZ {
10209 contents: CResult_BlindedForwardDecodeErrorZPtr {
10210 result: Box::into_raw(Box::new(o)),
10216 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
10217 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
10218 CResult_BlindedForwardDecodeErrorZ {
10219 contents: CResult_BlindedForwardDecodeErrorZPtr {
10220 err: Box::into_raw(Box::new(e)),
10225 /// Checks if the given object is currently in the success state
10227 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
10231 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
10232 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
10233 impl Drop for CResult_BlindedForwardDecodeErrorZ {
10234 fn drop(&mut self) {
10235 if self.result_ok {
10236 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10237 let _ = unsafe { Box::from_raw(self.contents.result) };
10240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10241 let _ = unsafe { Box::from_raw(self.contents.err) };
10246 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
10247 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
10248 let contents = if o.result_ok {
10249 let result = unsafe { o.contents.result };
10250 unsafe { o.contents.result = core::ptr::null_mut() };
10251 CResult_BlindedForwardDecodeErrorZPtr { result }
10253 let err = unsafe { o.contents.err };
10254 unsafe { o.contents.err = core::ptr::null_mut(); }
10255 CResult_BlindedForwardDecodeErrorZPtr { err }
10259 result_ok: o.result_ok,
10263 impl Clone for CResult_BlindedForwardDecodeErrorZ {
10264 fn clone(&self) -> Self {
10265 if self.result_ok {
10266 Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
10267 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
10270 Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
10271 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10277 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
10278 /// but with all dynamically-allocated buffers duplicated in new buffers.
10279 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
10281 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
10282 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
10283 /// A pointer to the contents in the success state.
10284 /// Reading from this pointer when `result_ok` is not set is undefined.
10285 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
10286 /// A pointer to the contents in the error state.
10287 /// Reading from this pointer when `result_ok` is set is undefined.
10288 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10291 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
10292 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
10293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10294 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
10295 /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
10296 /// `err` or `result` depending on the state of `result_ok`.
10297 pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
10298 /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
10299 pub result_ok: bool,
10302 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
10303 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
10304 CResult_PendingHTLCRoutingDecodeErrorZ {
10305 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10306 result: Box::into_raw(Box::new(o)),
10312 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
10313 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
10314 CResult_PendingHTLCRoutingDecodeErrorZ {
10315 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10316 err: Box::into_raw(Box::new(e)),
10321 /// Checks if the given object is currently in the success state
10323 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
10327 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
10328 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
10329 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
10330 fn drop(&mut self) {
10331 if self.result_ok {
10332 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10333 let _ = unsafe { Box::from_raw(self.contents.result) };
10336 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10337 let _ = unsafe { Box::from_raw(self.contents.err) };
10342 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
10343 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
10344 let contents = if o.result_ok {
10345 let result = unsafe { o.contents.result };
10346 unsafe { o.contents.result = core::ptr::null_mut() };
10347 CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
10349 let err = unsafe { o.contents.err };
10350 unsafe { o.contents.err = core::ptr::null_mut(); }
10351 CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
10355 result_ok: o.result_ok,
10359 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
10360 fn clone(&self) -> Self {
10361 if self.result_ok {
10362 Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10363 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
10366 Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
10367 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10373 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
10374 /// but with all dynamically-allocated buffers duplicated in new buffers.
10375 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
10377 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
10378 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
10379 /// A pointer to the contents in the success state.
10380 /// Reading from this pointer when `result_ok` is not set is undefined.
10381 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
10382 /// A pointer to the contents in the error state.
10383 /// Reading from this pointer when `result_ok` is set is undefined.
10384 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10387 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
10388 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10389 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10390 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
10391 /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
10392 /// `err` or `result` depending on the state of `result_ok`.
10393 pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
10394 /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
10395 pub result_ok: bool,
10398 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
10399 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
10400 CResult_PendingHTLCInfoDecodeErrorZ {
10401 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10402 result: Box::into_raw(Box::new(o)),
10408 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
10409 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
10410 CResult_PendingHTLCInfoDecodeErrorZ {
10411 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10412 err: Box::into_raw(Box::new(e)),
10417 /// Checks if the given object is currently in the success state
10419 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
10423 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
10424 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
10425 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
10426 fn drop(&mut self) {
10427 if self.result_ok {
10428 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10429 let _ = unsafe { Box::from_raw(self.contents.result) };
10432 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10433 let _ = unsafe { Box::from_raw(self.contents.err) };
10438 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
10439 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10440 let contents = if o.result_ok {
10441 let result = unsafe { o.contents.result };
10442 unsafe { o.contents.result = core::ptr::null_mut() };
10443 CResult_PendingHTLCInfoDecodeErrorZPtr { result }
10445 let err = unsafe { o.contents.err };
10446 unsafe { o.contents.err = core::ptr::null_mut(); }
10447 CResult_PendingHTLCInfoDecodeErrorZPtr { err }
10451 result_ok: o.result_ok,
10455 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
10456 fn clone(&self) -> Self {
10457 if self.result_ok {
10458 Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10459 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
10462 Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
10463 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10469 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
10470 /// but with all dynamically-allocated buffers duplicated in new buffers.
10471 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
10473 /// The contents of CResult_BlindedFailureDecodeErrorZ
10474 pub union CResult_BlindedFailureDecodeErrorZPtr {
10475 /// A pointer to the contents in the success state.
10476 /// Reading from this pointer when `result_ok` is not set is undefined.
10477 pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
10478 /// A pointer to the contents in the error state.
10479 /// Reading from this pointer when `result_ok` is set is undefined.
10480 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10483 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
10484 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
10485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10486 pub struct CResult_BlindedFailureDecodeErrorZ {
10487 /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
10488 /// `err` or `result` depending on the state of `result_ok`.
10489 pub contents: CResult_BlindedFailureDecodeErrorZPtr,
10490 /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
10491 pub result_ok: bool,
10494 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
10495 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
10496 CResult_BlindedFailureDecodeErrorZ {
10497 contents: CResult_BlindedFailureDecodeErrorZPtr {
10498 result: Box::into_raw(Box::new(o)),
10504 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
10505 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
10506 CResult_BlindedFailureDecodeErrorZ {
10507 contents: CResult_BlindedFailureDecodeErrorZPtr {
10508 err: Box::into_raw(Box::new(e)),
10513 /// Checks if the given object is currently in the success state
10515 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
10519 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
10520 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
10521 impl Drop for CResult_BlindedFailureDecodeErrorZ {
10522 fn drop(&mut self) {
10523 if self.result_ok {
10524 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10525 let _ = unsafe { Box::from_raw(self.contents.result) };
10528 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10529 let _ = unsafe { Box::from_raw(self.contents.err) };
10534 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
10535 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
10536 let contents = if o.result_ok {
10537 let result = unsafe { o.contents.result };
10538 unsafe { o.contents.result = core::ptr::null_mut() };
10539 CResult_BlindedFailureDecodeErrorZPtr { result }
10541 let err = unsafe { o.contents.err };
10542 unsafe { o.contents.err = core::ptr::null_mut(); }
10543 CResult_BlindedFailureDecodeErrorZPtr { err }
10547 result_ok: o.result_ok,
10551 impl Clone for CResult_BlindedFailureDecodeErrorZ {
10552 fn clone(&self) -> Self {
10553 if self.result_ok {
10554 Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
10555 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
10558 Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
10559 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10565 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
10566 /// but with all dynamically-allocated buffers duplicated in new buffers.
10567 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
10569 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
10570 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
10571 /// A pointer to the contents in the success state.
10572 /// Reading from this pointer when `result_ok` is not set is undefined.
10573 pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
10574 /// A pointer to the contents in the error state.
10575 /// Reading from this pointer when `result_ok` is set is undefined.
10576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10579 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
10580 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
10581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10582 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
10583 /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
10584 /// `err` or `result` depending on the state of `result_ok`.
10585 pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
10586 /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
10587 pub result_ok: bool,
10590 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
10591 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
10592 CResult_ChannelShutdownStateDecodeErrorZ {
10593 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10594 result: Box::into_raw(Box::new(o)),
10600 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
10601 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
10602 CResult_ChannelShutdownStateDecodeErrorZ {
10603 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10604 err: Box::into_raw(Box::new(e)),
10609 /// Checks if the given object is currently in the success state
10611 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
10615 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
10616 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
10617 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
10618 fn drop(&mut self) {
10619 if self.result_ok {
10620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10621 let _ = unsafe { Box::from_raw(self.contents.result) };
10624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10625 let _ = unsafe { Box::from_raw(self.contents.err) };
10630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
10631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
10632 let contents = if o.result_ok {
10633 let result = unsafe { o.contents.result };
10634 unsafe { o.contents.result = core::ptr::null_mut() };
10635 CResult_ChannelShutdownStateDecodeErrorZPtr { result }
10637 let err = unsafe { o.contents.err };
10638 unsafe { o.contents.err = core::ptr::null_mut(); }
10639 CResult_ChannelShutdownStateDecodeErrorZPtr { err }
10643 result_ok: o.result_ok,
10647 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
10648 fn clone(&self) -> Self {
10649 if self.result_ok {
10650 Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10651 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
10654 Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
10655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10661 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
10662 /// but with all dynamically-allocated buffers duplicated in new buffers.
10663 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
10665 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10666 /// This corresponds to std::vector in C++
10667 pub struct CVec_ChannelMonitorZ {
10668 /// The elements in the array.
10669 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10670 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10671 /// The number of elements pointed to by `data`.
10674 impl CVec_ChannelMonitorZ {
10675 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10676 if self.datalen == 0 { return Vec::new(); }
10677 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10678 self.data = core::ptr::null_mut();
10682 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10683 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10686 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10687 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10688 let datalen = v.len();
10689 let data = Box::into_raw(v.into_boxed_slice());
10690 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10694 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10695 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10696 impl Drop for CVec_ChannelMonitorZ {
10697 fn drop(&mut self) {
10698 if self.datalen == 0 { return; }
10699 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10702 impl Clone for CVec_ChannelMonitorZ {
10703 fn clone(&self) -> Self {
10704 let mut res = Vec::new();
10705 if self.datalen == 0 { return Self::from(res); }
10706 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10711 /// A tuple of 2 elements. See the individual fields for the types contained.
10712 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
10713 /// The element at position 0
10714 pub a: crate::c_types::ThirtyTwoBytes,
10715 /// The element at position 1
10716 pub b: crate::lightning::ln::channelmanager::ChannelManager,
10718 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
10719 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10726 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
10727 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10731 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
10733 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
10734 C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
10738 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
10739 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
10741 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
10742 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10743 /// A pointer to the contents in the success state.
10744 /// Reading from this pointer when `result_ok` is not set is undefined.
10745 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
10746 /// A pointer to the contents in the error state.
10747 /// Reading from this pointer when `result_ok` is set is undefined.
10748 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10751 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10752 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10754 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10755 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
10756 /// `err` or `result` depending on the state of `result_ok`.
10757 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
10758 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
10759 pub result_ok: bool,
10762 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
10763 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10764 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10765 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10766 result: Box::into_raw(Box::new(o)),
10772 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
10773 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10774 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10775 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10776 err: Box::into_raw(Box::new(e)),
10781 /// Checks if the given object is currently in the success state
10783 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
10787 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
10788 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
10789 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10790 fn drop(&mut self) {
10791 if self.result_ok {
10792 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10793 let _ = unsafe { Box::from_raw(self.contents.result) };
10796 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10797 let _ = unsafe { Box::from_raw(self.contents.err) };
10802 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10803 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10804 let contents = if o.result_ok {
10805 let result = unsafe { o.contents.result };
10806 unsafe { o.contents.result = core::ptr::null_mut() };
10807 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
10809 let err = unsafe { o.contents.err };
10810 unsafe { o.contents.err = core::ptr::null_mut(); }
10811 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
10815 result_ok: o.result_ok,
10820 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
10821 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10822 /// A pointer to the contents in the success state.
10823 /// Reading from this pointer when `result_ok` is not set is undefined.
10824 pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
10825 /// A pointer to the contents in the error state.
10826 /// Reading from this pointer when `result_ok` is set is undefined.
10827 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10830 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
10831 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
10832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10833 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
10834 /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
10835 /// `err` or `result` depending on the state of `result_ok`.
10836 pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
10837 /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
10838 pub result_ok: bool,
10841 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
10842 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10843 CResult_MaxDustHTLCExposureDecodeErrorZ {
10844 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10845 result: Box::into_raw(Box::new(o)),
10851 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
10852 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10853 CResult_MaxDustHTLCExposureDecodeErrorZ {
10854 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10855 err: Box::into_raw(Box::new(e)),
10860 /// Checks if the given object is currently in the success state
10862 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
10866 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
10867 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
10868 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
10869 fn drop(&mut self) {
10870 if self.result_ok {
10871 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10872 let _ = unsafe { Box::from_raw(self.contents.result) };
10875 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10876 let _ = unsafe { Box::from_raw(self.contents.err) };
10881 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
10882 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
10883 let contents = if o.result_ok {
10884 let result = unsafe { o.contents.result };
10885 unsafe { o.contents.result = core::ptr::null_mut() };
10886 CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
10888 let err = unsafe { o.contents.err };
10889 unsafe { o.contents.err = core::ptr::null_mut(); }
10890 CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
10894 result_ok: o.result_ok,
10898 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
10899 fn clone(&self) -> Self {
10900 if self.result_ok {
10901 Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10902 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
10905 Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10906 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10912 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
10913 /// but with all dynamically-allocated buffers duplicated in new buffers.
10914 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
10916 /// The contents of CResult_ChannelConfigDecodeErrorZ
10917 pub union CResult_ChannelConfigDecodeErrorZPtr {
10918 /// A pointer to the contents in the success state.
10919 /// Reading from this pointer when `result_ok` is not set is undefined.
10920 pub result: *mut crate::lightning::util::config::ChannelConfig,
10921 /// A pointer to the contents in the error state.
10922 /// Reading from this pointer when `result_ok` is set is undefined.
10923 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10926 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10927 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10929 pub struct CResult_ChannelConfigDecodeErrorZ {
10930 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10931 /// `err` or `result` depending on the state of `result_ok`.
10932 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10933 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10934 pub result_ok: bool,
10937 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10938 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10939 CResult_ChannelConfigDecodeErrorZ {
10940 contents: CResult_ChannelConfigDecodeErrorZPtr {
10941 result: Box::into_raw(Box::new(o)),
10947 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10948 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10949 CResult_ChannelConfigDecodeErrorZ {
10950 contents: CResult_ChannelConfigDecodeErrorZPtr {
10951 err: Box::into_raw(Box::new(e)),
10956 /// Checks if the given object is currently in the success state
10958 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10962 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10963 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10964 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10965 fn drop(&mut self) {
10966 if self.result_ok {
10967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10968 let _ = unsafe { Box::from_raw(self.contents.result) };
10971 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10972 let _ = unsafe { Box::from_raw(self.contents.err) };
10977 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10978 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10979 let contents = if o.result_ok {
10980 let result = unsafe { o.contents.result };
10981 unsafe { o.contents.result = core::ptr::null_mut() };
10982 CResult_ChannelConfigDecodeErrorZPtr { result }
10984 let err = unsafe { o.contents.err };
10985 unsafe { o.contents.err = core::ptr::null_mut(); }
10986 CResult_ChannelConfigDecodeErrorZPtr { err }
10990 result_ok: o.result_ok,
10994 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10995 fn clone(&self) -> Self {
10996 if self.result_ok {
10997 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10998 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
11001 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
11002 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11008 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
11009 /// but with all dynamically-allocated buffers duplicated in new buffers.
11010 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
11013 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
11014 pub enum COption_MaxDustHTLCExposureZ {
11015 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
11016 Some(crate::lightning::util::config::MaxDustHTLCExposure),
11017 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
11020 impl COption_MaxDustHTLCExposureZ {
11021 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11022 if let Self::None = self { false } else { true }
11024 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11027 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
11028 if let Self::Some(v) = self { v } else { unreachable!() }
11032 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
11033 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
11034 COption_MaxDustHTLCExposureZ::Some(o)
11037 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
11038 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
11039 COption_MaxDustHTLCExposureZ::None
11042 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
11043 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
11045 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
11046 /// but with all dynamically-allocated buffers duplicated in new buffers.
11047 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
11050 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
11051 pub enum COption_APIErrorZ {
11052 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
11053 Some(crate::lightning::util::errors::APIError),
11054 /// When we're in this state, this COption_APIErrorZ contains nothing
11057 impl COption_APIErrorZ {
11058 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11059 if let Self::None = self { false } else { true }
11061 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11064 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
11065 if let Self::Some(v) = self { v } else { unreachable!() }
11069 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
11070 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
11071 COption_APIErrorZ::Some(o)
11074 /// Constructs a new COption_APIErrorZ containing nothing
11075 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
11076 COption_APIErrorZ::None
11079 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
11080 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
11082 /// Creates a new COption_APIErrorZ which has the same data as `orig`
11083 /// but with all dynamically-allocated buffers duplicated in new buffers.
11084 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
11086 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
11087 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
11088 /// A pointer to the contents in the success state.
11089 /// Reading from this pointer when `result_ok` is not set is undefined.
11090 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
11091 /// A pointer to the contents in the error state.
11092 /// Reading from this pointer when `result_ok` is set is undefined.
11093 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11096 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
11097 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11099 pub struct CResult_COption_APIErrorZDecodeErrorZ {
11100 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
11101 /// `err` or `result` depending on the state of `result_ok`.
11102 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
11103 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
11104 pub result_ok: bool,
11107 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
11108 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
11109 CResult_COption_APIErrorZDecodeErrorZ {
11110 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11111 result: Box::into_raw(Box::new(o)),
11117 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
11118 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
11119 CResult_COption_APIErrorZDecodeErrorZ {
11120 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11121 err: Box::into_raw(Box::new(e)),
11126 /// Checks if the given object is currently in the success state
11128 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
11132 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
11133 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
11134 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
11135 fn drop(&mut self) {
11136 if self.result_ok {
11137 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11138 let _ = unsafe { Box::from_raw(self.contents.result) };
11141 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11142 let _ = unsafe { Box::from_raw(self.contents.err) };
11147 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
11148 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11149 let contents = if o.result_ok {
11150 let result = unsafe { o.contents.result };
11151 unsafe { o.contents.result = core::ptr::null_mut() };
11152 CResult_COption_APIErrorZDecodeErrorZPtr { result }
11154 let err = unsafe { o.contents.err };
11155 unsafe { o.contents.err = core::ptr::null_mut(); }
11156 CResult_COption_APIErrorZDecodeErrorZPtr { err }
11160 result_ok: o.result_ok,
11164 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
11165 fn clone(&self) -> Self {
11166 if self.result_ok {
11167 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11168 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
11171 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11172 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11178 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
11179 /// but with all dynamically-allocated buffers duplicated in new buffers.
11180 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
11182 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11183 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11184 /// A pointer to the contents in the success state.
11185 /// Reading from this pointer when `result_ok` is not set is undefined.
11186 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11187 /// A pointer to the contents in the error state.
11188 /// Reading from this pointer when `result_ok` is set is undefined.
11189 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11192 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11193 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11194 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11195 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11196 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11197 /// `err` or `result` depending on the state of `result_ok`.
11198 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11199 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11200 pub result_ok: bool,
11203 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11204 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11205 CResult_ChannelMonitorUpdateDecodeErrorZ {
11206 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11207 result: Box::into_raw(Box::new(o)),
11213 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11214 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11215 CResult_ChannelMonitorUpdateDecodeErrorZ {
11216 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11217 err: Box::into_raw(Box::new(e)),
11222 /// Checks if the given object is currently in the success state
11224 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11228 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11229 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11230 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11231 fn drop(&mut self) {
11232 if self.result_ok {
11233 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11234 let _ = unsafe { Box::from_raw(self.contents.result) };
11237 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11238 let _ = unsafe { Box::from_raw(self.contents.err) };
11243 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11244 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11245 let contents = if o.result_ok {
11246 let result = unsafe { o.contents.result };
11247 unsafe { o.contents.result = core::ptr::null_mut() };
11248 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11250 let err = unsafe { o.contents.err };
11251 unsafe { o.contents.err = core::ptr::null_mut(); }
11252 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11256 result_ok: o.result_ok,
11260 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11261 fn clone(&self) -> Self {
11262 if self.result_ok {
11263 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11264 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11267 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11268 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11274 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11275 /// but with all dynamically-allocated buffers duplicated in new buffers.
11276 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11279 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11280 pub enum COption_MonitorEventZ {
11281 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11282 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11283 /// When we're in this state, this COption_MonitorEventZ contains nothing
11286 impl COption_MonitorEventZ {
11287 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11288 if let Self::None = self { false } else { true }
11290 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11293 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11294 if let Self::Some(v) = self { v } else { unreachable!() }
11298 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11299 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11300 COption_MonitorEventZ::Some(o)
11303 /// Constructs a new COption_MonitorEventZ containing nothing
11304 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11305 COption_MonitorEventZ::None
11308 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11309 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11311 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11312 /// but with all dynamically-allocated buffers duplicated in new buffers.
11313 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11315 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11316 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11317 /// A pointer to the contents in the success state.
11318 /// Reading from this pointer when `result_ok` is not set is undefined.
11319 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11320 /// A pointer to the contents in the error state.
11321 /// Reading from this pointer when `result_ok` is set is undefined.
11322 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11325 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11326 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11328 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11329 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11330 /// `err` or `result` depending on the state of `result_ok`.
11331 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11332 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11333 pub result_ok: bool,
11336 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11337 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11338 CResult_COption_MonitorEventZDecodeErrorZ {
11339 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11340 result: Box::into_raw(Box::new(o)),
11346 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11347 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11348 CResult_COption_MonitorEventZDecodeErrorZ {
11349 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11350 err: Box::into_raw(Box::new(e)),
11355 /// Checks if the given object is currently in the success state
11357 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11361 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11362 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11363 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11364 fn drop(&mut self) {
11365 if self.result_ok {
11366 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11367 let _ = unsafe { Box::from_raw(self.contents.result) };
11370 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11371 let _ = unsafe { Box::from_raw(self.contents.err) };
11376 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11377 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11378 let contents = if o.result_ok {
11379 let result = unsafe { o.contents.result };
11380 unsafe { o.contents.result = core::ptr::null_mut() };
11381 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11383 let err = unsafe { o.contents.err };
11384 unsafe { o.contents.err = core::ptr::null_mut(); }
11385 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11389 result_ok: o.result_ok,
11393 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11394 fn clone(&self) -> Self {
11395 if self.result_ok {
11396 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11397 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11400 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11401 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11407 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11408 /// but with all dynamically-allocated buffers duplicated in new buffers.
11409 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11411 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11412 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11413 /// A pointer to the contents in the success state.
11414 /// Reading from this pointer when `result_ok` is not set is undefined.
11415 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11416 /// A pointer to the contents in the error state.
11417 /// Reading from this pointer when `result_ok` is set is undefined.
11418 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11421 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11422 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11424 pub struct CResult_HTLCUpdateDecodeErrorZ {
11425 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11426 /// `err` or `result` depending on the state of `result_ok`.
11427 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11428 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11429 pub result_ok: bool,
11432 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11433 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11434 CResult_HTLCUpdateDecodeErrorZ {
11435 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11436 result: Box::into_raw(Box::new(o)),
11442 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11443 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11444 CResult_HTLCUpdateDecodeErrorZ {
11445 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11446 err: Box::into_raw(Box::new(e)),
11451 /// Checks if the given object is currently in the success state
11453 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11457 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11458 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11459 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11460 fn drop(&mut self) {
11461 if self.result_ok {
11462 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11463 let _ = unsafe { Box::from_raw(self.contents.result) };
11466 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11467 let _ = unsafe { Box::from_raw(self.contents.err) };
11472 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11473 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11474 let contents = if o.result_ok {
11475 let result = unsafe { o.contents.result };
11476 unsafe { o.contents.result = core::ptr::null_mut() };
11477 CResult_HTLCUpdateDecodeErrorZPtr { result }
11479 let err = unsafe { o.contents.err };
11480 unsafe { o.contents.err = core::ptr::null_mut(); }
11481 CResult_HTLCUpdateDecodeErrorZPtr { err }
11485 result_ok: o.result_ok,
11489 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11490 fn clone(&self) -> Self {
11491 if self.result_ok {
11492 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11493 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11496 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11497 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11503 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11504 /// but with all dynamically-allocated buffers duplicated in new buffers.
11505 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11507 /// A tuple of 2 elements. See the individual fields for the types contained.
11508 pub struct C2Tuple_OutPointCVec_u8ZZ {
11509 /// The element at position 0
11510 pub a: crate::lightning::chain::transaction::OutPoint,
11511 /// The element at position 1
11512 pub b: crate::c_types::derived::CVec_u8Z,
11514 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
11515 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11522 impl C2Tuple_OutPointCVec_u8ZZ {
11523 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11527 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
11528 fn clone(&self) -> Self {
11530 a: Clone::clone(&self.a),
11531 b: Clone::clone(&self.b),
11536 /// Creates a new tuple which has the same data as `orig`
11537 /// but with all dynamically-allocated buffers duplicated in new buffers.
11538 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
11539 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
11541 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
11542 C2Tuple_OutPointCVec_u8ZZ { a, b, }
11546 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
11547 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
11549 /// A tuple of 2 elements. See the individual fields for the types contained.
11550 pub struct C2Tuple_u32CVec_u8ZZ {
11551 /// The element at position 0
11553 /// The element at position 1
11554 pub b: crate::c_types::derived::CVec_u8Z,
11556 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
11557 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11564 impl C2Tuple_u32CVec_u8ZZ {
11565 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11569 impl Clone for C2Tuple_u32CVec_u8ZZ {
11570 fn clone(&self) -> Self {
11572 a: Clone::clone(&self.a),
11573 b: Clone::clone(&self.b),
11578 /// Creates a new tuple which has the same data as `orig`
11579 /// but with all dynamically-allocated buffers duplicated in new buffers.
11580 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
11581 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
11583 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
11584 C2Tuple_u32CVec_u8ZZ { a, b, }
11588 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
11589 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
11591 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
11592 /// This corresponds to std::vector in C++
11593 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
11594 /// The elements in the array.
11595 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11596 pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
11597 /// The number of elements pointed to by `data`.
11600 impl CVec_C2Tuple_u32CVec_u8ZZZ {
11601 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
11602 if self.datalen == 0 { return Vec::new(); }
11603 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11604 self.data = core::ptr::null_mut();
11608 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
11609 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11612 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
11613 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
11614 let datalen = v.len();
11615 let data = Box::into_raw(v.into_boxed_slice());
11616 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11620 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11621 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
11622 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
11623 fn drop(&mut self) {
11624 if self.datalen == 0 { return; }
11625 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11628 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
11629 fn clone(&self) -> Self {
11630 let mut res = Vec::new();
11631 if self.datalen == 0 { return Self::from(res); }
11632 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11637 /// A tuple of 2 elements. See the individual fields for the types contained.
11638 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11639 /// The element at position 0
11640 pub a: crate::c_types::ThirtyTwoBytes,
11641 /// The element at position 1
11642 pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
11644 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11645 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
11652 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11653 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
11657 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11658 fn clone(&self) -> Self {
11660 a: Clone::clone(&self.a),
11661 b: Clone::clone(&self.b),
11666 /// Creates a new tuple which has the same data as `orig`
11667 /// but with all dynamically-allocated buffers duplicated in new buffers.
11668 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
11669 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
11671 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
11672 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
11676 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
11677 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
11679 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
11680 /// This corresponds to std::vector in C++
11681 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11682 /// The elements in the array.
11683 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11684 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
11685 /// The number of elements pointed to by `data`.
11688 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11689 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
11690 if self.datalen == 0 { return Vec::new(); }
11691 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11692 self.data = core::ptr::null_mut();
11696 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
11697 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11700 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11701 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
11702 let datalen = v.len();
11703 let data = Box::into_raw(v.into_boxed_slice());
11704 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11708 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11709 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
11710 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11711 fn drop(&mut self) {
11712 if self.datalen == 0 { return; }
11713 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11716 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11717 fn clone(&self) -> Self {
11718 let mut res = Vec::new();
11719 if self.datalen == 0 { return Self::from(res); }
11720 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11725 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
11726 /// This corresponds to std::vector in C++
11727 pub struct CVec_CommitmentTransactionZ {
11728 /// The elements in the array.
11729 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11730 pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
11731 /// The number of elements pointed to by `data`.
11734 impl CVec_CommitmentTransactionZ {
11735 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
11736 if self.datalen == 0 { return Vec::new(); }
11737 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11738 self.data = core::ptr::null_mut();
11742 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
11743 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11746 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
11747 fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
11748 let datalen = v.len();
11749 let data = Box::into_raw(v.into_boxed_slice());
11750 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11754 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11755 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
11756 impl Drop for CVec_CommitmentTransactionZ {
11757 fn drop(&mut self) {
11758 if self.datalen == 0 { return; }
11759 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11762 impl Clone for CVec_CommitmentTransactionZ {
11763 fn clone(&self) -> Self {
11764 let mut res = Vec::new();
11765 if self.datalen == 0 { return Self::from(res); }
11766 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11771 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11772 /// This corresponds to std::vector in C++
11773 pub struct CVec_TransactionZ {
11774 /// The elements in the array.
11775 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11776 pub data: *mut crate::c_types::Transaction,
11777 /// The number of elements pointed to by `data`.
11780 impl CVec_TransactionZ {
11781 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11782 if self.datalen == 0 { return Vec::new(); }
11783 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11784 self.data = core::ptr::null_mut();
11788 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11789 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11792 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11793 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11794 let datalen = v.len();
11795 let data = Box::into_raw(v.into_boxed_slice());
11796 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11800 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11801 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11802 impl Drop for CVec_TransactionZ {
11803 fn drop(&mut self) {
11804 if self.datalen == 0 { return; }
11805 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11808 impl Clone for CVec_TransactionZ {
11809 fn clone(&self) -> Self {
11810 let mut res = Vec::new();
11811 if self.datalen == 0 { return Self::from(res); }
11812 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11817 /// A tuple of 2 elements. See the individual fields for the types contained.
11818 pub struct C2Tuple_u32TxOutZ {
11819 /// The element at position 0
11821 /// The element at position 1
11822 pub b: crate::c_types::TxOut,
11824 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11825 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11832 impl C2Tuple_u32TxOutZ {
11833 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11837 impl Clone for C2Tuple_u32TxOutZ {
11838 fn clone(&self) -> Self {
11840 a: Clone::clone(&self.a),
11841 b: Clone::clone(&self.b),
11846 /// Creates a new tuple which has the same data as `orig`
11847 /// but with all dynamically-allocated buffers duplicated in new buffers.
11848 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11849 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11851 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11852 C2Tuple_u32TxOutZ { a, b, }
11856 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11857 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11859 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11860 /// This corresponds to std::vector in C++
11861 pub struct CVec_C2Tuple_u32TxOutZZ {
11862 /// The elements in the array.
11863 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11864 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11865 /// The number of elements pointed to by `data`.
11868 impl CVec_C2Tuple_u32TxOutZZ {
11869 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11870 if self.datalen == 0 { return Vec::new(); }
11871 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11872 self.data = core::ptr::null_mut();
11876 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11877 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11880 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11881 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11882 let datalen = v.len();
11883 let data = Box::into_raw(v.into_boxed_slice());
11884 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11888 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11889 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11890 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11891 fn drop(&mut self) {
11892 if self.datalen == 0 { return; }
11893 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11896 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11897 fn clone(&self) -> Self {
11898 let mut res = Vec::new();
11899 if self.datalen == 0 { return Self::from(res); }
11900 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11905 /// A tuple of 2 elements. See the individual fields for the types contained.
11906 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11907 /// The element at position 0
11908 pub a: crate::c_types::ThirtyTwoBytes,
11909 /// The element at position 1
11910 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11912 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11913 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11920 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11921 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11925 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11926 fn clone(&self) -> Self {
11928 a: Clone::clone(&self.a),
11929 b: Clone::clone(&self.b),
11934 /// Creates a new tuple which has the same data as `orig`
11935 /// but with all dynamically-allocated buffers duplicated in new buffers.
11936 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11937 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11939 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11940 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
11944 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
11945 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
11947 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11948 /// This corresponds to std::vector in C++
11949 pub struct CVec_TransactionOutputsZ {
11950 /// The elements in the array.
11951 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11952 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
11953 /// The number of elements pointed to by `data`.
11956 impl CVec_TransactionOutputsZ {
11957 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
11958 if self.datalen == 0 { return Vec::new(); }
11959 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11960 self.data = core::ptr::null_mut();
11964 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
11965 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11968 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11969 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11970 let datalen = v.len();
11971 let data = Box::into_raw(v.into_boxed_slice());
11972 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11976 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11977 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11978 impl Drop for CVec_TransactionOutputsZ {
11979 fn drop(&mut self) {
11980 if self.datalen == 0 { return; }
11981 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11984 impl Clone for CVec_TransactionOutputsZ {
11985 fn clone(&self) -> Self {
11986 let mut res = Vec::new();
11987 if self.datalen == 0 { return Self::from(res); }
11988 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11993 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11994 /// This corresponds to std::vector in C++
11995 pub struct CVec_BalanceZ {
11996 /// The elements in the array.
11997 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11998 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11999 /// The number of elements pointed to by `data`.
12002 impl CVec_BalanceZ {
12003 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12004 if self.datalen == 0 { return Vec::new(); }
12005 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12006 self.data = core::ptr::null_mut();
12010 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12011 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12014 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12015 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12016 let datalen = v.len();
12017 let data = Box::into_raw(v.into_boxed_slice());
12018 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12022 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12023 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12024 impl Drop for CVec_BalanceZ {
12025 fn drop(&mut self) {
12026 if self.datalen == 0 { return; }
12027 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12030 impl Clone for CVec_BalanceZ {
12031 fn clone(&self) -> Self {
12032 let mut res = Vec::new();
12033 if self.datalen == 0 { return Self::from(res); }
12034 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12039 /// A tuple of 2 elements. See the individual fields for the types contained.
12040 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12041 /// The element at position 0
12042 pub a: crate::c_types::ThirtyTwoBytes,
12043 /// The element at position 1
12044 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
12046 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12047 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
12054 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12055 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
12059 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12060 fn clone(&self) -> Self {
12062 a: Clone::clone(&self.a),
12063 b: Clone::clone(&self.b),
12068 /// Creates a new tuple which has the same data as `orig`
12069 /// but with all dynamically-allocated buffers duplicated in new buffers.
12070 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
12071 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
12073 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12074 C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
12078 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
12079 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
12081 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
12082 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12083 /// A pointer to the contents in the success state.
12084 /// Reading from this pointer when `result_ok` is not set is undefined.
12085 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12086 /// A pointer to the contents in the error state.
12087 /// Reading from this pointer when `result_ok` is set is undefined.
12088 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12091 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12092 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12094 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12095 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
12096 /// `err` or `result` depending on the state of `result_ok`.
12097 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
12098 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
12099 pub result_ok: bool,
12102 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
12103 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12104 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12105 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12106 result: Box::into_raw(Box::new(o)),
12112 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
12113 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12114 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12115 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12116 err: Box::into_raw(Box::new(e)),
12121 /// Checks if the given object is currently in the success state
12123 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
12127 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
12128 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
12129 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12130 fn drop(&mut self) {
12131 if self.result_ok {
12132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12133 let _ = unsafe { Box::from_raw(self.contents.result) };
12136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12137 let _ = unsafe { Box::from_raw(self.contents.err) };
12142 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12143 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12144 let contents = if o.result_ok {
12145 let result = unsafe { o.contents.result };
12146 unsafe { o.contents.result = core::ptr::null_mut() };
12147 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
12149 let err = unsafe { o.contents.err };
12150 unsafe { o.contents.err = core::ptr::null_mut(); }
12151 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
12155 result_ok: o.result_ok,
12159 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12160 fn clone(&self) -> Self {
12161 if self.result_ok {
12162 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12163 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12166 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12167 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12173 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
12174 /// but with all dynamically-allocated buffers duplicated in new buffers.
12175 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
12177 /// A tuple of 2 elements. See the individual fields for the types contained.
12178 pub struct C2Tuple_PublicKeyTypeZ {
12179 /// The element at position 0
12180 pub a: crate::c_types::PublicKey,
12181 /// The element at position 1
12182 pub b: crate::lightning::ln::wire::Type,
12184 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12185 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12192 impl C2Tuple_PublicKeyTypeZ {
12193 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12197 impl Clone for C2Tuple_PublicKeyTypeZ {
12198 fn clone(&self) -> Self {
12200 a: Clone::clone(&self.a),
12201 b: Clone::clone(&self.b),
12206 /// Creates a new tuple which has the same data as `orig`
12207 /// but with all dynamically-allocated buffers duplicated in new buffers.
12208 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
12209 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12211 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12212 C2Tuple_PublicKeyTypeZ { a, b, }
12216 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12217 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12219 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12220 /// This corresponds to std::vector in C++
12221 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12222 /// The elements in the array.
12223 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12224 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12225 /// The number of elements pointed to by `data`.
12228 impl CVec_C2Tuple_PublicKeyTypeZZ {
12229 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12230 if self.datalen == 0 { return Vec::new(); }
12231 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12232 self.data = core::ptr::null_mut();
12236 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12237 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12240 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12241 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12242 let datalen = v.len();
12243 let data = Box::into_raw(v.into_boxed_slice());
12244 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12248 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12249 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12250 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12251 fn drop(&mut self) {
12252 if self.datalen == 0 { return; }
12253 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12256 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
12257 fn clone(&self) -> Self {
12258 let mut res = Vec::new();
12259 if self.datalen == 0 { return Self::from(res); }
12260 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12265 /// A tuple of 2 elements. See the individual fields for the types contained.
12266 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
12267 /// The element at position 0
12268 pub a: crate::c_types::PublicKey,
12269 /// The element at position 1
12270 pub b: crate::c_types::derived::CVec_SocketAddressZ,
12272 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
12273 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
12280 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
12281 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
12285 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
12286 fn clone(&self) -> Self {
12288 a: Clone::clone(&self.a),
12289 b: Clone::clone(&self.b),
12294 /// Creates a new tuple which has the same data as `orig`
12295 /// but with all dynamically-allocated buffers duplicated in new buffers.
12296 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
12297 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
12299 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
12300 C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
12304 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
12305 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
12307 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
12308 /// This corresponds to std::vector in C++
12309 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12310 /// The elements in the array.
12311 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12312 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
12313 /// The number of elements pointed to by `data`.
12316 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12317 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
12318 if self.datalen == 0 { return Vec::new(); }
12319 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12320 self.data = core::ptr::null_mut();
12324 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
12325 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12328 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12329 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
12330 let datalen = v.len();
12331 let data = Box::into_raw(v.into_boxed_slice());
12332 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12336 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12337 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
12338 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12339 fn drop(&mut self) {
12340 if self.datalen == 0 { return; }
12341 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12344 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
12345 fn clone(&self) -> Self {
12346 let mut res = Vec::new();
12347 if self.datalen == 0 { return Self::from(res); }
12348 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12354 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
12355 pub enum COption_OnionMessageContentsZ {
12356 /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
12357 Some(crate::lightning::onion_message::packet::OnionMessageContents),
12358 /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
12361 impl COption_OnionMessageContentsZ {
12362 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12363 if let Self::None = self { false } else { true }
12365 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12368 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
12369 if let Self::Some(v) = self { v } else { unreachable!() }
12373 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
12374 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
12375 COption_OnionMessageContentsZ::Some(o)
12378 /// Constructs a new COption_OnionMessageContentsZ containing nothing
12379 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
12380 COption_OnionMessageContentsZ::None
12383 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
12384 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
12386 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
12387 /// but with all dynamically-allocated buffers duplicated in new buffers.
12388 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
12390 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
12391 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12392 /// A pointer to the contents in the success state.
12393 /// Reading from this pointer when `result_ok` is not set is undefined.
12394 pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
12395 /// A pointer to the contents in the error state.
12396 /// Reading from this pointer when `result_ok` is set is undefined.
12397 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12400 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12401 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12402 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12403 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
12404 /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
12405 /// `err` or `result` depending on the state of `result_ok`.
12406 pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
12407 /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
12408 pub result_ok: bool,
12411 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
12412 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
12413 CResult_COption_OnionMessageContentsZDecodeErrorZ {
12414 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12415 result: Box::into_raw(Box::new(o)),
12421 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
12422 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
12423 CResult_COption_OnionMessageContentsZDecodeErrorZ {
12424 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12425 err: Box::into_raw(Box::new(e)),
12430 /// Checks if the given object is currently in the success state
12432 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
12436 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
12437 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
12438 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
12439 fn drop(&mut self) {
12440 if self.result_ok {
12441 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12442 let _ = unsafe { Box::from_raw(self.contents.result) };
12445 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12446 let _ = unsafe { Box::from_raw(self.contents.err) };
12451 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
12452 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12453 let contents = if o.result_ok {
12454 let result = unsafe { o.contents.result };
12455 unsafe { o.contents.result = core::ptr::null_mut() };
12456 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
12458 let err = unsafe { o.contents.err };
12459 unsafe { o.contents.err = core::ptr::null_mut(); }
12460 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
12464 result_ok: o.result_ok,
12468 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
12469 fn clone(&self) -> Self {
12470 if self.result_ok {
12471 Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12472 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
12475 Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
12476 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12482 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
12483 /// but with all dynamically-allocated buffers duplicated in new buffers.
12484 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
12486 /// A tuple of 3 elements. See the individual fields for the types contained.
12487 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12488 /// The element at position 0
12489 pub a: crate::lightning::onion_message::packet::OnionMessageContents,
12490 /// The element at position 1
12491 pub b: crate::lightning::onion_message::messenger::Destination,
12492 /// The element at position 2
12493 pub c: crate::lightning::blinded_path::BlindedPath,
12495 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12496 fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
12504 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12505 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
12506 (self.a, self.b, self.c)
12509 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12510 fn clone(&self) -> Self {
12512 a: Clone::clone(&self.a),
12513 b: Clone::clone(&self.b),
12514 c: Clone::clone(&self.c),
12519 /// Creates a new tuple which has the same data as `orig`
12520 /// but with all dynamically-allocated buffers duplicated in new buffers.
12521 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
12522 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
12524 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
12525 C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
12529 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
12530 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
12532 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
12533 /// This corresponds to std::vector in C++
12534 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12535 /// The elements in the array.
12536 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12537 pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
12538 /// The number of elements pointed to by `data`.
12541 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12542 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
12543 if self.datalen == 0 { return Vec::new(); }
12544 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12545 self.data = core::ptr::null_mut();
12549 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
12550 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12553 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12554 fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
12555 let datalen = v.len();
12556 let data = Box::into_raw(v.into_boxed_slice());
12557 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12561 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12562 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
12563 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12564 fn drop(&mut self) {
12565 if self.datalen == 0 { return; }
12566 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12569 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
12570 fn clone(&self) -> Self {
12571 let mut res = Vec::new();
12572 if self.datalen == 0 { return Self::from(res); }
12573 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12579 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
12580 pub enum COption_TypeZ {
12581 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
12582 Some(crate::lightning::ln::wire::Type),
12583 /// When we're in this state, this COption_TypeZ contains nothing
12586 impl COption_TypeZ {
12587 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12588 if let Self::None = self { false } else { true }
12590 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12593 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
12594 if let Self::Some(v) = self { v } else { unreachable!() }
12598 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
12599 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
12600 COption_TypeZ::Some(o)
12603 /// Constructs a new COption_TypeZ containing nothing
12604 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
12605 COption_TypeZ::None
12608 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
12609 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
12611 /// Creates a new COption_TypeZ which has the same data as `orig`
12612 /// but with all dynamically-allocated buffers duplicated in new buffers.
12613 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
12615 /// The contents of CResult_COption_TypeZDecodeErrorZ
12616 pub union CResult_COption_TypeZDecodeErrorZPtr {
12617 /// A pointer to the contents in the success state.
12618 /// Reading from this pointer when `result_ok` is not set is undefined.
12619 pub result: *mut crate::c_types::derived::COption_TypeZ,
12620 /// A pointer to the contents in the error state.
12621 /// Reading from this pointer when `result_ok` is set is undefined.
12622 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12625 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
12626 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12628 pub struct CResult_COption_TypeZDecodeErrorZ {
12629 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
12630 /// `err` or `result` depending on the state of `result_ok`.
12631 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
12632 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
12633 pub result_ok: bool,
12636 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
12637 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
12638 CResult_COption_TypeZDecodeErrorZ {
12639 contents: CResult_COption_TypeZDecodeErrorZPtr {
12640 result: Box::into_raw(Box::new(o)),
12646 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
12647 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
12648 CResult_COption_TypeZDecodeErrorZ {
12649 contents: CResult_COption_TypeZDecodeErrorZPtr {
12650 err: Box::into_raw(Box::new(e)),
12655 /// Checks if the given object is currently in the success state
12657 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
12661 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
12662 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
12663 impl Drop for CResult_COption_TypeZDecodeErrorZ {
12664 fn drop(&mut self) {
12665 if self.result_ok {
12666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12667 let _ = unsafe { Box::from_raw(self.contents.result) };
12670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12671 let _ = unsafe { Box::from_raw(self.contents.err) };
12676 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
12677 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12678 let contents = if o.result_ok {
12679 let result = unsafe { o.contents.result };
12680 unsafe { o.contents.result = core::ptr::null_mut() };
12681 CResult_COption_TypeZDecodeErrorZPtr { result }
12683 let err = unsafe { o.contents.err };
12684 unsafe { o.contents.err = core::ptr::null_mut(); }
12685 CResult_COption_TypeZDecodeErrorZPtr { err }
12689 result_ok: o.result_ok,
12693 impl Clone for CResult_COption_TypeZDecodeErrorZ {
12694 fn clone(&self) -> Self {
12695 if self.result_ok {
12696 Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
12697 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
12700 Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
12701 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12707 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
12708 /// but with all dynamically-allocated buffers duplicated in new buffers.
12709 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
12712 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
12713 pub enum COption_SocketAddressZ {
12714 /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
12715 Some(crate::lightning::ln::msgs::SocketAddress),
12716 /// When we're in this state, this COption_SocketAddressZ contains nothing
12719 impl COption_SocketAddressZ {
12720 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12721 if let Self::None = self { false } else { true }
12723 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12726 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
12727 if let Self::Some(v) = self { v } else { unreachable!() }
12731 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
12732 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
12733 COption_SocketAddressZ::Some(o)
12736 /// Constructs a new COption_SocketAddressZ containing nothing
12737 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
12738 COption_SocketAddressZ::None
12741 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
12742 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
12744 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
12745 /// but with all dynamically-allocated buffers duplicated in new buffers.
12746 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
12748 /// A tuple of 2 elements. See the individual fields for the types contained.
12749 pub struct C2Tuple_PublicKeyCOption_SocketAddressZZ {
12750 /// The element at position 0
12751 pub a: crate::c_types::PublicKey,
12752 /// The element at position 1
12753 pub b: crate::c_types::derived::COption_SocketAddressZ,
12755 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)> for C2Tuple_PublicKeyCOption_SocketAddressZZ {
12756 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)) -> Self {
12763 impl C2Tuple_PublicKeyCOption_SocketAddressZZ {
12764 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ) {
12768 impl Clone for C2Tuple_PublicKeyCOption_SocketAddressZZ {
12769 fn clone(&self) -> Self {
12771 a: Clone::clone(&self.a),
12772 b: Clone::clone(&self.b),
12777 /// Creates a new tuple which has the same data as `orig`
12778 /// but with all dynamically-allocated buffers duplicated in new buffers.
12779 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_SocketAddressZZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { Clone::clone(&orig) }
12780 /// Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements.
12782 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_SocketAddressZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ {
12783 C2Tuple_PublicKeyCOption_SocketAddressZZ { a, b, }
12787 /// Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ.
12788 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCOption_SocketAddressZZ) { }
12790 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size.
12791 /// This corresponds to std::vector in C++
12792 pub struct CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12793 /// The elements in the array.
12794 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12795 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ,
12796 /// The number of elements pointed to by `data`.
12799 impl CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12800 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ> {
12801 if self.datalen == 0 { return Vec::new(); }
12802 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12803 self.data = core::ptr::null_mut();
12807 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ] {
12808 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12811 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12812 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>) -> Self {
12813 let datalen = v.len();
12814 let data = Box::into_raw(v.into_boxed_slice());
12815 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12820 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ) { }
12821 impl Drop for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12822 fn drop(&mut self) {
12823 if self.datalen == 0 { return; }
12824 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12827 impl Clone for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12828 fn clone(&self) -> Self {
12829 let mut res = Vec::new();
12830 if self.datalen == 0 { return Self::from(res); }
12831 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12836 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12837 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12838 /// A pointer to the contents in the success state.
12839 /// Reading from this pointer when `result_ok` is not set is undefined.
12840 pub result: *mut crate::c_types::derived::CVec_u8Z,
12841 /// A pointer to the contents in the error state.
12842 /// Reading from this pointer when `result_ok` is set is undefined.
12843 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12846 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12847 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12848 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12849 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12850 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12851 /// `err` or `result` depending on the state of `result_ok`.
12852 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12853 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12854 pub result_ok: bool,
12857 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12858 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12859 CResult_CVec_u8ZPeerHandleErrorZ {
12860 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12861 result: Box::into_raw(Box::new(o)),
12867 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12868 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12869 CResult_CVec_u8ZPeerHandleErrorZ {
12870 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12871 err: Box::into_raw(Box::new(e)),
12876 /// Checks if the given object is currently in the success state
12878 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12882 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12883 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12884 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12885 fn drop(&mut self) {
12886 if self.result_ok {
12887 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12888 let _ = unsafe { Box::from_raw(self.contents.result) };
12891 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12892 let _ = unsafe { Box::from_raw(self.contents.err) };
12897 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12898 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12899 let contents = if o.result_ok {
12900 let result = unsafe { o.contents.result };
12901 unsafe { o.contents.result = core::ptr::null_mut() };
12902 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12904 let err = unsafe { o.contents.err };
12905 unsafe { o.contents.err = core::ptr::null_mut(); }
12906 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12910 result_ok: o.result_ok,
12914 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12915 fn clone(&self) -> Self {
12916 if self.result_ok {
12917 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12918 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12921 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12922 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12928 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12929 /// but with all dynamically-allocated buffers duplicated in new buffers.
12930 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12932 /// The contents of CResult_NonePeerHandleErrorZ
12933 pub union CResult_NonePeerHandleErrorZPtr {
12934 /// Note that this value is always NULL, as there are no contents in the OK variant
12935 pub result: *mut core::ffi::c_void,
12936 /// A pointer to the contents in the error state.
12937 /// Reading from this pointer when `result_ok` is set is undefined.
12938 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12941 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12942 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12944 pub struct CResult_NonePeerHandleErrorZ {
12945 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12946 /// `err` or `result` depending on the state of `result_ok`.
12947 pub contents: CResult_NonePeerHandleErrorZPtr,
12948 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12949 pub result_ok: bool,
12952 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12953 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12954 CResult_NonePeerHandleErrorZ {
12955 contents: CResult_NonePeerHandleErrorZPtr {
12956 result: core::ptr::null_mut(),
12962 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12963 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12964 CResult_NonePeerHandleErrorZ {
12965 contents: CResult_NonePeerHandleErrorZPtr {
12966 err: Box::into_raw(Box::new(e)),
12971 /// Checks if the given object is currently in the success state
12973 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12977 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12978 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12979 impl Drop for CResult_NonePeerHandleErrorZ {
12980 fn drop(&mut self) {
12981 if self.result_ok {
12983 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12984 let _ = unsafe { Box::from_raw(self.contents.err) };
12989 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12990 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12991 let contents = if o.result_ok {
12992 let _ = unsafe { Box::from_raw(o.contents.result) };
12993 o.contents.result = core::ptr::null_mut();
12994 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12996 let err = unsafe { o.contents.err };
12997 unsafe { o.contents.err = core::ptr::null_mut(); }
12998 CResult_NonePeerHandleErrorZPtr { err }
13002 result_ok: o.result_ok,
13006 impl Clone for CResult_NonePeerHandleErrorZ {
13007 fn clone(&self) -> Self {
13008 if self.result_ok {
13009 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
13010 result: core::ptr::null_mut()
13013 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
13014 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13020 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
13021 /// but with all dynamically-allocated buffers duplicated in new buffers.
13022 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
13024 /// The contents of CResult_boolPeerHandleErrorZ
13025 pub union CResult_boolPeerHandleErrorZPtr {
13026 /// A pointer to the contents in the success state.
13027 /// Reading from this pointer when `result_ok` is not set is undefined.
13028 pub result: *mut bool,
13029 /// A pointer to the contents in the error state.
13030 /// Reading from this pointer when `result_ok` is set is undefined.
13031 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13034 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
13035 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13037 pub struct CResult_boolPeerHandleErrorZ {
13038 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
13039 /// `err` or `result` depending on the state of `result_ok`.
13040 pub contents: CResult_boolPeerHandleErrorZPtr,
13041 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
13042 pub result_ok: bool,
13045 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
13046 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
13047 CResult_boolPeerHandleErrorZ {
13048 contents: CResult_boolPeerHandleErrorZPtr {
13049 result: Box::into_raw(Box::new(o)),
13055 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
13056 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
13057 CResult_boolPeerHandleErrorZ {
13058 contents: CResult_boolPeerHandleErrorZPtr {
13059 err: Box::into_raw(Box::new(e)),
13064 /// Checks if the given object is currently in the success state
13066 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
13070 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
13071 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
13072 impl Drop for CResult_boolPeerHandleErrorZ {
13073 fn drop(&mut self) {
13074 if self.result_ok {
13075 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13076 let _ = unsafe { Box::from_raw(self.contents.result) };
13079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13080 let _ = unsafe { Box::from_raw(self.contents.err) };
13085 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
13086 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13087 let contents = if o.result_ok {
13088 let result = unsafe { o.contents.result };
13089 unsafe { o.contents.result = core::ptr::null_mut() };
13090 CResult_boolPeerHandleErrorZPtr { result }
13092 let err = unsafe { o.contents.err };
13093 unsafe { o.contents.err = core::ptr::null_mut(); }
13094 CResult_boolPeerHandleErrorZPtr { err }
13098 result_ok: o.result_ok,
13102 impl Clone for CResult_boolPeerHandleErrorZ {
13103 fn clone(&self) -> Self {
13104 if self.result_ok {
13105 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
13106 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
13109 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
13110 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13116 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
13117 /// but with all dynamically-allocated buffers duplicated in new buffers.
13118 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
13120 /// The contents of CResult_u32GraphSyncErrorZ
13121 pub union CResult_u32GraphSyncErrorZPtr {
13122 /// A pointer to the contents in the success state.
13123 /// Reading from this pointer when `result_ok` is not set is undefined.
13124 pub result: *mut u32,
13125 /// A pointer to the contents in the error state.
13126 /// Reading from this pointer when `result_ok` is set is undefined.
13127 pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
13130 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13131 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
13132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13133 pub struct CResult_u32GraphSyncErrorZ {
13134 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13135 /// `err` or `result` depending on the state of `result_ok`.
13136 pub contents: CResult_u32GraphSyncErrorZPtr,
13137 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13138 pub result_ok: bool,
13141 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13142 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13143 CResult_u32GraphSyncErrorZ {
13144 contents: CResult_u32GraphSyncErrorZPtr {
13145 result: Box::into_raw(Box::new(o)),
13151 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13152 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13153 CResult_u32GraphSyncErrorZ {
13154 contents: CResult_u32GraphSyncErrorZPtr {
13155 err: Box::into_raw(Box::new(e)),
13160 /// Checks if the given object is currently in the success state
13162 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13166 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13167 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13168 impl Drop for CResult_u32GraphSyncErrorZ {
13169 fn drop(&mut self) {
13170 if self.result_ok {
13171 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13172 let _ = unsafe { Box::from_raw(self.contents.result) };
13175 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13176 let _ = unsafe { Box::from_raw(self.contents.err) };
13181 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13182 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
13183 let contents = if o.result_ok {
13184 let result = unsafe { o.contents.result };
13185 unsafe { o.contents.result = core::ptr::null_mut() };
13186 CResult_u32GraphSyncErrorZPtr { result }
13188 let err = unsafe { o.contents.err };
13189 unsafe { o.contents.err = core::ptr::null_mut(); }
13190 CResult_u32GraphSyncErrorZPtr { err }
13194 result_ok: o.result_ok,
13199 /// The contents of CResult_CVec_u8ZIOErrorZ
13200 pub union CResult_CVec_u8ZIOErrorZPtr {
13201 /// A pointer to the contents in the success state.
13202 /// Reading from this pointer when `result_ok` is not set is undefined.
13203 pub result: *mut crate::c_types::derived::CVec_u8Z,
13204 /// A pointer to the contents in the error state.
13205 /// Reading from this pointer when `result_ok` is set is undefined.
13206 pub err: *mut crate::c_types::IOError,
13209 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
13210 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
13211 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13212 pub struct CResult_CVec_u8ZIOErrorZ {
13213 /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
13214 /// `err` or `result` depending on the state of `result_ok`.
13215 pub contents: CResult_CVec_u8ZIOErrorZPtr,
13216 /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
13217 pub result_ok: bool,
13220 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
13221 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
13222 CResult_CVec_u8ZIOErrorZ {
13223 contents: CResult_CVec_u8ZIOErrorZPtr {
13224 result: Box::into_raw(Box::new(o)),
13230 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
13231 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
13232 CResult_CVec_u8ZIOErrorZ {
13233 contents: CResult_CVec_u8ZIOErrorZPtr {
13234 err: Box::into_raw(Box::new(e)),
13239 /// Checks if the given object is currently in the success state
13241 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
13245 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
13246 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
13247 impl Drop for CResult_CVec_u8ZIOErrorZ {
13248 fn drop(&mut self) {
13249 if self.result_ok {
13250 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13251 let _ = unsafe { Box::from_raw(self.contents.result) };
13254 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13255 let _ = unsafe { Box::from_raw(self.contents.err) };
13260 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
13261 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
13262 let contents = if o.result_ok {
13263 let result = unsafe { o.contents.result };
13264 unsafe { o.contents.result = core::ptr::null_mut() };
13265 CResult_CVec_u8ZIOErrorZPtr { result }
13267 let err = unsafe { o.contents.err };
13268 unsafe { o.contents.err = core::ptr::null_mut(); }
13269 CResult_CVec_u8ZIOErrorZPtr { err }
13273 result_ok: o.result_ok,
13277 impl Clone for CResult_CVec_u8ZIOErrorZ {
13278 fn clone(&self) -> Self {
13279 if self.result_ok {
13280 Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
13281 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
13284 Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
13285 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13291 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
13292 /// but with all dynamically-allocated buffers duplicated in new buffers.
13293 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
13295 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
13296 /// This corresponds to std::vector in C++
13297 pub struct CVec_StrZ {
13298 /// The elements in the array.
13299 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13300 pub data: *mut crate::c_types::Str,
13301 /// The number of elements pointed to by `data`.
13305 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
13306 if self.datalen == 0 { return Vec::new(); }
13307 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13308 self.data = core::ptr::null_mut();
13312 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
13313 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13316 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
13317 fn from(v: Vec<crate::c_types::Str>) -> Self {
13318 let datalen = v.len();
13319 let data = Box::into_raw(v.into_boxed_slice());
13320 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13324 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13325 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
13326 impl Drop for CVec_StrZ {
13327 fn drop(&mut self) {
13328 if self.datalen == 0 { return; }
13329 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13332 impl Clone for CVec_StrZ {
13333 fn clone(&self) -> Self {
13334 let mut res = Vec::new();
13335 if self.datalen == 0 { return Self::from(res); }
13336 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13341 /// The contents of CResult_CVec_StrZIOErrorZ
13342 pub union CResult_CVec_StrZIOErrorZPtr {
13343 /// A pointer to the contents in the success state.
13344 /// Reading from this pointer when `result_ok` is not set is undefined.
13345 pub result: *mut crate::c_types::derived::CVec_StrZ,
13346 /// A pointer to the contents in the error state.
13347 /// Reading from this pointer when `result_ok` is set is undefined.
13348 pub err: *mut crate::c_types::IOError,
13351 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
13352 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
13353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13354 pub struct CResult_CVec_StrZIOErrorZ {
13355 /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
13356 /// `err` or `result` depending on the state of `result_ok`.
13357 pub contents: CResult_CVec_StrZIOErrorZPtr,
13358 /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
13359 pub result_ok: bool,
13362 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
13363 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
13364 CResult_CVec_StrZIOErrorZ {
13365 contents: CResult_CVec_StrZIOErrorZPtr {
13366 result: Box::into_raw(Box::new(o)),
13372 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
13373 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
13374 CResult_CVec_StrZIOErrorZ {
13375 contents: CResult_CVec_StrZIOErrorZPtr {
13376 err: Box::into_raw(Box::new(e)),
13381 /// Checks if the given object is currently in the success state
13383 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
13387 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
13388 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
13389 impl Drop for CResult_CVec_StrZIOErrorZ {
13390 fn drop(&mut self) {
13391 if self.result_ok {
13392 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13393 let _ = unsafe { Box::from_raw(self.contents.result) };
13396 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13397 let _ = unsafe { Box::from_raw(self.contents.err) };
13402 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
13403 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
13404 let contents = if o.result_ok {
13405 let result = unsafe { o.contents.result };
13406 unsafe { o.contents.result = core::ptr::null_mut() };
13407 CResult_CVec_StrZIOErrorZPtr { result }
13409 let err = unsafe { o.contents.err };
13410 unsafe { o.contents.err = core::ptr::null_mut(); }
13411 CResult_CVec_StrZIOErrorZPtr { err }
13415 result_ok: o.result_ok,
13419 impl Clone for CResult_CVec_StrZIOErrorZ {
13420 fn clone(&self) -> Self {
13421 if self.result_ok {
13422 Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
13423 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
13426 Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
13427 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13433 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
13434 /// but with all dynamically-allocated buffers duplicated in new buffers.
13435 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
13437 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
13438 /// This corresponds to std::vector in C++
13439 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13440 /// The elements in the array.
13441 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13442 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13443 /// The number of elements pointed to by `data`.
13446 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13447 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
13448 if self.datalen == 0 { return Vec::new(); }
13449 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13450 self.data = core::ptr::null_mut();
13454 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
13455 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13458 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13459 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
13460 let datalen = v.len();
13461 let data = Box::into_raw(v.into_boxed_slice());
13462 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13466 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13467 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
13468 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13469 fn drop(&mut self) {
13470 if self.datalen == 0 { return; }
13471 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13474 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13475 fn clone(&self) -> Self {
13476 let mut res = Vec::new();
13477 if self.datalen == 0 { return Self::from(res); }
13478 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13483 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
13484 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13485 /// A pointer to the contents in the success state.
13486 /// Reading from this pointer when `result_ok` is not set is undefined.
13487 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
13488 /// A pointer to the contents in the error state.
13489 /// Reading from this pointer when `result_ok` is set is undefined.
13490 pub err: *mut crate::c_types::IOError,
13493 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
13494 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
13495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13496 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13497 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
13498 /// `err` or `result` depending on the state of `result_ok`.
13499 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
13500 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
13501 pub result_ok: bool,
13504 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
13505 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13506 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13507 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13508 result: Box::into_raw(Box::new(o)),
13514 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
13515 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13516 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13517 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13518 err: Box::into_raw(Box::new(e)),
13523 /// Checks if the given object is currently in the success state
13525 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
13529 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
13530 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
13531 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13532 fn drop(&mut self) {
13533 if self.result_ok {
13534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13535 let _ = unsafe { Box::from_raw(self.contents.result) };
13538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13539 let _ = unsafe { Box::from_raw(self.contents.err) };
13544 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13545 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
13546 let contents = if o.result_ok {
13547 let result = unsafe { o.contents.result };
13548 unsafe { o.contents.result = core::ptr::null_mut() };
13549 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
13551 let err = unsafe { o.contents.err };
13552 unsafe { o.contents.err = core::ptr::null_mut(); }
13553 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
13557 result_ok: o.result_ok,
13561 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13562 fn clone(&self) -> Self {
13563 if self.result_ok {
13564 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13565 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
13568 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13569 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13575 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
13576 /// but with all dynamically-allocated buffers duplicated in new buffers.
13577 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
13579 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
13580 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13581 /// A pointer to the contents in the success state.
13582 /// Reading from this pointer when `result_ok` is not set is undefined.
13583 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13584 /// A pointer to the contents in the error state.
13585 /// Reading from this pointer when `result_ok` is set is undefined.
13586 pub err: *mut crate::c_types::IOError,
13589 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
13590 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
13591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13592 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13593 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
13594 /// `err` or `result` depending on the state of `result_ok`.
13595 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
13596 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
13597 pub result_ok: bool,
13600 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
13601 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13602 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13603 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13604 result: Box::into_raw(Box::new(o)),
13610 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
13611 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13612 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13613 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13614 err: Box::into_raw(Box::new(e)),
13619 /// Checks if the given object is currently in the success state
13621 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
13625 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
13626 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
13627 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13628 fn drop(&mut self) {
13629 if self.result_ok {
13630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13631 let _ = unsafe { Box::from_raw(self.contents.result) };
13634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13635 let _ = unsafe { Box::from_raw(self.contents.err) };
13640 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13641 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
13642 let contents = if o.result_ok {
13643 let result = unsafe { o.contents.result };
13644 unsafe { o.contents.result = core::ptr::null_mut() };
13645 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
13647 let err = unsafe { o.contents.err };
13648 unsafe { o.contents.err = core::ptr::null_mut(); }
13649 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
13653 result_ok: o.result_ok,
13657 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13658 fn clone(&self) -> Self {
13659 if self.result_ok {
13660 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13661 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
13664 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13665 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
13671 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
13672 /// but with all dynamically-allocated buffers duplicated in new buffers.
13673 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
13676 /// An enum which can either contain a crate::c_types::SecretKey or not
13677 pub enum COption_SecretKeyZ {
13678 /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
13679 Some(crate::c_types::SecretKey),
13680 /// When we're in this state, this COption_SecretKeyZ contains nothing
13683 impl COption_SecretKeyZ {
13684 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13685 if let Self::None = self { false } else { true }
13687 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13690 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
13691 if let Self::Some(v) = self { v } else { unreachable!() }
13695 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
13696 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
13697 COption_SecretKeyZ::Some(o)
13700 /// Constructs a new COption_SecretKeyZ containing nothing
13701 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
13702 COption_SecretKeyZ::None
13705 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
13706 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
13708 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
13709 /// but with all dynamically-allocated buffers duplicated in new buffers.
13710 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
13712 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
13713 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
13714 /// A pointer to the contents in the success state.
13715 /// Reading from this pointer when `result_ok` is not set is undefined.
13716 pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
13717 /// Note that this value is always NULL, as there are no contents in the Err variant
13718 pub err: *mut core::ffi::c_void,
13721 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
13722 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
13723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13724 pub struct CResult_VerifiedInvoiceRequestNoneZ {
13725 /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
13726 /// `err` or `result` depending on the state of `result_ok`.
13727 pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
13728 /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
13729 pub result_ok: bool,
13732 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
13733 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
13734 CResult_VerifiedInvoiceRequestNoneZ {
13735 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13736 result: Box::into_raw(Box::new(o)),
13742 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
13743 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
13744 CResult_VerifiedInvoiceRequestNoneZ {
13745 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13746 err: core::ptr::null_mut(),
13751 /// Checks if the given object is currently in the success state
13753 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
13757 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
13758 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
13759 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
13760 fn drop(&mut self) {
13761 if self.result_ok {
13762 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13763 let _ = unsafe { Box::from_raw(self.contents.result) };
13769 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
13770 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
13771 let contents = if o.result_ok {
13772 let result = unsafe { o.contents.result };
13773 unsafe { o.contents.result = core::ptr::null_mut() };
13774 CResult_VerifiedInvoiceRequestNoneZPtr { result }
13776 let _ = unsafe { Box::from_raw(o.contents.err) };
13777 o.contents.err = core::ptr::null_mut();
13778 CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
13782 result_ok: o.result_ok,
13786 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
13787 fn clone(&self) -> Self {
13788 if self.result_ok {
13789 Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13790 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
13793 Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13794 err: core::ptr::null_mut()
13800 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
13801 /// but with all dynamically-allocated buffers duplicated in new buffers.
13802 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
13804 /// An enum which can either contain a or not
13805 pub enum COption_NoneZ {
13806 /// When we're in this state, this COption_NoneZ contains a
13808 /// When we're in this state, this COption_NoneZ contains nothing
13811 impl COption_NoneZ {
13812 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13813 if let Self::None = self { false } else { true }
13815 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13820 /// Constructs a new COption_NoneZ containing a
13821 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
13822 COption_NoneZ::Some
13825 /// Constructs a new COption_NoneZ containing nothing
13826 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
13827 COption_NoneZ::None
13830 /// Frees any resources associated with the , if we are in the Some state
13831 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
13833 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
13834 /// This corresponds to std::vector in C++
13835 pub struct CVec_WitnessZ {
13836 /// The elements in the array.
13837 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13838 pub data: *mut crate::c_types::Witness,
13839 /// The number of elements pointed to by `data`.
13842 impl CVec_WitnessZ {
13843 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
13844 if self.datalen == 0 { return Vec::new(); }
13845 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13846 self.data = core::ptr::null_mut();
13850 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
13851 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13854 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
13855 fn from(v: Vec<crate::c_types::Witness>) -> Self {
13856 let datalen = v.len();
13857 let data = Box::into_raw(v.into_boxed_slice());
13858 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13862 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13863 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
13864 impl Drop for CVec_WitnessZ {
13865 fn drop(&mut self) {
13866 if self.datalen == 0 { return; }
13867 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13870 impl Clone for CVec_WitnessZ {
13871 fn clone(&self) -> Self {
13872 let mut res = Vec::new();
13873 if self.datalen == 0 { return Self::from(res); }
13874 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13880 /// An enum which can either contain a i64 or not
13881 pub enum COption_i64Z {
13882 /// When we're in this state, this COption_i64Z contains a i64
13884 /// When we're in this state, this COption_i64Z contains nothing
13887 impl COption_i64Z {
13888 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13889 if let Self::None = self { false } else { true }
13891 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13894 #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
13895 if let Self::Some(v) = self { v } else { unreachable!() }
13899 /// Constructs a new COption_i64Z containing a i64
13900 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
13901 COption_i64Z::Some(o)
13904 /// Constructs a new COption_i64Z containing nothing
13905 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
13909 /// Frees any resources associated with the i64, if we are in the Some state
13910 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
13912 /// Creates a new COption_i64Z which has the same data as `orig`
13913 /// but with all dynamically-allocated buffers duplicated in new buffers.
13914 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
13916 /// The contents of CResult_SocketAddressDecodeErrorZ
13917 pub union CResult_SocketAddressDecodeErrorZPtr {
13918 /// A pointer to the contents in the success state.
13919 /// Reading from this pointer when `result_ok` is not set is undefined.
13920 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
13921 /// A pointer to the contents in the error state.
13922 /// Reading from this pointer when `result_ok` is set is undefined.
13923 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13926 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
13927 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13929 pub struct CResult_SocketAddressDecodeErrorZ {
13930 /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
13931 /// `err` or `result` depending on the state of `result_ok`.
13932 pub contents: CResult_SocketAddressDecodeErrorZPtr,
13933 /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
13934 pub result_ok: bool,
13937 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
13938 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
13939 CResult_SocketAddressDecodeErrorZ {
13940 contents: CResult_SocketAddressDecodeErrorZPtr {
13941 result: Box::into_raw(Box::new(o)),
13947 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
13948 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
13949 CResult_SocketAddressDecodeErrorZ {
13950 contents: CResult_SocketAddressDecodeErrorZPtr {
13951 err: Box::into_raw(Box::new(e)),
13956 /// Checks if the given object is currently in the success state
13958 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
13962 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
13963 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
13964 impl Drop for CResult_SocketAddressDecodeErrorZ {
13965 fn drop(&mut self) {
13966 if self.result_ok {
13967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13968 let _ = unsafe { Box::from_raw(self.contents.result) };
13971 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13972 let _ = unsafe { Box::from_raw(self.contents.err) };
13977 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
13978 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13979 let contents = if o.result_ok {
13980 let result = unsafe { o.contents.result };
13981 unsafe { o.contents.result = core::ptr::null_mut() };
13982 CResult_SocketAddressDecodeErrorZPtr { result }
13984 let err = unsafe { o.contents.err };
13985 unsafe { o.contents.err = core::ptr::null_mut(); }
13986 CResult_SocketAddressDecodeErrorZPtr { err }
13990 result_ok: o.result_ok,
13994 impl Clone for CResult_SocketAddressDecodeErrorZ {
13995 fn clone(&self) -> Self {
13996 if self.result_ok {
13997 Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
13998 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
14001 Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
14002 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14008 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
14009 /// but with all dynamically-allocated buffers duplicated in new buffers.
14010 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
14012 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
14013 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
14014 /// A pointer to the contents in the success state.
14015 /// Reading from this pointer when `result_ok` is not set is undefined.
14016 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
14017 /// A pointer to the contents in the error state.
14018 /// Reading from this pointer when `result_ok` is set is undefined.
14019 pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
14022 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
14023 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
14024 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14025 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
14026 /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
14027 /// `err` or `result` depending on the state of `result_ok`.
14028 pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
14029 /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
14030 pub result_ok: bool,
14033 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
14034 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
14035 CResult_SocketAddressSocketAddressParseErrorZ {
14036 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14037 result: Box::into_raw(Box::new(o)),
14043 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
14044 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
14045 CResult_SocketAddressSocketAddressParseErrorZ {
14046 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14047 err: Box::into_raw(Box::new(e)),
14052 /// Checks if the given object is currently in the success state
14054 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
14058 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
14059 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
14060 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
14061 fn drop(&mut self) {
14062 if self.result_ok {
14063 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14064 let _ = unsafe { Box::from_raw(self.contents.result) };
14067 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14068 let _ = unsafe { Box::from_raw(self.contents.err) };
14073 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
14074 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
14075 let contents = if o.result_ok {
14076 let result = unsafe { o.contents.result };
14077 unsafe { o.contents.result = core::ptr::null_mut() };
14078 CResult_SocketAddressSocketAddressParseErrorZPtr { result }
14080 let err = unsafe { o.contents.err };
14081 unsafe { o.contents.err = core::ptr::null_mut(); }
14082 CResult_SocketAddressSocketAddressParseErrorZPtr { err }
14086 result_ok: o.result_ok,
14090 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
14091 fn clone(&self) -> Self {
14092 if self.result_ok {
14093 Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14094 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
14097 Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
14098 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
14104 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
14105 /// but with all dynamically-allocated buffers duplicated in new buffers.
14106 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
14108 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
14109 /// This corresponds to std::vector in C++
14110 pub struct CVec_UpdateAddHTLCZ {
14111 /// The elements in the array.
14112 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14113 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14114 /// The number of elements pointed to by `data`.
14117 impl CVec_UpdateAddHTLCZ {
14118 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
14119 if self.datalen == 0 { return Vec::new(); }
14120 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14121 self.data = core::ptr::null_mut();
14125 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
14126 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14129 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
14130 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
14131 let datalen = v.len();
14132 let data = Box::into_raw(v.into_boxed_slice());
14133 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14137 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14138 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
14139 impl Drop for CVec_UpdateAddHTLCZ {
14140 fn drop(&mut self) {
14141 if self.datalen == 0 { return; }
14142 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14145 impl Clone for CVec_UpdateAddHTLCZ {
14146 fn clone(&self) -> Self {
14147 let mut res = Vec::new();
14148 if self.datalen == 0 { return Self::from(res); }
14149 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14154 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
14155 /// This corresponds to std::vector in C++
14156 pub struct CVec_UpdateFulfillHTLCZ {
14157 /// The elements in the array.
14158 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14159 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14160 /// The number of elements pointed to by `data`.
14163 impl CVec_UpdateFulfillHTLCZ {
14164 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
14165 if self.datalen == 0 { return Vec::new(); }
14166 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14167 self.data = core::ptr::null_mut();
14171 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
14172 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14175 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
14176 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
14177 let datalen = v.len();
14178 let data = Box::into_raw(v.into_boxed_slice());
14179 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14184 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
14185 impl Drop for CVec_UpdateFulfillHTLCZ {
14186 fn drop(&mut self) {
14187 if self.datalen == 0 { return; }
14188 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14191 impl Clone for CVec_UpdateFulfillHTLCZ {
14192 fn clone(&self) -> Self {
14193 let mut res = Vec::new();
14194 if self.datalen == 0 { return Self::from(res); }
14195 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14200 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
14201 /// This corresponds to std::vector in C++
14202 pub struct CVec_UpdateFailHTLCZ {
14203 /// The elements in the array.
14204 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14205 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14206 /// The number of elements pointed to by `data`.
14209 impl CVec_UpdateFailHTLCZ {
14210 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
14211 if self.datalen == 0 { return Vec::new(); }
14212 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14213 self.data = core::ptr::null_mut();
14217 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
14218 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14221 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
14222 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
14223 let datalen = v.len();
14224 let data = Box::into_raw(v.into_boxed_slice());
14225 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14229 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14230 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
14231 impl Drop for CVec_UpdateFailHTLCZ {
14232 fn drop(&mut self) {
14233 if self.datalen == 0 { return; }
14234 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14237 impl Clone for CVec_UpdateFailHTLCZ {
14238 fn clone(&self) -> Self {
14239 let mut res = Vec::new();
14240 if self.datalen == 0 { return Self::from(res); }
14241 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14246 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
14247 /// This corresponds to std::vector in C++
14248 pub struct CVec_UpdateFailMalformedHTLCZ {
14249 /// The elements in the array.
14250 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14251 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14252 /// The number of elements pointed to by `data`.
14255 impl CVec_UpdateFailMalformedHTLCZ {
14256 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
14257 if self.datalen == 0 { return Vec::new(); }
14258 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14259 self.data = core::ptr::null_mut();
14263 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
14264 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14267 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
14268 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
14269 let datalen = v.len();
14270 let data = Box::into_raw(v.into_boxed_slice());
14271 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14275 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14276 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
14277 impl Drop for CVec_UpdateFailMalformedHTLCZ {
14278 fn drop(&mut self) {
14279 if self.datalen == 0 { return; }
14280 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14283 impl Clone for CVec_UpdateFailMalformedHTLCZ {
14284 fn clone(&self) -> Self {
14285 let mut res = Vec::new();
14286 if self.datalen == 0 { return Self::from(res); }
14287 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14292 /// The contents of CResult_AcceptChannelDecodeErrorZ
14293 pub union CResult_AcceptChannelDecodeErrorZPtr {
14294 /// A pointer to the contents in the success state.
14295 /// Reading from this pointer when `result_ok` is not set is undefined.
14296 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
14297 /// A pointer to the contents in the error state.
14298 /// Reading from this pointer when `result_ok` is set is undefined.
14299 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14302 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
14303 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14305 pub struct CResult_AcceptChannelDecodeErrorZ {
14306 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
14307 /// `err` or `result` depending on the state of `result_ok`.
14308 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
14309 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
14310 pub result_ok: bool,
14313 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14314 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
14315 CResult_AcceptChannelDecodeErrorZ {
14316 contents: CResult_AcceptChannelDecodeErrorZPtr {
14317 result: Box::into_raw(Box::new(o)),
14323 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14324 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
14325 CResult_AcceptChannelDecodeErrorZ {
14326 contents: CResult_AcceptChannelDecodeErrorZPtr {
14327 err: Box::into_raw(Box::new(e)),
14332 /// Checks if the given object is currently in the success state
14334 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
14338 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14339 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
14340 impl Drop for CResult_AcceptChannelDecodeErrorZ {
14341 fn drop(&mut self) {
14342 if self.result_ok {
14343 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14344 let _ = unsafe { Box::from_raw(self.contents.result) };
14347 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14348 let _ = unsafe { Box::from_raw(self.contents.err) };
14353 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
14354 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14355 let contents = if o.result_ok {
14356 let result = unsafe { o.contents.result };
14357 unsafe { o.contents.result = core::ptr::null_mut() };
14358 CResult_AcceptChannelDecodeErrorZPtr { result }
14360 let err = unsafe { o.contents.err };
14361 unsafe { o.contents.err = core::ptr::null_mut(); }
14362 CResult_AcceptChannelDecodeErrorZPtr { err }
14366 result_ok: o.result_ok,
14370 impl Clone for CResult_AcceptChannelDecodeErrorZ {
14371 fn clone(&self) -> Self {
14372 if self.result_ok {
14373 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
14374 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
14377 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
14378 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14384 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14385 /// but with all dynamically-allocated buffers duplicated in new buffers.
14386 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
14388 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
14389 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
14390 /// A pointer to the contents in the success state.
14391 /// Reading from this pointer when `result_ok` is not set is undefined.
14392 pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
14393 /// A pointer to the contents in the error state.
14394 /// Reading from this pointer when `result_ok` is set is undefined.
14395 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14398 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
14399 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
14400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14401 pub struct CResult_AcceptChannelV2DecodeErrorZ {
14402 /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
14403 /// `err` or `result` depending on the state of `result_ok`.
14404 pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
14405 /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
14406 pub result_ok: bool,
14409 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
14410 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
14411 CResult_AcceptChannelV2DecodeErrorZ {
14412 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14413 result: Box::into_raw(Box::new(o)),
14419 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
14420 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
14421 CResult_AcceptChannelV2DecodeErrorZ {
14422 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14423 err: Box::into_raw(Box::new(e)),
14428 /// Checks if the given object is currently in the success state
14430 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
14434 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
14435 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
14436 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
14437 fn drop(&mut self) {
14438 if self.result_ok {
14439 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14440 let _ = unsafe { Box::from_raw(self.contents.result) };
14443 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14444 let _ = unsafe { Box::from_raw(self.contents.err) };
14449 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
14450 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
14451 let contents = if o.result_ok {
14452 let result = unsafe { o.contents.result };
14453 unsafe { o.contents.result = core::ptr::null_mut() };
14454 CResult_AcceptChannelV2DecodeErrorZPtr { result }
14456 let err = unsafe { o.contents.err };
14457 unsafe { o.contents.err = core::ptr::null_mut(); }
14458 CResult_AcceptChannelV2DecodeErrorZPtr { err }
14462 result_ok: o.result_ok,
14466 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
14467 fn clone(&self) -> Self {
14468 if self.result_ok {
14469 Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14470 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
14473 Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
14474 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14480 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
14481 /// but with all dynamically-allocated buffers duplicated in new buffers.
14482 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
14484 /// The contents of CResult_StfuDecodeErrorZ
14485 pub union CResult_StfuDecodeErrorZPtr {
14486 /// A pointer to the contents in the success state.
14487 /// Reading from this pointer when `result_ok` is not set is undefined.
14488 pub result: *mut crate::lightning::ln::msgs::Stfu,
14489 /// A pointer to the contents in the error state.
14490 /// Reading from this pointer when `result_ok` is set is undefined.
14491 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14494 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
14495 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
14496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14497 pub struct CResult_StfuDecodeErrorZ {
14498 /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
14499 /// `err` or `result` depending on the state of `result_ok`.
14500 pub contents: CResult_StfuDecodeErrorZPtr,
14501 /// Whether this CResult_StfuDecodeErrorZ represents a success state.
14502 pub result_ok: bool,
14505 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
14506 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
14507 CResult_StfuDecodeErrorZ {
14508 contents: CResult_StfuDecodeErrorZPtr {
14509 result: Box::into_raw(Box::new(o)),
14515 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
14516 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
14517 CResult_StfuDecodeErrorZ {
14518 contents: CResult_StfuDecodeErrorZPtr {
14519 err: Box::into_raw(Box::new(e)),
14524 /// Checks if the given object is currently in the success state
14526 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
14530 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
14531 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
14532 impl Drop for CResult_StfuDecodeErrorZ {
14533 fn drop(&mut self) {
14534 if self.result_ok {
14535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14536 let _ = unsafe { Box::from_raw(self.contents.result) };
14539 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14540 let _ = unsafe { Box::from_raw(self.contents.err) };
14545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
14546 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
14547 let contents = if o.result_ok {
14548 let result = unsafe { o.contents.result };
14549 unsafe { o.contents.result = core::ptr::null_mut() };
14550 CResult_StfuDecodeErrorZPtr { result }
14552 let err = unsafe { o.contents.err };
14553 unsafe { o.contents.err = core::ptr::null_mut(); }
14554 CResult_StfuDecodeErrorZPtr { err }
14558 result_ok: o.result_ok,
14562 impl Clone for CResult_StfuDecodeErrorZ {
14563 fn clone(&self) -> Self {
14564 if self.result_ok {
14565 Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
14566 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
14569 Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
14570 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14576 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
14577 /// but with all dynamically-allocated buffers duplicated in new buffers.
14578 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
14580 /// The contents of CResult_SpliceDecodeErrorZ
14581 pub union CResult_SpliceDecodeErrorZPtr {
14582 /// A pointer to the contents in the success state.
14583 /// Reading from this pointer when `result_ok` is not set is undefined.
14584 pub result: *mut crate::lightning::ln::msgs::Splice,
14585 /// A pointer to the contents in the error state.
14586 /// Reading from this pointer when `result_ok` is set is undefined.
14587 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14590 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
14591 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
14592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14593 pub struct CResult_SpliceDecodeErrorZ {
14594 /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
14595 /// `err` or `result` depending on the state of `result_ok`.
14596 pub contents: CResult_SpliceDecodeErrorZPtr,
14597 /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
14598 pub result_ok: bool,
14601 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
14602 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
14603 CResult_SpliceDecodeErrorZ {
14604 contents: CResult_SpliceDecodeErrorZPtr {
14605 result: Box::into_raw(Box::new(o)),
14611 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
14612 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
14613 CResult_SpliceDecodeErrorZ {
14614 contents: CResult_SpliceDecodeErrorZPtr {
14615 err: Box::into_raw(Box::new(e)),
14620 /// Checks if the given object is currently in the success state
14622 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
14626 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
14627 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
14628 impl Drop for CResult_SpliceDecodeErrorZ {
14629 fn drop(&mut self) {
14630 if self.result_ok {
14631 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14632 let _ = unsafe { Box::from_raw(self.contents.result) };
14635 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14636 let _ = unsafe { Box::from_raw(self.contents.err) };
14641 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
14642 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
14643 let contents = if o.result_ok {
14644 let result = unsafe { o.contents.result };
14645 unsafe { o.contents.result = core::ptr::null_mut() };
14646 CResult_SpliceDecodeErrorZPtr { result }
14648 let err = unsafe { o.contents.err };
14649 unsafe { o.contents.err = core::ptr::null_mut(); }
14650 CResult_SpliceDecodeErrorZPtr { err }
14654 result_ok: o.result_ok,
14658 impl Clone for CResult_SpliceDecodeErrorZ {
14659 fn clone(&self) -> Self {
14660 if self.result_ok {
14661 Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
14662 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
14665 Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
14666 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14672 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
14673 /// but with all dynamically-allocated buffers duplicated in new buffers.
14674 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
14676 /// The contents of CResult_SpliceAckDecodeErrorZ
14677 pub union CResult_SpliceAckDecodeErrorZPtr {
14678 /// A pointer to the contents in the success state.
14679 /// Reading from this pointer when `result_ok` is not set is undefined.
14680 pub result: *mut crate::lightning::ln::msgs::SpliceAck,
14681 /// A pointer to the contents in the error state.
14682 /// Reading from this pointer when `result_ok` is set is undefined.
14683 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14686 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
14687 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
14688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14689 pub struct CResult_SpliceAckDecodeErrorZ {
14690 /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
14691 /// `err` or `result` depending on the state of `result_ok`.
14692 pub contents: CResult_SpliceAckDecodeErrorZPtr,
14693 /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
14694 pub result_ok: bool,
14697 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
14698 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
14699 CResult_SpliceAckDecodeErrorZ {
14700 contents: CResult_SpliceAckDecodeErrorZPtr {
14701 result: Box::into_raw(Box::new(o)),
14707 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
14708 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
14709 CResult_SpliceAckDecodeErrorZ {
14710 contents: CResult_SpliceAckDecodeErrorZPtr {
14711 err: Box::into_raw(Box::new(e)),
14716 /// Checks if the given object is currently in the success state
14718 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
14722 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
14723 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
14724 impl Drop for CResult_SpliceAckDecodeErrorZ {
14725 fn drop(&mut self) {
14726 if self.result_ok {
14727 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14728 let _ = unsafe { Box::from_raw(self.contents.result) };
14731 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14732 let _ = unsafe { Box::from_raw(self.contents.err) };
14737 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
14738 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
14739 let contents = if o.result_ok {
14740 let result = unsafe { o.contents.result };
14741 unsafe { o.contents.result = core::ptr::null_mut() };
14742 CResult_SpliceAckDecodeErrorZPtr { result }
14744 let err = unsafe { o.contents.err };
14745 unsafe { o.contents.err = core::ptr::null_mut(); }
14746 CResult_SpliceAckDecodeErrorZPtr { err }
14750 result_ok: o.result_ok,
14754 impl Clone for CResult_SpliceAckDecodeErrorZ {
14755 fn clone(&self) -> Self {
14756 if self.result_ok {
14757 Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
14758 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
14761 Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
14762 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14768 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
14769 /// but with all dynamically-allocated buffers duplicated in new buffers.
14770 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
14772 /// The contents of CResult_SpliceLockedDecodeErrorZ
14773 pub union CResult_SpliceLockedDecodeErrorZPtr {
14774 /// A pointer to the contents in the success state.
14775 /// Reading from this pointer when `result_ok` is not set is undefined.
14776 pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
14777 /// A pointer to the contents in the error state.
14778 /// Reading from this pointer when `result_ok` is set is undefined.
14779 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14782 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
14783 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
14784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14785 pub struct CResult_SpliceLockedDecodeErrorZ {
14786 /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
14787 /// `err` or `result` depending on the state of `result_ok`.
14788 pub contents: CResult_SpliceLockedDecodeErrorZPtr,
14789 /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
14790 pub result_ok: bool,
14793 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
14794 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
14795 CResult_SpliceLockedDecodeErrorZ {
14796 contents: CResult_SpliceLockedDecodeErrorZPtr {
14797 result: Box::into_raw(Box::new(o)),
14803 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
14804 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
14805 CResult_SpliceLockedDecodeErrorZ {
14806 contents: CResult_SpliceLockedDecodeErrorZPtr {
14807 err: Box::into_raw(Box::new(e)),
14812 /// Checks if the given object is currently in the success state
14814 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
14818 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
14819 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
14820 impl Drop for CResult_SpliceLockedDecodeErrorZ {
14821 fn drop(&mut self) {
14822 if self.result_ok {
14823 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14824 let _ = unsafe { Box::from_raw(self.contents.result) };
14827 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14828 let _ = unsafe { Box::from_raw(self.contents.err) };
14833 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
14834 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
14835 let contents = if o.result_ok {
14836 let result = unsafe { o.contents.result };
14837 unsafe { o.contents.result = core::ptr::null_mut() };
14838 CResult_SpliceLockedDecodeErrorZPtr { result }
14840 let err = unsafe { o.contents.err };
14841 unsafe { o.contents.err = core::ptr::null_mut(); }
14842 CResult_SpliceLockedDecodeErrorZPtr { err }
14846 result_ok: o.result_ok,
14850 impl Clone for CResult_SpliceLockedDecodeErrorZ {
14851 fn clone(&self) -> Self {
14852 if self.result_ok {
14853 Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
14854 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
14857 Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
14858 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14864 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
14865 /// but with all dynamically-allocated buffers duplicated in new buffers.
14866 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
14868 /// The contents of CResult_TxAddInputDecodeErrorZ
14869 pub union CResult_TxAddInputDecodeErrorZPtr {
14870 /// A pointer to the contents in the success state.
14871 /// Reading from this pointer when `result_ok` is not set is undefined.
14872 pub result: *mut crate::lightning::ln::msgs::TxAddInput,
14873 /// A pointer to the contents in the error state.
14874 /// Reading from this pointer when `result_ok` is set is undefined.
14875 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14878 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
14879 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14880 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14881 pub struct CResult_TxAddInputDecodeErrorZ {
14882 /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
14883 /// `err` or `result` depending on the state of `result_ok`.
14884 pub contents: CResult_TxAddInputDecodeErrorZPtr,
14885 /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
14886 pub result_ok: bool,
14889 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
14890 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
14891 CResult_TxAddInputDecodeErrorZ {
14892 contents: CResult_TxAddInputDecodeErrorZPtr {
14893 result: Box::into_raw(Box::new(o)),
14899 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
14900 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
14901 CResult_TxAddInputDecodeErrorZ {
14902 contents: CResult_TxAddInputDecodeErrorZPtr {
14903 err: Box::into_raw(Box::new(e)),
14908 /// Checks if the given object is currently in the success state
14910 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
14914 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
14915 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
14916 impl Drop for CResult_TxAddInputDecodeErrorZ {
14917 fn drop(&mut self) {
14918 if self.result_ok {
14919 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14920 let _ = unsafe { Box::from_raw(self.contents.result) };
14923 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14924 let _ = unsafe { Box::from_raw(self.contents.err) };
14929 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
14930 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
14931 let contents = if o.result_ok {
14932 let result = unsafe { o.contents.result };
14933 unsafe { o.contents.result = core::ptr::null_mut() };
14934 CResult_TxAddInputDecodeErrorZPtr { result }
14936 let err = unsafe { o.contents.err };
14937 unsafe { o.contents.err = core::ptr::null_mut(); }
14938 CResult_TxAddInputDecodeErrorZPtr { err }
14942 result_ok: o.result_ok,
14946 impl Clone for CResult_TxAddInputDecodeErrorZ {
14947 fn clone(&self) -> Self {
14948 if self.result_ok {
14949 Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
14950 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
14953 Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
14954 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14960 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
14961 /// but with all dynamically-allocated buffers duplicated in new buffers.
14962 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
14964 /// The contents of CResult_TxAddOutputDecodeErrorZ
14965 pub union CResult_TxAddOutputDecodeErrorZPtr {
14966 /// A pointer to the contents in the success state.
14967 /// Reading from this pointer when `result_ok` is not set is undefined.
14968 pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
14969 /// A pointer to the contents in the error state.
14970 /// Reading from this pointer when `result_ok` is set is undefined.
14971 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14974 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
14975 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14977 pub struct CResult_TxAddOutputDecodeErrorZ {
14978 /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
14979 /// `err` or `result` depending on the state of `result_ok`.
14980 pub contents: CResult_TxAddOutputDecodeErrorZPtr,
14981 /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
14982 pub result_ok: bool,
14985 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
14986 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
14987 CResult_TxAddOutputDecodeErrorZ {
14988 contents: CResult_TxAddOutputDecodeErrorZPtr {
14989 result: Box::into_raw(Box::new(o)),
14995 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
14996 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
14997 CResult_TxAddOutputDecodeErrorZ {
14998 contents: CResult_TxAddOutputDecodeErrorZPtr {
14999 err: Box::into_raw(Box::new(e)),
15004 /// Checks if the given object is currently in the success state
15006 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
15010 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
15011 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
15012 impl Drop for CResult_TxAddOutputDecodeErrorZ {
15013 fn drop(&mut self) {
15014 if self.result_ok {
15015 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15016 let _ = unsafe { Box::from_raw(self.contents.result) };
15019 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15020 let _ = unsafe { Box::from_raw(self.contents.err) };
15025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
15026 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
15027 let contents = if o.result_ok {
15028 let result = unsafe { o.contents.result };
15029 unsafe { o.contents.result = core::ptr::null_mut() };
15030 CResult_TxAddOutputDecodeErrorZPtr { result }
15032 let err = unsafe { o.contents.err };
15033 unsafe { o.contents.err = core::ptr::null_mut(); }
15034 CResult_TxAddOutputDecodeErrorZPtr { err }
15038 result_ok: o.result_ok,
15042 impl Clone for CResult_TxAddOutputDecodeErrorZ {
15043 fn clone(&self) -> Self {
15044 if self.result_ok {
15045 Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
15046 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
15049 Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
15050 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15056 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
15057 /// but with all dynamically-allocated buffers duplicated in new buffers.
15058 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
15060 /// The contents of CResult_TxRemoveInputDecodeErrorZ
15061 pub union CResult_TxRemoveInputDecodeErrorZPtr {
15062 /// A pointer to the contents in the success state.
15063 /// Reading from this pointer when `result_ok` is not set is undefined.
15064 pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
15065 /// A pointer to the contents in the error state.
15066 /// Reading from this pointer when `result_ok` is set is undefined.
15067 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15070 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
15071 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
15072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15073 pub struct CResult_TxRemoveInputDecodeErrorZ {
15074 /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
15075 /// `err` or `result` depending on the state of `result_ok`.
15076 pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
15077 /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
15078 pub result_ok: bool,
15081 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
15082 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
15083 CResult_TxRemoveInputDecodeErrorZ {
15084 contents: CResult_TxRemoveInputDecodeErrorZPtr {
15085 result: Box::into_raw(Box::new(o)),
15091 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
15092 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
15093 CResult_TxRemoveInputDecodeErrorZ {
15094 contents: CResult_TxRemoveInputDecodeErrorZPtr {
15095 err: Box::into_raw(Box::new(e)),
15100 /// Checks if the given object is currently in the success state
15102 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
15106 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
15107 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
15108 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
15109 fn drop(&mut self) {
15110 if self.result_ok {
15111 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15112 let _ = unsafe { Box::from_raw(self.contents.result) };
15115 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15116 let _ = unsafe { Box::from_raw(self.contents.err) };
15121 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
15122 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
15123 let contents = if o.result_ok {
15124 let result = unsafe { o.contents.result };
15125 unsafe { o.contents.result = core::ptr::null_mut() };
15126 CResult_TxRemoveInputDecodeErrorZPtr { result }
15128 let err = unsafe { o.contents.err };
15129 unsafe { o.contents.err = core::ptr::null_mut(); }
15130 CResult_TxRemoveInputDecodeErrorZPtr { err }
15134 result_ok: o.result_ok,
15138 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
15139 fn clone(&self) -> Self {
15140 if self.result_ok {
15141 Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
15142 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
15145 Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
15146 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15152 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
15153 /// but with all dynamically-allocated buffers duplicated in new buffers.
15154 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
15156 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
15157 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
15158 /// A pointer to the contents in the success state.
15159 /// Reading from this pointer when `result_ok` is not set is undefined.
15160 pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
15161 /// A pointer to the contents in the error state.
15162 /// Reading from this pointer when `result_ok` is set is undefined.
15163 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15166 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
15167 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
15168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15169 pub struct CResult_TxRemoveOutputDecodeErrorZ {
15170 /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
15171 /// `err` or `result` depending on the state of `result_ok`.
15172 pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
15173 /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
15174 pub result_ok: bool,
15177 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
15178 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
15179 CResult_TxRemoveOutputDecodeErrorZ {
15180 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15181 result: Box::into_raw(Box::new(o)),
15187 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
15188 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
15189 CResult_TxRemoveOutputDecodeErrorZ {
15190 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15191 err: Box::into_raw(Box::new(e)),
15196 /// Checks if the given object is currently in the success state
15198 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
15202 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
15203 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
15204 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
15205 fn drop(&mut self) {
15206 if self.result_ok {
15207 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15208 let _ = unsafe { Box::from_raw(self.contents.result) };
15211 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15212 let _ = unsafe { Box::from_raw(self.contents.err) };
15217 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
15218 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
15219 let contents = if o.result_ok {
15220 let result = unsafe { o.contents.result };
15221 unsafe { o.contents.result = core::ptr::null_mut() };
15222 CResult_TxRemoveOutputDecodeErrorZPtr { result }
15224 let err = unsafe { o.contents.err };
15225 unsafe { o.contents.err = core::ptr::null_mut(); }
15226 CResult_TxRemoveOutputDecodeErrorZPtr { err }
15230 result_ok: o.result_ok,
15234 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
15235 fn clone(&self) -> Self {
15236 if self.result_ok {
15237 Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15238 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
15241 Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
15242 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15248 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
15249 /// but with all dynamically-allocated buffers duplicated in new buffers.
15250 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
15252 /// The contents of CResult_TxCompleteDecodeErrorZ
15253 pub union CResult_TxCompleteDecodeErrorZPtr {
15254 /// A pointer to the contents in the success state.
15255 /// Reading from this pointer when `result_ok` is not set is undefined.
15256 pub result: *mut crate::lightning::ln::msgs::TxComplete,
15257 /// A pointer to the contents in the error state.
15258 /// Reading from this pointer when `result_ok` is set is undefined.
15259 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15262 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
15263 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
15264 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15265 pub struct CResult_TxCompleteDecodeErrorZ {
15266 /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
15267 /// `err` or `result` depending on the state of `result_ok`.
15268 pub contents: CResult_TxCompleteDecodeErrorZPtr,
15269 /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
15270 pub result_ok: bool,
15273 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
15274 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
15275 CResult_TxCompleteDecodeErrorZ {
15276 contents: CResult_TxCompleteDecodeErrorZPtr {
15277 result: Box::into_raw(Box::new(o)),
15283 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
15284 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
15285 CResult_TxCompleteDecodeErrorZ {
15286 contents: CResult_TxCompleteDecodeErrorZPtr {
15287 err: Box::into_raw(Box::new(e)),
15292 /// Checks if the given object is currently in the success state
15294 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
15298 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
15299 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
15300 impl Drop for CResult_TxCompleteDecodeErrorZ {
15301 fn drop(&mut self) {
15302 if self.result_ok {
15303 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15304 let _ = unsafe { Box::from_raw(self.contents.result) };
15307 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15308 let _ = unsafe { Box::from_raw(self.contents.err) };
15313 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
15314 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
15315 let contents = if o.result_ok {
15316 let result = unsafe { o.contents.result };
15317 unsafe { o.contents.result = core::ptr::null_mut() };
15318 CResult_TxCompleteDecodeErrorZPtr { result }
15320 let err = unsafe { o.contents.err };
15321 unsafe { o.contents.err = core::ptr::null_mut(); }
15322 CResult_TxCompleteDecodeErrorZPtr { err }
15326 result_ok: o.result_ok,
15330 impl Clone for CResult_TxCompleteDecodeErrorZ {
15331 fn clone(&self) -> Self {
15332 if self.result_ok {
15333 Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
15334 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
15337 Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
15338 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15344 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
15345 /// but with all dynamically-allocated buffers duplicated in new buffers.
15346 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
15348 /// The contents of CResult_TxSignaturesDecodeErrorZ
15349 pub union CResult_TxSignaturesDecodeErrorZPtr {
15350 /// A pointer to the contents in the success state.
15351 /// Reading from this pointer when `result_ok` is not set is undefined.
15352 pub result: *mut crate::lightning::ln::msgs::TxSignatures,
15353 /// A pointer to the contents in the error state.
15354 /// Reading from this pointer when `result_ok` is set is undefined.
15355 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15358 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
15359 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
15360 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15361 pub struct CResult_TxSignaturesDecodeErrorZ {
15362 /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
15363 /// `err` or `result` depending on the state of `result_ok`.
15364 pub contents: CResult_TxSignaturesDecodeErrorZPtr,
15365 /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
15366 pub result_ok: bool,
15369 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
15370 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
15371 CResult_TxSignaturesDecodeErrorZ {
15372 contents: CResult_TxSignaturesDecodeErrorZPtr {
15373 result: Box::into_raw(Box::new(o)),
15379 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
15380 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
15381 CResult_TxSignaturesDecodeErrorZ {
15382 contents: CResult_TxSignaturesDecodeErrorZPtr {
15383 err: Box::into_raw(Box::new(e)),
15388 /// Checks if the given object is currently in the success state
15390 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
15394 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
15395 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
15396 impl Drop for CResult_TxSignaturesDecodeErrorZ {
15397 fn drop(&mut self) {
15398 if self.result_ok {
15399 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15400 let _ = unsafe { Box::from_raw(self.contents.result) };
15403 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15404 let _ = unsafe { Box::from_raw(self.contents.err) };
15409 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
15410 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
15411 let contents = if o.result_ok {
15412 let result = unsafe { o.contents.result };
15413 unsafe { o.contents.result = core::ptr::null_mut() };
15414 CResult_TxSignaturesDecodeErrorZPtr { result }
15416 let err = unsafe { o.contents.err };
15417 unsafe { o.contents.err = core::ptr::null_mut(); }
15418 CResult_TxSignaturesDecodeErrorZPtr { err }
15422 result_ok: o.result_ok,
15426 impl Clone for CResult_TxSignaturesDecodeErrorZ {
15427 fn clone(&self) -> Self {
15428 if self.result_ok {
15429 Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
15430 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
15433 Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
15434 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15440 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
15441 /// but with all dynamically-allocated buffers duplicated in new buffers.
15442 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
15444 /// The contents of CResult_TxInitRbfDecodeErrorZ
15445 pub union CResult_TxInitRbfDecodeErrorZPtr {
15446 /// A pointer to the contents in the success state.
15447 /// Reading from this pointer when `result_ok` is not set is undefined.
15448 pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
15449 /// A pointer to the contents in the error state.
15450 /// Reading from this pointer when `result_ok` is set is undefined.
15451 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15454 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
15455 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
15456 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15457 pub struct CResult_TxInitRbfDecodeErrorZ {
15458 /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
15459 /// `err` or `result` depending on the state of `result_ok`.
15460 pub contents: CResult_TxInitRbfDecodeErrorZPtr,
15461 /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
15462 pub result_ok: bool,
15465 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
15466 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
15467 CResult_TxInitRbfDecodeErrorZ {
15468 contents: CResult_TxInitRbfDecodeErrorZPtr {
15469 result: Box::into_raw(Box::new(o)),
15475 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
15476 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
15477 CResult_TxInitRbfDecodeErrorZ {
15478 contents: CResult_TxInitRbfDecodeErrorZPtr {
15479 err: Box::into_raw(Box::new(e)),
15484 /// Checks if the given object is currently in the success state
15486 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
15490 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
15491 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
15492 impl Drop for CResult_TxInitRbfDecodeErrorZ {
15493 fn drop(&mut self) {
15494 if self.result_ok {
15495 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15496 let _ = unsafe { Box::from_raw(self.contents.result) };
15499 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15500 let _ = unsafe { Box::from_raw(self.contents.err) };
15505 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
15506 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
15507 let contents = if o.result_ok {
15508 let result = unsafe { o.contents.result };
15509 unsafe { o.contents.result = core::ptr::null_mut() };
15510 CResult_TxInitRbfDecodeErrorZPtr { result }
15512 let err = unsafe { o.contents.err };
15513 unsafe { o.contents.err = core::ptr::null_mut(); }
15514 CResult_TxInitRbfDecodeErrorZPtr { err }
15518 result_ok: o.result_ok,
15522 impl Clone for CResult_TxInitRbfDecodeErrorZ {
15523 fn clone(&self) -> Self {
15524 if self.result_ok {
15525 Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
15526 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
15529 Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
15530 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15536 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
15537 /// but with all dynamically-allocated buffers duplicated in new buffers.
15538 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
15540 /// The contents of CResult_TxAckRbfDecodeErrorZ
15541 pub union CResult_TxAckRbfDecodeErrorZPtr {
15542 /// A pointer to the contents in the success state.
15543 /// Reading from this pointer when `result_ok` is not set is undefined.
15544 pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
15545 /// A pointer to the contents in the error state.
15546 /// Reading from this pointer when `result_ok` is set is undefined.
15547 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15550 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
15551 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
15552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15553 pub struct CResult_TxAckRbfDecodeErrorZ {
15554 /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
15555 /// `err` or `result` depending on the state of `result_ok`.
15556 pub contents: CResult_TxAckRbfDecodeErrorZPtr,
15557 /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
15558 pub result_ok: bool,
15561 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
15562 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
15563 CResult_TxAckRbfDecodeErrorZ {
15564 contents: CResult_TxAckRbfDecodeErrorZPtr {
15565 result: Box::into_raw(Box::new(o)),
15571 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
15572 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
15573 CResult_TxAckRbfDecodeErrorZ {
15574 contents: CResult_TxAckRbfDecodeErrorZPtr {
15575 err: Box::into_raw(Box::new(e)),
15580 /// Checks if the given object is currently in the success state
15582 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
15586 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
15587 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
15588 impl Drop for CResult_TxAckRbfDecodeErrorZ {
15589 fn drop(&mut self) {
15590 if self.result_ok {
15591 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15592 let _ = unsafe { Box::from_raw(self.contents.result) };
15595 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15596 let _ = unsafe { Box::from_raw(self.contents.err) };
15601 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
15602 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
15603 let contents = if o.result_ok {
15604 let result = unsafe { o.contents.result };
15605 unsafe { o.contents.result = core::ptr::null_mut() };
15606 CResult_TxAckRbfDecodeErrorZPtr { result }
15608 let err = unsafe { o.contents.err };
15609 unsafe { o.contents.err = core::ptr::null_mut(); }
15610 CResult_TxAckRbfDecodeErrorZPtr { err }
15614 result_ok: o.result_ok,
15618 impl Clone for CResult_TxAckRbfDecodeErrorZ {
15619 fn clone(&self) -> Self {
15620 if self.result_ok {
15621 Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
15622 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
15625 Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
15626 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15632 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
15633 /// but with all dynamically-allocated buffers duplicated in new buffers.
15634 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
15636 /// The contents of CResult_TxAbortDecodeErrorZ
15637 pub union CResult_TxAbortDecodeErrorZPtr {
15638 /// A pointer to the contents in the success state.
15639 /// Reading from this pointer when `result_ok` is not set is undefined.
15640 pub result: *mut crate::lightning::ln::msgs::TxAbort,
15641 /// A pointer to the contents in the error state.
15642 /// Reading from this pointer when `result_ok` is set is undefined.
15643 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15646 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
15647 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
15648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15649 pub struct CResult_TxAbortDecodeErrorZ {
15650 /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
15651 /// `err` or `result` depending on the state of `result_ok`.
15652 pub contents: CResult_TxAbortDecodeErrorZPtr,
15653 /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
15654 pub result_ok: bool,
15657 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
15658 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
15659 CResult_TxAbortDecodeErrorZ {
15660 contents: CResult_TxAbortDecodeErrorZPtr {
15661 result: Box::into_raw(Box::new(o)),
15667 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
15668 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
15669 CResult_TxAbortDecodeErrorZ {
15670 contents: CResult_TxAbortDecodeErrorZPtr {
15671 err: Box::into_raw(Box::new(e)),
15676 /// Checks if the given object is currently in the success state
15678 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
15682 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
15683 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
15684 impl Drop for CResult_TxAbortDecodeErrorZ {
15685 fn drop(&mut self) {
15686 if self.result_ok {
15687 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15688 let _ = unsafe { Box::from_raw(self.contents.result) };
15691 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15692 let _ = unsafe { Box::from_raw(self.contents.err) };
15697 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
15698 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
15699 let contents = if o.result_ok {
15700 let result = unsafe { o.contents.result };
15701 unsafe { o.contents.result = core::ptr::null_mut() };
15702 CResult_TxAbortDecodeErrorZPtr { result }
15704 let err = unsafe { o.contents.err };
15705 unsafe { o.contents.err = core::ptr::null_mut(); }
15706 CResult_TxAbortDecodeErrorZPtr { err }
15710 result_ok: o.result_ok,
15714 impl Clone for CResult_TxAbortDecodeErrorZ {
15715 fn clone(&self) -> Self {
15716 if self.result_ok {
15717 Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
15718 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
15721 Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
15722 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15728 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
15729 /// but with all dynamically-allocated buffers duplicated in new buffers.
15730 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
15732 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
15733 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
15734 /// A pointer to the contents in the success state.
15735 /// Reading from this pointer when `result_ok` is not set is undefined.
15736 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
15737 /// A pointer to the contents in the error state.
15738 /// Reading from this pointer when `result_ok` is set is undefined.
15739 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15742 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
15743 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
15744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15745 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
15746 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
15747 /// `err` or `result` depending on the state of `result_ok`.
15748 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
15749 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
15750 pub result_ok: bool,
15753 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
15754 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
15755 CResult_AnnouncementSignaturesDecodeErrorZ {
15756 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15757 result: Box::into_raw(Box::new(o)),
15763 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
15764 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
15765 CResult_AnnouncementSignaturesDecodeErrorZ {
15766 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15767 err: Box::into_raw(Box::new(e)),
15772 /// Checks if the given object is currently in the success state
15774 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
15778 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
15779 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
15780 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
15781 fn drop(&mut self) {
15782 if self.result_ok {
15783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15784 let _ = unsafe { Box::from_raw(self.contents.result) };
15787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15788 let _ = unsafe { Box::from_raw(self.contents.err) };
15793 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
15794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
15795 let contents = if o.result_ok {
15796 let result = unsafe { o.contents.result };
15797 unsafe { o.contents.result = core::ptr::null_mut() };
15798 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
15800 let err = unsafe { o.contents.err };
15801 unsafe { o.contents.err = core::ptr::null_mut(); }
15802 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
15806 result_ok: o.result_ok,
15810 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
15811 fn clone(&self) -> Self {
15812 if self.result_ok {
15813 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15814 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
15817 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
15818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15824 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
15825 /// but with all dynamically-allocated buffers duplicated in new buffers.
15826 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
15828 /// The contents of CResult_ChannelReestablishDecodeErrorZ
15829 pub union CResult_ChannelReestablishDecodeErrorZPtr {
15830 /// A pointer to the contents in the success state.
15831 /// Reading from this pointer when `result_ok` is not set is undefined.
15832 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
15833 /// A pointer to the contents in the error state.
15834 /// Reading from this pointer when `result_ok` is set is undefined.
15835 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15838 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
15839 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
15840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15841 pub struct CResult_ChannelReestablishDecodeErrorZ {
15842 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
15843 /// `err` or `result` depending on the state of `result_ok`.
15844 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
15845 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
15846 pub result_ok: bool,
15849 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
15850 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
15851 CResult_ChannelReestablishDecodeErrorZ {
15852 contents: CResult_ChannelReestablishDecodeErrorZPtr {
15853 result: Box::into_raw(Box::new(o)),
15859 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
15860 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
15861 CResult_ChannelReestablishDecodeErrorZ {
15862 contents: CResult_ChannelReestablishDecodeErrorZPtr {
15863 err: Box::into_raw(Box::new(e)),
15868 /// Checks if the given object is currently in the success state
15870 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
15874 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
15875 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
15876 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
15877 fn drop(&mut self) {
15878 if self.result_ok {
15879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15880 let _ = unsafe { Box::from_raw(self.contents.result) };
15883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15884 let _ = unsafe { Box::from_raw(self.contents.err) };
15889 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
15890 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
15891 let contents = if o.result_ok {
15892 let result = unsafe { o.contents.result };
15893 unsafe { o.contents.result = core::ptr::null_mut() };
15894 CResult_ChannelReestablishDecodeErrorZPtr { result }
15896 let err = unsafe { o.contents.err };
15897 unsafe { o.contents.err = core::ptr::null_mut(); }
15898 CResult_ChannelReestablishDecodeErrorZPtr { err }
15902 result_ok: o.result_ok,
15906 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
15907 fn clone(&self) -> Self {
15908 if self.result_ok {
15909 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
15910 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
15913 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
15914 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15920 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
15921 /// but with all dynamically-allocated buffers duplicated in new buffers.
15922 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
15924 /// The contents of CResult_ClosingSignedDecodeErrorZ
15925 pub union CResult_ClosingSignedDecodeErrorZPtr {
15926 /// A pointer to the contents in the success state.
15927 /// Reading from this pointer when `result_ok` is not set is undefined.
15928 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
15929 /// A pointer to the contents in the error state.
15930 /// Reading from this pointer when `result_ok` is set is undefined.
15931 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15934 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
15935 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15936 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15937 pub struct CResult_ClosingSignedDecodeErrorZ {
15938 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
15939 /// `err` or `result` depending on the state of `result_ok`.
15940 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
15941 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
15942 pub result_ok: bool,
15945 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
15946 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
15947 CResult_ClosingSignedDecodeErrorZ {
15948 contents: CResult_ClosingSignedDecodeErrorZPtr {
15949 result: Box::into_raw(Box::new(o)),
15955 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
15956 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
15957 CResult_ClosingSignedDecodeErrorZ {
15958 contents: CResult_ClosingSignedDecodeErrorZPtr {
15959 err: Box::into_raw(Box::new(e)),
15964 /// Checks if the given object is currently in the success state
15966 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
15970 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
15971 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
15972 impl Drop for CResult_ClosingSignedDecodeErrorZ {
15973 fn drop(&mut self) {
15974 if self.result_ok {
15975 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15976 let _ = unsafe { Box::from_raw(self.contents.result) };
15979 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15980 let _ = unsafe { Box::from_raw(self.contents.err) };
15985 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
15986 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15987 let contents = if o.result_ok {
15988 let result = unsafe { o.contents.result };
15989 unsafe { o.contents.result = core::ptr::null_mut() };
15990 CResult_ClosingSignedDecodeErrorZPtr { result }
15992 let err = unsafe { o.contents.err };
15993 unsafe { o.contents.err = core::ptr::null_mut(); }
15994 CResult_ClosingSignedDecodeErrorZPtr { err }
15998 result_ok: o.result_ok,
16002 impl Clone for CResult_ClosingSignedDecodeErrorZ {
16003 fn clone(&self) -> Self {
16004 if self.result_ok {
16005 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
16006 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
16009 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
16010 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16016 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
16017 /// but with all dynamically-allocated buffers duplicated in new buffers.
16018 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
16020 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
16021 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16022 /// A pointer to the contents in the success state.
16023 /// Reading from this pointer when `result_ok` is not set is undefined.
16024 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
16025 /// A pointer to the contents in the error state.
16026 /// Reading from this pointer when `result_ok` is set is undefined.
16027 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16030 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
16031 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16033 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
16034 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
16035 /// `err` or `result` depending on the state of `result_ok`.
16036 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
16037 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
16038 pub result_ok: bool,
16041 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
16042 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
16043 CResult_ClosingSignedFeeRangeDecodeErrorZ {
16044 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16045 result: Box::into_raw(Box::new(o)),
16051 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
16052 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
16053 CResult_ClosingSignedFeeRangeDecodeErrorZ {
16054 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16055 err: Box::into_raw(Box::new(e)),
16060 /// Checks if the given object is currently in the success state
16062 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
16066 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
16067 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
16068 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
16069 fn drop(&mut self) {
16070 if self.result_ok {
16071 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16072 let _ = unsafe { Box::from_raw(self.contents.result) };
16075 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16076 let _ = unsafe { Box::from_raw(self.contents.err) };
16081 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
16082 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16083 let contents = if o.result_ok {
16084 let result = unsafe { o.contents.result };
16085 unsafe { o.contents.result = core::ptr::null_mut() };
16086 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
16088 let err = unsafe { o.contents.err };
16089 unsafe { o.contents.err = core::ptr::null_mut(); }
16090 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
16094 result_ok: o.result_ok,
16098 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
16099 fn clone(&self) -> Self {
16100 if self.result_ok {
16101 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16102 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
16105 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
16106 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16112 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
16113 /// but with all dynamically-allocated buffers duplicated in new buffers.
16114 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
16116 /// The contents of CResult_CommitmentSignedDecodeErrorZ
16117 pub union CResult_CommitmentSignedDecodeErrorZPtr {
16118 /// A pointer to the contents in the success state.
16119 /// Reading from this pointer when `result_ok` is not set is undefined.
16120 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
16121 /// A pointer to the contents in the error state.
16122 /// Reading from this pointer when `result_ok` is set is undefined.
16123 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16126 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
16127 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
16128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16129 pub struct CResult_CommitmentSignedDecodeErrorZ {
16130 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
16131 /// `err` or `result` depending on the state of `result_ok`.
16132 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
16133 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
16134 pub result_ok: bool,
16137 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
16138 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
16139 CResult_CommitmentSignedDecodeErrorZ {
16140 contents: CResult_CommitmentSignedDecodeErrorZPtr {
16141 result: Box::into_raw(Box::new(o)),
16147 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
16148 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
16149 CResult_CommitmentSignedDecodeErrorZ {
16150 contents: CResult_CommitmentSignedDecodeErrorZPtr {
16151 err: Box::into_raw(Box::new(e)),
16156 /// Checks if the given object is currently in the success state
16158 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
16162 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
16163 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
16164 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
16165 fn drop(&mut self) {
16166 if self.result_ok {
16167 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16168 let _ = unsafe { Box::from_raw(self.contents.result) };
16171 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16172 let _ = unsafe { Box::from_raw(self.contents.err) };
16177 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
16178 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
16179 let contents = if o.result_ok {
16180 let result = unsafe { o.contents.result };
16181 unsafe { o.contents.result = core::ptr::null_mut() };
16182 CResult_CommitmentSignedDecodeErrorZPtr { result }
16184 let err = unsafe { o.contents.err };
16185 unsafe { o.contents.err = core::ptr::null_mut(); }
16186 CResult_CommitmentSignedDecodeErrorZPtr { err }
16190 result_ok: o.result_ok,
16194 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
16195 fn clone(&self) -> Self {
16196 if self.result_ok {
16197 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
16198 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
16201 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
16202 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16208 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
16209 /// but with all dynamically-allocated buffers duplicated in new buffers.
16210 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
16212 /// The contents of CResult_FundingCreatedDecodeErrorZ
16213 pub union CResult_FundingCreatedDecodeErrorZPtr {
16214 /// A pointer to the contents in the success state.
16215 /// Reading from this pointer when `result_ok` is not set is undefined.
16216 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
16217 /// A pointer to the contents in the error state.
16218 /// Reading from this pointer when `result_ok` is set is undefined.
16219 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16222 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
16223 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
16224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16225 pub struct CResult_FundingCreatedDecodeErrorZ {
16226 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
16227 /// `err` or `result` depending on the state of `result_ok`.
16228 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
16229 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
16230 pub result_ok: bool,
16233 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
16234 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
16235 CResult_FundingCreatedDecodeErrorZ {
16236 contents: CResult_FundingCreatedDecodeErrorZPtr {
16237 result: Box::into_raw(Box::new(o)),
16243 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
16244 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
16245 CResult_FundingCreatedDecodeErrorZ {
16246 contents: CResult_FundingCreatedDecodeErrorZPtr {
16247 err: Box::into_raw(Box::new(e)),
16252 /// Checks if the given object is currently in the success state
16254 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
16258 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
16259 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
16260 impl Drop for CResult_FundingCreatedDecodeErrorZ {
16261 fn drop(&mut self) {
16262 if self.result_ok {
16263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16264 let _ = unsafe { Box::from_raw(self.contents.result) };
16267 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16268 let _ = unsafe { Box::from_raw(self.contents.err) };
16273 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
16274 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
16275 let contents = if o.result_ok {
16276 let result = unsafe { o.contents.result };
16277 unsafe { o.contents.result = core::ptr::null_mut() };
16278 CResult_FundingCreatedDecodeErrorZPtr { result }
16280 let err = unsafe { o.contents.err };
16281 unsafe { o.contents.err = core::ptr::null_mut(); }
16282 CResult_FundingCreatedDecodeErrorZPtr { err }
16286 result_ok: o.result_ok,
16290 impl Clone for CResult_FundingCreatedDecodeErrorZ {
16291 fn clone(&self) -> Self {
16292 if self.result_ok {
16293 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
16294 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
16297 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
16298 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16304 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
16305 /// but with all dynamically-allocated buffers duplicated in new buffers.
16306 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
16308 /// The contents of CResult_FundingSignedDecodeErrorZ
16309 pub union CResult_FundingSignedDecodeErrorZPtr {
16310 /// A pointer to the contents in the success state.
16311 /// Reading from this pointer when `result_ok` is not set is undefined.
16312 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
16313 /// A pointer to the contents in the error state.
16314 /// Reading from this pointer when `result_ok` is set is undefined.
16315 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16318 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
16319 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
16320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16321 pub struct CResult_FundingSignedDecodeErrorZ {
16322 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
16323 /// `err` or `result` depending on the state of `result_ok`.
16324 pub contents: CResult_FundingSignedDecodeErrorZPtr,
16325 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
16326 pub result_ok: bool,
16329 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
16330 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
16331 CResult_FundingSignedDecodeErrorZ {
16332 contents: CResult_FundingSignedDecodeErrorZPtr {
16333 result: Box::into_raw(Box::new(o)),
16339 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
16340 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
16341 CResult_FundingSignedDecodeErrorZ {
16342 contents: CResult_FundingSignedDecodeErrorZPtr {
16343 err: Box::into_raw(Box::new(e)),
16348 /// Checks if the given object is currently in the success state
16350 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
16354 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
16355 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
16356 impl Drop for CResult_FundingSignedDecodeErrorZ {
16357 fn drop(&mut self) {
16358 if self.result_ok {
16359 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16360 let _ = unsafe { Box::from_raw(self.contents.result) };
16363 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16364 let _ = unsafe { Box::from_raw(self.contents.err) };
16369 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
16370 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
16371 let contents = if o.result_ok {
16372 let result = unsafe { o.contents.result };
16373 unsafe { o.contents.result = core::ptr::null_mut() };
16374 CResult_FundingSignedDecodeErrorZPtr { result }
16376 let err = unsafe { o.contents.err };
16377 unsafe { o.contents.err = core::ptr::null_mut(); }
16378 CResult_FundingSignedDecodeErrorZPtr { err }
16382 result_ok: o.result_ok,
16386 impl Clone for CResult_FundingSignedDecodeErrorZ {
16387 fn clone(&self) -> Self {
16388 if self.result_ok {
16389 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
16390 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
16393 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
16394 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16400 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
16401 /// but with all dynamically-allocated buffers duplicated in new buffers.
16402 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
16404 /// The contents of CResult_ChannelReadyDecodeErrorZ
16405 pub union CResult_ChannelReadyDecodeErrorZPtr {
16406 /// A pointer to the contents in the success state.
16407 /// Reading from this pointer when `result_ok` is not set is undefined.
16408 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
16409 /// A pointer to the contents in the error state.
16410 /// Reading from this pointer when `result_ok` is set is undefined.
16411 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16414 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
16415 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
16416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16417 pub struct CResult_ChannelReadyDecodeErrorZ {
16418 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
16419 /// `err` or `result` depending on the state of `result_ok`.
16420 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
16421 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
16422 pub result_ok: bool,
16425 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
16426 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
16427 CResult_ChannelReadyDecodeErrorZ {
16428 contents: CResult_ChannelReadyDecodeErrorZPtr {
16429 result: Box::into_raw(Box::new(o)),
16435 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
16436 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
16437 CResult_ChannelReadyDecodeErrorZ {
16438 contents: CResult_ChannelReadyDecodeErrorZPtr {
16439 err: Box::into_raw(Box::new(e)),
16444 /// Checks if the given object is currently in the success state
16446 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
16450 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
16451 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
16452 impl Drop for CResult_ChannelReadyDecodeErrorZ {
16453 fn drop(&mut self) {
16454 if self.result_ok {
16455 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16456 let _ = unsafe { Box::from_raw(self.contents.result) };
16459 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16460 let _ = unsafe { Box::from_raw(self.contents.err) };
16465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
16466 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
16467 let contents = if o.result_ok {
16468 let result = unsafe { o.contents.result };
16469 unsafe { o.contents.result = core::ptr::null_mut() };
16470 CResult_ChannelReadyDecodeErrorZPtr { result }
16472 let err = unsafe { o.contents.err };
16473 unsafe { o.contents.err = core::ptr::null_mut(); }
16474 CResult_ChannelReadyDecodeErrorZPtr { err }
16478 result_ok: o.result_ok,
16482 impl Clone for CResult_ChannelReadyDecodeErrorZ {
16483 fn clone(&self) -> Self {
16484 if self.result_ok {
16485 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
16486 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
16489 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
16490 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16496 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
16497 /// but with all dynamically-allocated buffers duplicated in new buffers.
16498 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
16500 /// The contents of CResult_InitDecodeErrorZ
16501 pub union CResult_InitDecodeErrorZPtr {
16502 /// A pointer to the contents in the success state.
16503 /// Reading from this pointer when `result_ok` is not set is undefined.
16504 pub result: *mut crate::lightning::ln::msgs::Init,
16505 /// A pointer to the contents in the error state.
16506 /// Reading from this pointer when `result_ok` is set is undefined.
16507 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16510 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
16511 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
16512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16513 pub struct CResult_InitDecodeErrorZ {
16514 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
16515 /// `err` or `result` depending on the state of `result_ok`.
16516 pub contents: CResult_InitDecodeErrorZPtr,
16517 /// Whether this CResult_InitDecodeErrorZ represents a success state.
16518 pub result_ok: bool,
16521 /// Creates a new CResult_InitDecodeErrorZ in the success state.
16522 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
16523 CResult_InitDecodeErrorZ {
16524 contents: CResult_InitDecodeErrorZPtr {
16525 result: Box::into_raw(Box::new(o)),
16531 /// Creates a new CResult_InitDecodeErrorZ in the error state.
16532 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
16533 CResult_InitDecodeErrorZ {
16534 contents: CResult_InitDecodeErrorZPtr {
16535 err: Box::into_raw(Box::new(e)),
16540 /// Checks if the given object is currently in the success state
16542 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
16546 /// Frees any resources used by the CResult_InitDecodeErrorZ.
16547 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
16548 impl Drop for CResult_InitDecodeErrorZ {
16549 fn drop(&mut self) {
16550 if self.result_ok {
16551 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16552 let _ = unsafe { Box::from_raw(self.contents.result) };
16555 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16556 let _ = unsafe { Box::from_raw(self.contents.err) };
16561 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
16562 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
16563 let contents = if o.result_ok {
16564 let result = unsafe { o.contents.result };
16565 unsafe { o.contents.result = core::ptr::null_mut() };
16566 CResult_InitDecodeErrorZPtr { result }
16568 let err = unsafe { o.contents.err };
16569 unsafe { o.contents.err = core::ptr::null_mut(); }
16570 CResult_InitDecodeErrorZPtr { err }
16574 result_ok: o.result_ok,
16578 impl Clone for CResult_InitDecodeErrorZ {
16579 fn clone(&self) -> Self {
16580 if self.result_ok {
16581 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
16582 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
16585 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
16586 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16592 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
16593 /// but with all dynamically-allocated buffers duplicated in new buffers.
16594 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
16596 /// The contents of CResult_OpenChannelDecodeErrorZ
16597 pub union CResult_OpenChannelDecodeErrorZPtr {
16598 /// A pointer to the contents in the success state.
16599 /// Reading from this pointer when `result_ok` is not set is undefined.
16600 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
16601 /// A pointer to the contents in the error state.
16602 /// Reading from this pointer when `result_ok` is set is undefined.
16603 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16606 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
16607 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
16608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16609 pub struct CResult_OpenChannelDecodeErrorZ {
16610 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
16611 /// `err` or `result` depending on the state of `result_ok`.
16612 pub contents: CResult_OpenChannelDecodeErrorZPtr,
16613 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
16614 pub result_ok: bool,
16617 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
16618 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
16619 CResult_OpenChannelDecodeErrorZ {
16620 contents: CResult_OpenChannelDecodeErrorZPtr {
16621 result: Box::into_raw(Box::new(o)),
16627 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
16628 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
16629 CResult_OpenChannelDecodeErrorZ {
16630 contents: CResult_OpenChannelDecodeErrorZPtr {
16631 err: Box::into_raw(Box::new(e)),
16636 /// Checks if the given object is currently in the success state
16638 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
16642 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
16643 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
16644 impl Drop for CResult_OpenChannelDecodeErrorZ {
16645 fn drop(&mut self) {
16646 if self.result_ok {
16647 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16648 let _ = unsafe { Box::from_raw(self.contents.result) };
16651 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16652 let _ = unsafe { Box::from_raw(self.contents.err) };
16657 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
16658 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
16659 let contents = if o.result_ok {
16660 let result = unsafe { o.contents.result };
16661 unsafe { o.contents.result = core::ptr::null_mut() };
16662 CResult_OpenChannelDecodeErrorZPtr { result }
16664 let err = unsafe { o.contents.err };
16665 unsafe { o.contents.err = core::ptr::null_mut(); }
16666 CResult_OpenChannelDecodeErrorZPtr { err }
16670 result_ok: o.result_ok,
16674 impl Clone for CResult_OpenChannelDecodeErrorZ {
16675 fn clone(&self) -> Self {
16676 if self.result_ok {
16677 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
16678 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
16681 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
16682 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16688 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
16689 /// but with all dynamically-allocated buffers duplicated in new buffers.
16690 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
16692 /// The contents of CResult_OpenChannelV2DecodeErrorZ
16693 pub union CResult_OpenChannelV2DecodeErrorZPtr {
16694 /// A pointer to the contents in the success state.
16695 /// Reading from this pointer when `result_ok` is not set is undefined.
16696 pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
16697 /// A pointer to the contents in the error state.
16698 /// Reading from this pointer when `result_ok` is set is undefined.
16699 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16702 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
16703 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
16704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16705 pub struct CResult_OpenChannelV2DecodeErrorZ {
16706 /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
16707 /// `err` or `result` depending on the state of `result_ok`.
16708 pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
16709 /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
16710 pub result_ok: bool,
16713 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
16714 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
16715 CResult_OpenChannelV2DecodeErrorZ {
16716 contents: CResult_OpenChannelV2DecodeErrorZPtr {
16717 result: Box::into_raw(Box::new(o)),
16723 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
16724 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
16725 CResult_OpenChannelV2DecodeErrorZ {
16726 contents: CResult_OpenChannelV2DecodeErrorZPtr {
16727 err: Box::into_raw(Box::new(e)),
16732 /// Checks if the given object is currently in the success state
16734 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
16738 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
16739 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
16740 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
16741 fn drop(&mut self) {
16742 if self.result_ok {
16743 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16744 let _ = unsafe { Box::from_raw(self.contents.result) };
16747 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16748 let _ = unsafe { Box::from_raw(self.contents.err) };
16753 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
16754 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
16755 let contents = if o.result_ok {
16756 let result = unsafe { o.contents.result };
16757 unsafe { o.contents.result = core::ptr::null_mut() };
16758 CResult_OpenChannelV2DecodeErrorZPtr { result }
16760 let err = unsafe { o.contents.err };
16761 unsafe { o.contents.err = core::ptr::null_mut(); }
16762 CResult_OpenChannelV2DecodeErrorZPtr { err }
16766 result_ok: o.result_ok,
16770 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
16771 fn clone(&self) -> Self {
16772 if self.result_ok {
16773 Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
16774 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
16777 Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
16778 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16784 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
16785 /// but with all dynamically-allocated buffers duplicated in new buffers.
16786 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
16788 /// The contents of CResult_RevokeAndACKDecodeErrorZ
16789 pub union CResult_RevokeAndACKDecodeErrorZPtr {
16790 /// A pointer to the contents in the success state.
16791 /// Reading from this pointer when `result_ok` is not set is undefined.
16792 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
16793 /// A pointer to the contents in the error state.
16794 /// Reading from this pointer when `result_ok` is set is undefined.
16795 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16798 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
16799 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
16800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16801 pub struct CResult_RevokeAndACKDecodeErrorZ {
16802 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
16803 /// `err` or `result` depending on the state of `result_ok`.
16804 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
16805 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
16806 pub result_ok: bool,
16809 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
16810 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
16811 CResult_RevokeAndACKDecodeErrorZ {
16812 contents: CResult_RevokeAndACKDecodeErrorZPtr {
16813 result: Box::into_raw(Box::new(o)),
16819 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
16820 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
16821 CResult_RevokeAndACKDecodeErrorZ {
16822 contents: CResult_RevokeAndACKDecodeErrorZPtr {
16823 err: Box::into_raw(Box::new(e)),
16828 /// Checks if the given object is currently in the success state
16830 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
16834 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
16835 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
16836 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
16837 fn drop(&mut self) {
16838 if self.result_ok {
16839 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16840 let _ = unsafe { Box::from_raw(self.contents.result) };
16843 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16844 let _ = unsafe { Box::from_raw(self.contents.err) };
16849 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
16850 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
16851 let contents = if o.result_ok {
16852 let result = unsafe { o.contents.result };
16853 unsafe { o.contents.result = core::ptr::null_mut() };
16854 CResult_RevokeAndACKDecodeErrorZPtr { result }
16856 let err = unsafe { o.contents.err };
16857 unsafe { o.contents.err = core::ptr::null_mut(); }
16858 CResult_RevokeAndACKDecodeErrorZPtr { err }
16862 result_ok: o.result_ok,
16866 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
16867 fn clone(&self) -> Self {
16868 if self.result_ok {
16869 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
16870 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
16873 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
16874 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16880 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
16881 /// but with all dynamically-allocated buffers duplicated in new buffers.
16882 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
16884 /// The contents of CResult_ShutdownDecodeErrorZ
16885 pub union CResult_ShutdownDecodeErrorZPtr {
16886 /// A pointer to the contents in the success state.
16887 /// Reading from this pointer when `result_ok` is not set is undefined.
16888 pub result: *mut crate::lightning::ln::msgs::Shutdown,
16889 /// A pointer to the contents in the error state.
16890 /// Reading from this pointer when `result_ok` is set is undefined.
16891 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16894 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
16895 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
16896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16897 pub struct CResult_ShutdownDecodeErrorZ {
16898 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
16899 /// `err` or `result` depending on the state of `result_ok`.
16900 pub contents: CResult_ShutdownDecodeErrorZPtr,
16901 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
16902 pub result_ok: bool,
16905 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
16906 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
16907 CResult_ShutdownDecodeErrorZ {
16908 contents: CResult_ShutdownDecodeErrorZPtr {
16909 result: Box::into_raw(Box::new(o)),
16915 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
16916 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
16917 CResult_ShutdownDecodeErrorZ {
16918 contents: CResult_ShutdownDecodeErrorZPtr {
16919 err: Box::into_raw(Box::new(e)),
16924 /// Checks if the given object is currently in the success state
16926 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
16930 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
16931 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
16932 impl Drop for CResult_ShutdownDecodeErrorZ {
16933 fn drop(&mut self) {
16934 if self.result_ok {
16935 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16936 let _ = unsafe { Box::from_raw(self.contents.result) };
16939 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16940 let _ = unsafe { Box::from_raw(self.contents.err) };
16945 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
16946 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
16947 let contents = if o.result_ok {
16948 let result = unsafe { o.contents.result };
16949 unsafe { o.contents.result = core::ptr::null_mut() };
16950 CResult_ShutdownDecodeErrorZPtr { result }
16952 let err = unsafe { o.contents.err };
16953 unsafe { o.contents.err = core::ptr::null_mut(); }
16954 CResult_ShutdownDecodeErrorZPtr { err }
16958 result_ok: o.result_ok,
16962 impl Clone for CResult_ShutdownDecodeErrorZ {
16963 fn clone(&self) -> Self {
16964 if self.result_ok {
16965 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
16966 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
16969 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
16970 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16976 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
16977 /// but with all dynamically-allocated buffers duplicated in new buffers.
16978 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
16980 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
16981 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
16982 /// A pointer to the contents in the success state.
16983 /// Reading from this pointer when `result_ok` is not set is undefined.
16984 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
16985 /// A pointer to the contents in the error state.
16986 /// Reading from this pointer when `result_ok` is set is undefined.
16987 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16990 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
16991 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16993 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
16994 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
16995 /// `err` or `result` depending on the state of `result_ok`.
16996 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
16997 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
16998 pub result_ok: bool,
17001 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
17002 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
17003 CResult_UpdateFailHTLCDecodeErrorZ {
17004 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17005 result: Box::into_raw(Box::new(o)),
17011 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
17012 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
17013 CResult_UpdateFailHTLCDecodeErrorZ {
17014 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17015 err: Box::into_raw(Box::new(e)),
17020 /// Checks if the given object is currently in the success state
17022 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
17026 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
17027 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
17028 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
17029 fn drop(&mut self) {
17030 if self.result_ok {
17031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17032 let _ = unsafe { Box::from_raw(self.contents.result) };
17035 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17036 let _ = unsafe { Box::from_raw(self.contents.err) };
17041 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
17042 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17043 let contents = if o.result_ok {
17044 let result = unsafe { o.contents.result };
17045 unsafe { o.contents.result = core::ptr::null_mut() };
17046 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
17048 let err = unsafe { o.contents.err };
17049 unsafe { o.contents.err = core::ptr::null_mut(); }
17050 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
17054 result_ok: o.result_ok,
17058 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
17059 fn clone(&self) -> Self {
17060 if self.result_ok {
17061 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17062 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
17065 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
17066 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17072 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
17073 /// but with all dynamically-allocated buffers duplicated in new buffers.
17074 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
17076 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
17077 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17078 /// A pointer to the contents in the success state.
17079 /// Reading from this pointer when `result_ok` is not set is undefined.
17080 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
17081 /// A pointer to the contents in the error state.
17082 /// Reading from this pointer when `result_ok` is set is undefined.
17083 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17086 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
17087 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
17088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17089 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17090 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
17091 /// `err` or `result` depending on the state of `result_ok`.
17092 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
17093 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
17094 pub result_ok: bool,
17097 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
17098 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17099 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17100 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17101 result: Box::into_raw(Box::new(o)),
17107 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
17108 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17109 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17110 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17111 err: Box::into_raw(Box::new(e)),
17116 /// Checks if the given object is currently in the success state
17118 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
17122 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
17123 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
17124 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17125 fn drop(&mut self) {
17126 if self.result_ok {
17127 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17128 let _ = unsafe { Box::from_raw(self.contents.result) };
17131 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17132 let _ = unsafe { Box::from_raw(self.contents.err) };
17137 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17138 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17139 let contents = if o.result_ok {
17140 let result = unsafe { o.contents.result };
17141 unsafe { o.contents.result = core::ptr::null_mut() };
17142 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
17144 let err = unsafe { o.contents.err };
17145 unsafe { o.contents.err = core::ptr::null_mut(); }
17146 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
17150 result_ok: o.result_ok,
17154 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
17155 fn clone(&self) -> Self {
17156 if self.result_ok {
17157 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17158 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
17161 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
17162 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17168 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
17169 /// but with all dynamically-allocated buffers duplicated in new buffers.
17170 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
17172 /// The contents of CResult_UpdateFeeDecodeErrorZ
17173 pub union CResult_UpdateFeeDecodeErrorZPtr {
17174 /// A pointer to the contents in the success state.
17175 /// Reading from this pointer when `result_ok` is not set is undefined.
17176 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
17177 /// A pointer to the contents in the error state.
17178 /// Reading from this pointer when `result_ok` is set is undefined.
17179 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17182 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
17183 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
17184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17185 pub struct CResult_UpdateFeeDecodeErrorZ {
17186 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
17187 /// `err` or `result` depending on the state of `result_ok`.
17188 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
17189 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
17190 pub result_ok: bool,
17193 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
17194 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
17195 CResult_UpdateFeeDecodeErrorZ {
17196 contents: CResult_UpdateFeeDecodeErrorZPtr {
17197 result: Box::into_raw(Box::new(o)),
17203 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
17204 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
17205 CResult_UpdateFeeDecodeErrorZ {
17206 contents: CResult_UpdateFeeDecodeErrorZPtr {
17207 err: Box::into_raw(Box::new(e)),
17212 /// Checks if the given object is currently in the success state
17214 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
17218 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
17219 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
17220 impl Drop for CResult_UpdateFeeDecodeErrorZ {
17221 fn drop(&mut self) {
17222 if self.result_ok {
17223 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17224 let _ = unsafe { Box::from_raw(self.contents.result) };
17227 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17228 let _ = unsafe { Box::from_raw(self.contents.err) };
17233 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
17234 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
17235 let contents = if o.result_ok {
17236 let result = unsafe { o.contents.result };
17237 unsafe { o.contents.result = core::ptr::null_mut() };
17238 CResult_UpdateFeeDecodeErrorZPtr { result }
17240 let err = unsafe { o.contents.err };
17241 unsafe { o.contents.err = core::ptr::null_mut(); }
17242 CResult_UpdateFeeDecodeErrorZPtr { err }
17246 result_ok: o.result_ok,
17250 impl Clone for CResult_UpdateFeeDecodeErrorZ {
17251 fn clone(&self) -> Self {
17252 if self.result_ok {
17253 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
17254 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
17257 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
17258 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17264 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
17265 /// but with all dynamically-allocated buffers duplicated in new buffers.
17266 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
17268 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
17269 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17270 /// A pointer to the contents in the success state.
17271 /// Reading from this pointer when `result_ok` is not set is undefined.
17272 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
17273 /// A pointer to the contents in the error state.
17274 /// Reading from this pointer when `result_ok` is set is undefined.
17275 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17278 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
17279 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
17280 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17281 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
17282 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
17283 /// `err` or `result` depending on the state of `result_ok`.
17284 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
17285 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
17286 pub result_ok: bool,
17289 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
17290 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
17291 CResult_UpdateFulfillHTLCDecodeErrorZ {
17292 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17293 result: Box::into_raw(Box::new(o)),
17299 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
17300 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
17301 CResult_UpdateFulfillHTLCDecodeErrorZ {
17302 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17303 err: Box::into_raw(Box::new(e)),
17308 /// Checks if the given object is currently in the success state
17310 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
17314 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
17315 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
17316 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
17317 fn drop(&mut self) {
17318 if self.result_ok {
17319 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17320 let _ = unsafe { Box::from_raw(self.contents.result) };
17323 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17324 let _ = unsafe { Box::from_raw(self.contents.err) };
17329 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
17330 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17331 let contents = if o.result_ok {
17332 let result = unsafe { o.contents.result };
17333 unsafe { o.contents.result = core::ptr::null_mut() };
17334 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
17336 let err = unsafe { o.contents.err };
17337 unsafe { o.contents.err = core::ptr::null_mut(); }
17338 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
17342 result_ok: o.result_ok,
17346 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
17347 fn clone(&self) -> Self {
17348 if self.result_ok {
17349 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17350 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
17353 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
17354 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17360 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
17361 /// but with all dynamically-allocated buffers duplicated in new buffers.
17362 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
17364 /// The contents of CResult_OnionPacketDecodeErrorZ
17365 pub union CResult_OnionPacketDecodeErrorZPtr {
17366 /// A pointer to the contents in the success state.
17367 /// Reading from this pointer when `result_ok` is not set is undefined.
17368 pub result: *mut crate::lightning::ln::msgs::OnionPacket,
17369 /// A pointer to the contents in the error state.
17370 /// Reading from this pointer when `result_ok` is set is undefined.
17371 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17374 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
17375 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
17376 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17377 pub struct CResult_OnionPacketDecodeErrorZ {
17378 /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
17379 /// `err` or `result` depending on the state of `result_ok`.
17380 pub contents: CResult_OnionPacketDecodeErrorZPtr,
17381 /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
17382 pub result_ok: bool,
17385 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
17386 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
17387 CResult_OnionPacketDecodeErrorZ {
17388 contents: CResult_OnionPacketDecodeErrorZPtr {
17389 result: Box::into_raw(Box::new(o)),
17395 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
17396 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
17397 CResult_OnionPacketDecodeErrorZ {
17398 contents: CResult_OnionPacketDecodeErrorZPtr {
17399 err: Box::into_raw(Box::new(e)),
17404 /// Checks if the given object is currently in the success state
17406 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
17410 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
17411 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
17412 impl Drop for CResult_OnionPacketDecodeErrorZ {
17413 fn drop(&mut self) {
17414 if self.result_ok {
17415 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17416 let _ = unsafe { Box::from_raw(self.contents.result) };
17419 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17420 let _ = unsafe { Box::from_raw(self.contents.err) };
17425 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
17426 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
17427 let contents = if o.result_ok {
17428 let result = unsafe { o.contents.result };
17429 unsafe { o.contents.result = core::ptr::null_mut() };
17430 CResult_OnionPacketDecodeErrorZPtr { result }
17432 let err = unsafe { o.contents.err };
17433 unsafe { o.contents.err = core::ptr::null_mut(); }
17434 CResult_OnionPacketDecodeErrorZPtr { err }
17438 result_ok: o.result_ok,
17442 impl Clone for CResult_OnionPacketDecodeErrorZ {
17443 fn clone(&self) -> Self {
17444 if self.result_ok {
17445 Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
17446 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
17449 Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
17450 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17456 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
17457 /// but with all dynamically-allocated buffers duplicated in new buffers.
17458 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
17460 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
17461 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
17462 /// A pointer to the contents in the success state.
17463 /// Reading from this pointer when `result_ok` is not set is undefined.
17464 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
17465 /// A pointer to the contents in the error state.
17466 /// Reading from this pointer when `result_ok` is set is undefined.
17467 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17470 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
17471 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
17472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17473 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
17474 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
17475 /// `err` or `result` depending on the state of `result_ok`.
17476 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
17477 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
17478 pub result_ok: bool,
17481 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
17482 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
17483 CResult_UpdateAddHTLCDecodeErrorZ {
17484 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17485 result: Box::into_raw(Box::new(o)),
17491 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
17492 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
17493 CResult_UpdateAddHTLCDecodeErrorZ {
17494 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17495 err: Box::into_raw(Box::new(e)),
17500 /// Checks if the given object is currently in the success state
17502 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
17506 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
17507 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
17508 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
17509 fn drop(&mut self) {
17510 if self.result_ok {
17511 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17512 let _ = unsafe { Box::from_raw(self.contents.result) };
17515 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17516 let _ = unsafe { Box::from_raw(self.contents.err) };
17521 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
17522 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
17523 let contents = if o.result_ok {
17524 let result = unsafe { o.contents.result };
17525 unsafe { o.contents.result = core::ptr::null_mut() };
17526 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
17528 let err = unsafe { o.contents.err };
17529 unsafe { o.contents.err = core::ptr::null_mut(); }
17530 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
17534 result_ok: o.result_ok,
17538 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
17539 fn clone(&self) -> Self {
17540 if self.result_ok {
17541 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17542 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
17545 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
17546 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17552 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
17553 /// but with all dynamically-allocated buffers duplicated in new buffers.
17554 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
17556 /// The contents of CResult_OnionMessageDecodeErrorZ
17557 pub union CResult_OnionMessageDecodeErrorZPtr {
17558 /// A pointer to the contents in the success state.
17559 /// Reading from this pointer when `result_ok` is not set is undefined.
17560 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
17561 /// A pointer to the contents in the error state.
17562 /// Reading from this pointer when `result_ok` is set is undefined.
17563 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17566 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
17567 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17569 pub struct CResult_OnionMessageDecodeErrorZ {
17570 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
17571 /// `err` or `result` depending on the state of `result_ok`.
17572 pub contents: CResult_OnionMessageDecodeErrorZPtr,
17573 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
17574 pub result_ok: bool,
17577 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
17578 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
17579 CResult_OnionMessageDecodeErrorZ {
17580 contents: CResult_OnionMessageDecodeErrorZPtr {
17581 result: Box::into_raw(Box::new(o)),
17587 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
17588 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
17589 CResult_OnionMessageDecodeErrorZ {
17590 contents: CResult_OnionMessageDecodeErrorZPtr {
17591 err: Box::into_raw(Box::new(e)),
17596 /// Checks if the given object is currently in the success state
17598 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
17602 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
17603 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
17604 impl Drop for CResult_OnionMessageDecodeErrorZ {
17605 fn drop(&mut self) {
17606 if self.result_ok {
17607 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17608 let _ = unsafe { Box::from_raw(self.contents.result) };
17611 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17612 let _ = unsafe { Box::from_raw(self.contents.err) };
17617 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
17618 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17619 let contents = if o.result_ok {
17620 let result = unsafe { o.contents.result };
17621 unsafe { o.contents.result = core::ptr::null_mut() };
17622 CResult_OnionMessageDecodeErrorZPtr { result }
17624 let err = unsafe { o.contents.err };
17625 unsafe { o.contents.err = core::ptr::null_mut(); }
17626 CResult_OnionMessageDecodeErrorZPtr { err }
17630 result_ok: o.result_ok,
17634 impl Clone for CResult_OnionMessageDecodeErrorZ {
17635 fn clone(&self) -> Self {
17636 if self.result_ok {
17637 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
17638 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
17641 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
17642 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17648 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
17649 /// but with all dynamically-allocated buffers duplicated in new buffers.
17650 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
17652 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
17653 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
17654 /// A pointer to the contents in the success state.
17655 /// Reading from this pointer when `result_ok` is not set is undefined.
17656 pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
17657 /// A pointer to the contents in the error state.
17658 /// Reading from this pointer when `result_ok` is set is undefined.
17659 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17662 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
17663 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
17664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17665 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
17666 /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
17667 /// `err` or `result` depending on the state of `result_ok`.
17668 pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
17669 /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
17670 pub result_ok: bool,
17673 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
17674 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
17675 CResult_FinalOnionHopDataDecodeErrorZ {
17676 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17677 result: Box::into_raw(Box::new(o)),
17683 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
17684 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
17685 CResult_FinalOnionHopDataDecodeErrorZ {
17686 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17687 err: Box::into_raw(Box::new(e)),
17692 /// Checks if the given object is currently in the success state
17694 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
17698 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
17699 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
17700 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
17701 fn drop(&mut self) {
17702 if self.result_ok {
17703 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17704 let _ = unsafe { Box::from_raw(self.contents.result) };
17707 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17708 let _ = unsafe { Box::from_raw(self.contents.err) };
17713 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
17714 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
17715 let contents = if o.result_ok {
17716 let result = unsafe { o.contents.result };
17717 unsafe { o.contents.result = core::ptr::null_mut() };
17718 CResult_FinalOnionHopDataDecodeErrorZPtr { result }
17720 let err = unsafe { o.contents.err };
17721 unsafe { o.contents.err = core::ptr::null_mut(); }
17722 CResult_FinalOnionHopDataDecodeErrorZPtr { err }
17726 result_ok: o.result_ok,
17730 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
17731 fn clone(&self) -> Self {
17732 if self.result_ok {
17733 Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17734 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
17737 Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
17738 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17744 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
17745 /// but with all dynamically-allocated buffers duplicated in new buffers.
17746 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
17748 /// The contents of CResult_PingDecodeErrorZ
17749 pub union CResult_PingDecodeErrorZPtr {
17750 /// A pointer to the contents in the success state.
17751 /// Reading from this pointer when `result_ok` is not set is undefined.
17752 pub result: *mut crate::lightning::ln::msgs::Ping,
17753 /// A pointer to the contents in the error state.
17754 /// Reading from this pointer when `result_ok` is set is undefined.
17755 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17758 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
17759 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
17760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17761 pub struct CResult_PingDecodeErrorZ {
17762 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
17763 /// `err` or `result` depending on the state of `result_ok`.
17764 pub contents: CResult_PingDecodeErrorZPtr,
17765 /// Whether this CResult_PingDecodeErrorZ represents a success state.
17766 pub result_ok: bool,
17769 /// Creates a new CResult_PingDecodeErrorZ in the success state.
17770 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
17771 CResult_PingDecodeErrorZ {
17772 contents: CResult_PingDecodeErrorZPtr {
17773 result: Box::into_raw(Box::new(o)),
17779 /// Creates a new CResult_PingDecodeErrorZ in the error state.
17780 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
17781 CResult_PingDecodeErrorZ {
17782 contents: CResult_PingDecodeErrorZPtr {
17783 err: Box::into_raw(Box::new(e)),
17788 /// Checks if the given object is currently in the success state
17790 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
17794 /// Frees any resources used by the CResult_PingDecodeErrorZ.
17795 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
17796 impl Drop for CResult_PingDecodeErrorZ {
17797 fn drop(&mut self) {
17798 if self.result_ok {
17799 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17800 let _ = unsafe { Box::from_raw(self.contents.result) };
17803 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17804 let _ = unsafe { Box::from_raw(self.contents.err) };
17809 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
17810 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
17811 let contents = if o.result_ok {
17812 let result = unsafe { o.contents.result };
17813 unsafe { o.contents.result = core::ptr::null_mut() };
17814 CResult_PingDecodeErrorZPtr { result }
17816 let err = unsafe { o.contents.err };
17817 unsafe { o.contents.err = core::ptr::null_mut(); }
17818 CResult_PingDecodeErrorZPtr { err }
17822 result_ok: o.result_ok,
17826 impl Clone for CResult_PingDecodeErrorZ {
17827 fn clone(&self) -> Self {
17828 if self.result_ok {
17829 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
17830 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
17833 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
17834 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17840 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
17841 /// but with all dynamically-allocated buffers duplicated in new buffers.
17842 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
17844 /// The contents of CResult_PongDecodeErrorZ
17845 pub union CResult_PongDecodeErrorZPtr {
17846 /// A pointer to the contents in the success state.
17847 /// Reading from this pointer when `result_ok` is not set is undefined.
17848 pub result: *mut crate::lightning::ln::msgs::Pong,
17849 /// A pointer to the contents in the error state.
17850 /// Reading from this pointer when `result_ok` is set is undefined.
17851 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17854 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
17855 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
17856 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17857 pub struct CResult_PongDecodeErrorZ {
17858 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
17859 /// `err` or `result` depending on the state of `result_ok`.
17860 pub contents: CResult_PongDecodeErrorZPtr,
17861 /// Whether this CResult_PongDecodeErrorZ represents a success state.
17862 pub result_ok: bool,
17865 /// Creates a new CResult_PongDecodeErrorZ in the success state.
17866 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
17867 CResult_PongDecodeErrorZ {
17868 contents: CResult_PongDecodeErrorZPtr {
17869 result: Box::into_raw(Box::new(o)),
17875 /// Creates a new CResult_PongDecodeErrorZ in the error state.
17876 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
17877 CResult_PongDecodeErrorZ {
17878 contents: CResult_PongDecodeErrorZPtr {
17879 err: Box::into_raw(Box::new(e)),
17884 /// Checks if the given object is currently in the success state
17886 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
17890 /// Frees any resources used by the CResult_PongDecodeErrorZ.
17891 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
17892 impl Drop for CResult_PongDecodeErrorZ {
17893 fn drop(&mut self) {
17894 if self.result_ok {
17895 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17896 let _ = unsafe { Box::from_raw(self.contents.result) };
17899 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17900 let _ = unsafe { Box::from_raw(self.contents.err) };
17905 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
17906 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
17907 let contents = if o.result_ok {
17908 let result = unsafe { o.contents.result };
17909 unsafe { o.contents.result = core::ptr::null_mut() };
17910 CResult_PongDecodeErrorZPtr { result }
17912 let err = unsafe { o.contents.err };
17913 unsafe { o.contents.err = core::ptr::null_mut(); }
17914 CResult_PongDecodeErrorZPtr { err }
17918 result_ok: o.result_ok,
17922 impl Clone for CResult_PongDecodeErrorZ {
17923 fn clone(&self) -> Self {
17924 if self.result_ok {
17925 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
17926 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
17929 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
17930 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17936 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
17937 /// but with all dynamically-allocated buffers duplicated in new buffers.
17938 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
17940 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
17941 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
17942 /// A pointer to the contents in the success state.
17943 /// Reading from this pointer when `result_ok` is not set is undefined.
17944 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
17945 /// A pointer to the contents in the error state.
17946 /// Reading from this pointer when `result_ok` is set is undefined.
17947 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17950 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
17951 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17952 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17953 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17954 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
17955 /// `err` or `result` depending on the state of `result_ok`.
17956 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
17957 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
17958 pub result_ok: bool,
17961 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
17962 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17963 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17964 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
17965 result: Box::into_raw(Box::new(o)),
17971 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
17972 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17973 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17974 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
17975 err: Box::into_raw(Box::new(e)),
17980 /// Checks if the given object is currently in the success state
17982 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
17986 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
17987 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
17988 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
17989 fn drop(&mut self) {
17990 if self.result_ok {
17991 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17992 let _ = unsafe { Box::from_raw(self.contents.result) };
17995 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17996 let _ = unsafe { Box::from_raw(self.contents.err) };
18001 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
18002 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18003 let contents = if o.result_ok {
18004 let result = unsafe { o.contents.result };
18005 unsafe { o.contents.result = core::ptr::null_mut() };
18006 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
18008 let err = unsafe { o.contents.err };
18009 unsafe { o.contents.err = core::ptr::null_mut(); }
18010 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
18014 result_ok: o.result_ok,
18018 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
18019 fn clone(&self) -> Self {
18020 if self.result_ok {
18021 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
18022 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
18025 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
18026 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18032 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18033 /// but with all dynamically-allocated buffers duplicated in new buffers.
18034 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18036 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
18037 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
18038 /// A pointer to the contents in the success state.
18039 /// Reading from this pointer when `result_ok` is not set is undefined.
18040 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
18041 /// A pointer to the contents in the error state.
18042 /// Reading from this pointer when `result_ok` is set is undefined.
18043 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18046 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
18047 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
18048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18049 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
18050 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
18051 /// `err` or `result` depending on the state of `result_ok`.
18052 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
18053 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
18054 pub result_ok: bool,
18057 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
18058 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
18059 CResult_ChannelAnnouncementDecodeErrorZ {
18060 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18061 result: Box::into_raw(Box::new(o)),
18067 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
18068 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
18069 CResult_ChannelAnnouncementDecodeErrorZ {
18070 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18071 err: Box::into_raw(Box::new(e)),
18076 /// Checks if the given object is currently in the success state
18078 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
18082 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
18083 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
18084 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
18085 fn drop(&mut self) {
18086 if self.result_ok {
18087 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18088 let _ = unsafe { Box::from_raw(self.contents.result) };
18091 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18092 let _ = unsafe { Box::from_raw(self.contents.err) };
18097 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
18098 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18099 let contents = if o.result_ok {
18100 let result = unsafe { o.contents.result };
18101 unsafe { o.contents.result = core::ptr::null_mut() };
18102 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
18104 let err = unsafe { o.contents.err };
18105 unsafe { o.contents.err = core::ptr::null_mut(); }
18106 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
18110 result_ok: o.result_ok,
18114 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
18115 fn clone(&self) -> Self {
18116 if self.result_ok {
18117 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18118 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
18121 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
18122 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18128 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18129 /// but with all dynamically-allocated buffers duplicated in new buffers.
18130 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18132 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
18133 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18134 /// A pointer to the contents in the success state.
18135 /// Reading from this pointer when `result_ok` is not set is undefined.
18136 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
18137 /// A pointer to the contents in the error state.
18138 /// Reading from this pointer when `result_ok` is set is undefined.
18139 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18142 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
18143 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
18144 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18145 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
18146 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
18147 /// `err` or `result` depending on the state of `result_ok`.
18148 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
18149 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
18150 pub result_ok: bool,
18153 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
18154 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
18155 CResult_UnsignedChannelUpdateDecodeErrorZ {
18156 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18157 result: Box::into_raw(Box::new(o)),
18163 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
18164 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
18165 CResult_UnsignedChannelUpdateDecodeErrorZ {
18166 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18167 err: Box::into_raw(Box::new(e)),
18172 /// Checks if the given object is currently in the success state
18174 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
18178 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
18179 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
18180 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
18181 fn drop(&mut self) {
18182 if self.result_ok {
18183 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18184 let _ = unsafe { Box::from_raw(self.contents.result) };
18187 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18188 let _ = unsafe { Box::from_raw(self.contents.err) };
18193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
18194 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
18195 let contents = if o.result_ok {
18196 let result = unsafe { o.contents.result };
18197 unsafe { o.contents.result = core::ptr::null_mut() };
18198 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
18200 let err = unsafe { o.contents.err };
18201 unsafe { o.contents.err = core::ptr::null_mut(); }
18202 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
18206 result_ok: o.result_ok,
18210 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
18211 fn clone(&self) -> Self {
18212 if self.result_ok {
18213 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18214 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
18217 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
18218 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18224 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
18225 /// but with all dynamically-allocated buffers duplicated in new buffers.
18226 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
18228 /// The contents of CResult_ChannelUpdateDecodeErrorZ
18229 pub union CResult_ChannelUpdateDecodeErrorZPtr {
18230 /// A pointer to the contents in the success state.
18231 /// Reading from this pointer when `result_ok` is not set is undefined.
18232 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
18233 /// A pointer to the contents in the error state.
18234 /// Reading from this pointer when `result_ok` is set is undefined.
18235 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18238 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
18239 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
18240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18241 pub struct CResult_ChannelUpdateDecodeErrorZ {
18242 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
18243 /// `err` or `result` depending on the state of `result_ok`.
18244 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
18245 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
18246 pub result_ok: bool,
18249 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
18250 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
18251 CResult_ChannelUpdateDecodeErrorZ {
18252 contents: CResult_ChannelUpdateDecodeErrorZPtr {
18253 result: Box::into_raw(Box::new(o)),
18259 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
18260 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
18261 CResult_ChannelUpdateDecodeErrorZ {
18262 contents: CResult_ChannelUpdateDecodeErrorZPtr {
18263 err: Box::into_raw(Box::new(e)),
18268 /// Checks if the given object is currently in the success state
18270 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
18274 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
18275 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
18276 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
18277 fn drop(&mut self) {
18278 if self.result_ok {
18279 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18280 let _ = unsafe { Box::from_raw(self.contents.result) };
18283 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18284 let _ = unsafe { Box::from_raw(self.contents.err) };
18289 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
18290 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
18291 let contents = if o.result_ok {
18292 let result = unsafe { o.contents.result };
18293 unsafe { o.contents.result = core::ptr::null_mut() };
18294 CResult_ChannelUpdateDecodeErrorZPtr { result }
18296 let err = unsafe { o.contents.err };
18297 unsafe { o.contents.err = core::ptr::null_mut(); }
18298 CResult_ChannelUpdateDecodeErrorZPtr { err }
18302 result_ok: o.result_ok,
18306 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
18307 fn clone(&self) -> Self {
18308 if self.result_ok {
18309 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
18310 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
18313 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
18314 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18320 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
18321 /// but with all dynamically-allocated buffers duplicated in new buffers.
18322 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
18324 /// The contents of CResult_ErrorMessageDecodeErrorZ
18325 pub union CResult_ErrorMessageDecodeErrorZPtr {
18326 /// A pointer to the contents in the success state.
18327 /// Reading from this pointer when `result_ok` is not set is undefined.
18328 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
18329 /// A pointer to the contents in the error state.
18330 /// Reading from this pointer when `result_ok` is set is undefined.
18331 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18334 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
18335 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18336 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18337 pub struct CResult_ErrorMessageDecodeErrorZ {
18338 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
18339 /// `err` or `result` depending on the state of `result_ok`.
18340 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
18341 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
18342 pub result_ok: bool,
18345 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
18346 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
18347 CResult_ErrorMessageDecodeErrorZ {
18348 contents: CResult_ErrorMessageDecodeErrorZPtr {
18349 result: Box::into_raw(Box::new(o)),
18355 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
18356 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
18357 CResult_ErrorMessageDecodeErrorZ {
18358 contents: CResult_ErrorMessageDecodeErrorZPtr {
18359 err: Box::into_raw(Box::new(e)),
18364 /// Checks if the given object is currently in the success state
18366 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
18370 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
18371 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
18372 impl Drop for CResult_ErrorMessageDecodeErrorZ {
18373 fn drop(&mut self) {
18374 if self.result_ok {
18375 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18376 let _ = unsafe { Box::from_raw(self.contents.result) };
18379 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18380 let _ = unsafe { Box::from_raw(self.contents.err) };
18385 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
18386 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18387 let contents = if o.result_ok {
18388 let result = unsafe { o.contents.result };
18389 unsafe { o.contents.result = core::ptr::null_mut() };
18390 CResult_ErrorMessageDecodeErrorZPtr { result }
18392 let err = unsafe { o.contents.err };
18393 unsafe { o.contents.err = core::ptr::null_mut(); }
18394 CResult_ErrorMessageDecodeErrorZPtr { err }
18398 result_ok: o.result_ok,
18402 impl Clone for CResult_ErrorMessageDecodeErrorZ {
18403 fn clone(&self) -> Self {
18404 if self.result_ok {
18405 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
18406 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
18409 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
18410 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18416 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
18417 /// but with all dynamically-allocated buffers duplicated in new buffers.
18418 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
18420 /// The contents of CResult_WarningMessageDecodeErrorZ
18421 pub union CResult_WarningMessageDecodeErrorZPtr {
18422 /// A pointer to the contents in the success state.
18423 /// Reading from this pointer when `result_ok` is not set is undefined.
18424 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
18425 /// A pointer to the contents in the error state.
18426 /// Reading from this pointer when `result_ok` is set is undefined.
18427 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18430 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
18431 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18433 pub struct CResult_WarningMessageDecodeErrorZ {
18434 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
18435 /// `err` or `result` depending on the state of `result_ok`.
18436 pub contents: CResult_WarningMessageDecodeErrorZPtr,
18437 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
18438 pub result_ok: bool,
18441 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
18442 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
18443 CResult_WarningMessageDecodeErrorZ {
18444 contents: CResult_WarningMessageDecodeErrorZPtr {
18445 result: Box::into_raw(Box::new(o)),
18451 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
18452 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
18453 CResult_WarningMessageDecodeErrorZ {
18454 contents: CResult_WarningMessageDecodeErrorZPtr {
18455 err: Box::into_raw(Box::new(e)),
18460 /// Checks if the given object is currently in the success state
18462 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
18466 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
18467 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
18468 impl Drop for CResult_WarningMessageDecodeErrorZ {
18469 fn drop(&mut self) {
18470 if self.result_ok {
18471 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18472 let _ = unsafe { Box::from_raw(self.contents.result) };
18475 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18476 let _ = unsafe { Box::from_raw(self.contents.err) };
18481 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
18482 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18483 let contents = if o.result_ok {
18484 let result = unsafe { o.contents.result };
18485 unsafe { o.contents.result = core::ptr::null_mut() };
18486 CResult_WarningMessageDecodeErrorZPtr { result }
18488 let err = unsafe { o.contents.err };
18489 unsafe { o.contents.err = core::ptr::null_mut(); }
18490 CResult_WarningMessageDecodeErrorZPtr { err }
18494 result_ok: o.result_ok,
18498 impl Clone for CResult_WarningMessageDecodeErrorZ {
18499 fn clone(&self) -> Self {
18500 if self.result_ok {
18501 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
18502 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
18505 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
18506 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18512 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
18513 /// but with all dynamically-allocated buffers duplicated in new buffers.
18514 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
18516 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
18517 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18518 /// A pointer to the contents in the success state.
18519 /// Reading from this pointer when `result_ok` is not set is undefined.
18520 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
18521 /// A pointer to the contents in the error state.
18522 /// Reading from this pointer when `result_ok` is set is undefined.
18523 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18526 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
18527 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
18528 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18529 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18530 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
18531 /// `err` or `result` depending on the state of `result_ok`.
18532 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
18533 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
18534 pub result_ok: bool,
18537 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
18538 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18539 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18540 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18541 result: Box::into_raw(Box::new(o)),
18547 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
18548 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18549 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18550 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18551 err: Box::into_raw(Box::new(e)),
18556 /// Checks if the given object is currently in the success state
18558 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
18562 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
18563 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
18564 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18565 fn drop(&mut self) {
18566 if self.result_ok {
18567 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18568 let _ = unsafe { Box::from_raw(self.contents.result) };
18571 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18572 let _ = unsafe { Box::from_raw(self.contents.err) };
18577 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18578 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18579 let contents = if o.result_ok {
18580 let result = unsafe { o.contents.result };
18581 unsafe { o.contents.result = core::ptr::null_mut() };
18582 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
18584 let err = unsafe { o.contents.err };
18585 unsafe { o.contents.err = core::ptr::null_mut(); }
18586 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
18590 result_ok: o.result_ok,
18594 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
18595 fn clone(&self) -> Self {
18596 if self.result_ok {
18597 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18598 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
18601 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
18602 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18608 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
18609 /// but with all dynamically-allocated buffers duplicated in new buffers.
18610 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18612 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
18613 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
18614 /// A pointer to the contents in the success state.
18615 /// Reading from this pointer when `result_ok` is not set is undefined.
18616 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
18617 /// A pointer to the contents in the error state.
18618 /// Reading from this pointer when `result_ok` is set is undefined.
18619 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18622 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
18623 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
18624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18625 pub struct CResult_NodeAnnouncementDecodeErrorZ {
18626 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
18627 /// `err` or `result` depending on the state of `result_ok`.
18628 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
18629 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
18630 pub result_ok: bool,
18633 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
18634 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
18635 CResult_NodeAnnouncementDecodeErrorZ {
18636 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18637 result: Box::into_raw(Box::new(o)),
18643 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
18644 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
18645 CResult_NodeAnnouncementDecodeErrorZ {
18646 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18647 err: Box::into_raw(Box::new(e)),
18652 /// Checks if the given object is currently in the success state
18654 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
18658 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
18659 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
18660 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
18661 fn drop(&mut self) {
18662 if self.result_ok {
18663 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18664 let _ = unsafe { Box::from_raw(self.contents.result) };
18667 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18668 let _ = unsafe { Box::from_raw(self.contents.err) };
18673 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
18674 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
18675 let contents = if o.result_ok {
18676 let result = unsafe { o.contents.result };
18677 unsafe { o.contents.result = core::ptr::null_mut() };
18678 CResult_NodeAnnouncementDecodeErrorZPtr { result }
18680 let err = unsafe { o.contents.err };
18681 unsafe { o.contents.err = core::ptr::null_mut(); }
18682 CResult_NodeAnnouncementDecodeErrorZPtr { err }
18686 result_ok: o.result_ok,
18690 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
18691 fn clone(&self) -> Self {
18692 if self.result_ok {
18693 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18694 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
18697 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
18698 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18704 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
18705 /// but with all dynamically-allocated buffers duplicated in new buffers.
18706 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
18708 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
18709 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
18710 /// A pointer to the contents in the success state.
18711 /// Reading from this pointer when `result_ok` is not set is undefined.
18712 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
18713 /// A pointer to the contents in the error state.
18714 /// Reading from this pointer when `result_ok` is set is undefined.
18715 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18718 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
18719 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
18720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18721 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
18722 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
18723 /// `err` or `result` depending on the state of `result_ok`.
18724 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
18725 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
18726 pub result_ok: bool,
18729 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
18730 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
18731 CResult_QueryShortChannelIdsDecodeErrorZ {
18732 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18733 result: Box::into_raw(Box::new(o)),
18739 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
18740 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
18741 CResult_QueryShortChannelIdsDecodeErrorZ {
18742 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18743 err: Box::into_raw(Box::new(e)),
18748 /// Checks if the given object is currently in the success state
18750 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
18754 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
18755 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
18756 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
18757 fn drop(&mut self) {
18758 if self.result_ok {
18759 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18760 let _ = unsafe { Box::from_raw(self.contents.result) };
18763 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18764 let _ = unsafe { Box::from_raw(self.contents.err) };
18769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
18770 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
18771 let contents = if o.result_ok {
18772 let result = unsafe { o.contents.result };
18773 unsafe { o.contents.result = core::ptr::null_mut() };
18774 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
18776 let err = unsafe { o.contents.err };
18777 unsafe { o.contents.err = core::ptr::null_mut(); }
18778 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
18782 result_ok: o.result_ok,
18786 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
18787 fn clone(&self) -> Self {
18788 if self.result_ok {
18789 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18790 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
18793 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
18794 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18800 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
18801 /// but with all dynamically-allocated buffers duplicated in new buffers.
18802 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
18804 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
18805 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18806 /// A pointer to the contents in the success state.
18807 /// Reading from this pointer when `result_ok` is not set is undefined.
18808 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
18809 /// A pointer to the contents in the error state.
18810 /// Reading from this pointer when `result_ok` is set is undefined.
18811 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18814 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
18815 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
18816 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18817 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18818 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
18819 /// `err` or `result` depending on the state of `result_ok`.
18820 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
18821 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
18822 pub result_ok: bool,
18825 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
18826 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18827 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18828 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18829 result: Box::into_raw(Box::new(o)),
18835 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
18836 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18837 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18838 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18839 err: Box::into_raw(Box::new(e)),
18844 /// Checks if the given object is currently in the success state
18846 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
18850 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
18851 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
18852 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18853 fn drop(&mut self) {
18854 if self.result_ok {
18855 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18856 let _ = unsafe { Box::from_raw(self.contents.result) };
18859 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18860 let _ = unsafe { Box::from_raw(self.contents.err) };
18865 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18866 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
18867 let contents = if o.result_ok {
18868 let result = unsafe { o.contents.result };
18869 unsafe { o.contents.result = core::ptr::null_mut() };
18870 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
18872 let err = unsafe { o.contents.err };
18873 unsafe { o.contents.err = core::ptr::null_mut(); }
18874 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
18878 result_ok: o.result_ok,
18882 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
18883 fn clone(&self) -> Self {
18884 if self.result_ok {
18885 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18886 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
18889 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
18890 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18896 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
18897 /// but with all dynamically-allocated buffers duplicated in new buffers.
18898 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
18900 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
18901 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
18902 /// A pointer to the contents in the success state.
18903 /// Reading from this pointer when `result_ok` is not set is undefined.
18904 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
18905 /// A pointer to the contents in the error state.
18906 /// Reading from this pointer when `result_ok` is set is undefined.
18907 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18910 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
18911 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
18912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18913 pub struct CResult_QueryChannelRangeDecodeErrorZ {
18914 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
18915 /// `err` or `result` depending on the state of `result_ok`.
18916 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
18917 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
18918 pub result_ok: bool,
18921 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
18922 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
18923 CResult_QueryChannelRangeDecodeErrorZ {
18924 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18925 result: Box::into_raw(Box::new(o)),
18931 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
18932 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
18933 CResult_QueryChannelRangeDecodeErrorZ {
18934 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18935 err: Box::into_raw(Box::new(e)),
18940 /// Checks if the given object is currently in the success state
18942 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
18946 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
18947 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
18948 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
18949 fn drop(&mut self) {
18950 if self.result_ok {
18951 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18952 let _ = unsafe { Box::from_raw(self.contents.result) };
18955 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18956 let _ = unsafe { Box::from_raw(self.contents.err) };
18961 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
18962 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
18963 let contents = if o.result_ok {
18964 let result = unsafe { o.contents.result };
18965 unsafe { o.contents.result = core::ptr::null_mut() };
18966 CResult_QueryChannelRangeDecodeErrorZPtr { result }
18968 let err = unsafe { o.contents.err };
18969 unsafe { o.contents.err = core::ptr::null_mut(); }
18970 CResult_QueryChannelRangeDecodeErrorZPtr { err }
18974 result_ok: o.result_ok,
18978 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
18979 fn clone(&self) -> Self {
18980 if self.result_ok {
18981 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18982 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
18985 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
18986 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18992 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
18993 /// but with all dynamically-allocated buffers duplicated in new buffers.
18994 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
18996 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
18997 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
18998 /// A pointer to the contents in the success state.
18999 /// Reading from this pointer when `result_ok` is not set is undefined.
19000 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
19001 /// A pointer to the contents in the error state.
19002 /// Reading from this pointer when `result_ok` is set is undefined.
19003 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19006 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
19007 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
19008 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19009 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
19010 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
19011 /// `err` or `result` depending on the state of `result_ok`.
19012 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
19013 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
19014 pub result_ok: bool,
19017 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
19018 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
19019 CResult_ReplyChannelRangeDecodeErrorZ {
19020 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19021 result: Box::into_raw(Box::new(o)),
19027 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
19028 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
19029 CResult_ReplyChannelRangeDecodeErrorZ {
19030 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19031 err: Box::into_raw(Box::new(e)),
19036 /// Checks if the given object is currently in the success state
19038 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
19042 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
19043 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
19044 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
19045 fn drop(&mut self) {
19046 if self.result_ok {
19047 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19048 let _ = unsafe { Box::from_raw(self.contents.result) };
19051 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19052 let _ = unsafe { Box::from_raw(self.contents.err) };
19057 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
19058 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
19059 let contents = if o.result_ok {
19060 let result = unsafe { o.contents.result };
19061 unsafe { o.contents.result = core::ptr::null_mut() };
19062 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
19064 let err = unsafe { o.contents.err };
19065 unsafe { o.contents.err = core::ptr::null_mut(); }
19066 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
19070 result_ok: o.result_ok,
19074 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
19075 fn clone(&self) -> Self {
19076 if self.result_ok {
19077 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19078 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
19081 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
19082 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19088 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
19089 /// but with all dynamically-allocated buffers duplicated in new buffers.
19090 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
19092 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
19093 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
19094 /// A pointer to the contents in the success state.
19095 /// Reading from this pointer when `result_ok` is not set is undefined.
19096 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
19097 /// A pointer to the contents in the error state.
19098 /// Reading from this pointer when `result_ok` is set is undefined.
19099 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19102 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
19103 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
19104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19105 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
19106 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
19107 /// `err` or `result` depending on the state of `result_ok`.
19108 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
19109 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
19110 pub result_ok: bool,
19113 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
19114 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
19115 CResult_GossipTimestampFilterDecodeErrorZ {
19116 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19117 result: Box::into_raw(Box::new(o)),
19123 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
19124 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
19125 CResult_GossipTimestampFilterDecodeErrorZ {
19126 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19127 err: Box::into_raw(Box::new(e)),
19132 /// Checks if the given object is currently in the success state
19134 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
19138 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
19139 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
19140 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
19141 fn drop(&mut self) {
19142 if self.result_ok {
19143 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19144 let _ = unsafe { Box::from_raw(self.contents.result) };
19147 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19148 let _ = unsafe { Box::from_raw(self.contents.err) };
19153 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
19154 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
19155 let contents = if o.result_ok {
19156 let result = unsafe { o.contents.result };
19157 unsafe { o.contents.result = core::ptr::null_mut() };
19158 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
19160 let err = unsafe { o.contents.err };
19161 unsafe { o.contents.err = core::ptr::null_mut(); }
19162 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
19166 result_ok: o.result_ok,
19170 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
19171 fn clone(&self) -> Self {
19172 if self.result_ok {
19173 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19174 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
19177 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
19178 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19184 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
19185 /// but with all dynamically-allocated buffers duplicated in new buffers.
19186 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
19188 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
19189 /// This corresponds to std::vector in C++
19190 pub struct CVec_PhantomRouteHintsZ {
19191 /// The elements in the array.
19192 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19193 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
19194 /// The number of elements pointed to by `data`.
19197 impl CVec_PhantomRouteHintsZ {
19198 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
19199 if self.datalen == 0 { return Vec::new(); }
19200 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19201 self.data = core::ptr::null_mut();
19205 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
19206 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19209 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
19210 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
19211 let datalen = v.len();
19212 let data = Box::into_raw(v.into_boxed_slice());
19213 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19217 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19218 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
19219 impl Drop for CVec_PhantomRouteHintsZ {
19220 fn drop(&mut self) {
19221 if self.datalen == 0 { return; }
19222 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19225 impl Clone for CVec_PhantomRouteHintsZ {
19226 fn clone(&self) -> Self {
19227 let mut res = Vec::new();
19228 if self.datalen == 0 { return Self::from(res); }
19229 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19234 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
19235 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19236 /// A pointer to the contents in the success state.
19237 /// Reading from this pointer when `result_ok` is not set is undefined.
19238 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
19239 /// A pointer to the contents in the error state.
19240 /// Reading from this pointer when `result_ok` is set is undefined.
19241 pub err: *mut crate::lightning_invoice::SignOrCreationError,
19244 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
19245 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
19246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19247 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
19248 /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
19249 /// `err` or `result` depending on the state of `result_ok`.
19250 pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
19251 /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
19252 pub result_ok: bool,
19255 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
19256 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
19257 CResult_Bolt11InvoiceSignOrCreationErrorZ {
19258 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19259 result: Box::into_raw(Box::new(o)),
19265 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
19266 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
19267 CResult_Bolt11InvoiceSignOrCreationErrorZ {
19268 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19269 err: Box::into_raw(Box::new(e)),
19274 /// Checks if the given object is currently in the success state
19276 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
19280 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
19281 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
19282 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
19283 fn drop(&mut self) {
19284 if self.result_ok {
19285 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19286 let _ = unsafe { Box::from_raw(self.contents.result) };
19289 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19290 let _ = unsafe { Box::from_raw(self.contents.err) };
19295 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
19296 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
19297 let contents = if o.result_ok {
19298 let result = unsafe { o.contents.result };
19299 unsafe { o.contents.result = core::ptr::null_mut() };
19300 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
19302 let err = unsafe { o.contents.err };
19303 unsafe { o.contents.err = core::ptr::null_mut(); }
19304 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
19308 result_ok: o.result_ok,
19312 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
19313 fn clone(&self) -> Self {
19314 if self.result_ok {
19315 Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19316 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
19319 Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
19320 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
19326 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
19327 /// but with all dynamically-allocated buffers duplicated in new buffers.
19328 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
19330 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
19331 /// This corresponds to std::vector in C++
19332 pub struct CVec_FutureZ {
19333 /// The elements in the array.
19334 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19335 pub data: *mut crate::lightning::util::wakers::Future,
19336 /// The number of elements pointed to by `data`.
19339 impl CVec_FutureZ {
19340 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
19341 if self.datalen == 0 { return Vec::new(); }
19342 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19343 self.data = core::ptr::null_mut();
19347 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
19348 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19351 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
19352 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
19353 let datalen = v.len();
19354 let data = Box::into_raw(v.into_boxed_slice());
19355 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19360 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
19361 impl Drop for CVec_FutureZ {
19362 fn drop(&mut self) {
19363 if self.datalen == 0 { return; }
19364 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19367 impl Clone for CVec_FutureZ {
19368 fn clone(&self) -> Self {
19369 let mut res = Vec::new();
19370 if self.datalen == 0 { return Self::from(res); }
19371 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19376 /// The contents of CResult_OffersMessageDecodeErrorZ
19377 pub union CResult_OffersMessageDecodeErrorZPtr {
19378 /// A pointer to the contents in the success state.
19379 /// Reading from this pointer when `result_ok` is not set is undefined.
19380 pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
19381 /// A pointer to the contents in the error state.
19382 /// Reading from this pointer when `result_ok` is set is undefined.
19383 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19386 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
19387 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19388 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19389 pub struct CResult_OffersMessageDecodeErrorZ {
19390 /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
19391 /// `err` or `result` depending on the state of `result_ok`.
19392 pub contents: CResult_OffersMessageDecodeErrorZPtr,
19393 /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
19394 pub result_ok: bool,
19397 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
19398 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
19399 CResult_OffersMessageDecodeErrorZ {
19400 contents: CResult_OffersMessageDecodeErrorZPtr {
19401 result: Box::into_raw(Box::new(o)),
19407 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
19408 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
19409 CResult_OffersMessageDecodeErrorZ {
19410 contents: CResult_OffersMessageDecodeErrorZPtr {
19411 err: Box::into_raw(Box::new(e)),
19416 /// Checks if the given object is currently in the success state
19418 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
19422 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
19423 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
19424 impl Drop for CResult_OffersMessageDecodeErrorZ {
19425 fn drop(&mut self) {
19426 if self.result_ok {
19427 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19428 let _ = unsafe { Box::from_raw(self.contents.result) };
19431 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19432 let _ = unsafe { Box::from_raw(self.contents.err) };
19437 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
19438 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19439 let contents = if o.result_ok {
19440 let result = unsafe { o.contents.result };
19441 unsafe { o.contents.result = core::ptr::null_mut() };
19442 CResult_OffersMessageDecodeErrorZPtr { result }
19444 let err = unsafe { o.contents.err };
19445 unsafe { o.contents.err = core::ptr::null_mut(); }
19446 CResult_OffersMessageDecodeErrorZPtr { err }
19450 result_ok: o.result_ok,
19454 impl Clone for CResult_OffersMessageDecodeErrorZ {
19455 fn clone(&self) -> Self {
19456 if self.result_ok {
19457 Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
19458 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
19461 Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
19462 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19468 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
19469 /// but with all dynamically-allocated buffers duplicated in new buffers.
19470 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
19472 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
19473 pub enum COption_HTLCClaimZ {
19474 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
19475 Some(crate::lightning::ln::chan_utils::HTLCClaim),
19476 /// When we're in this state, this COption_HTLCClaimZ contains nothing
19479 impl COption_HTLCClaimZ {
19480 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19481 if let Self::None = self { false } else { true }
19483 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19486 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
19487 if let Self::Some(v) = self { v } else { unreachable!() }
19491 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
19492 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
19493 COption_HTLCClaimZ::Some(o)
19496 /// Constructs a new COption_HTLCClaimZ containing nothing
19497 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
19498 COption_HTLCClaimZ::None
19501 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
19502 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
19504 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
19505 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19506 /// A pointer to the contents in the success state.
19507 /// Reading from this pointer when `result_ok` is not set is undefined.
19508 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
19509 /// A pointer to the contents in the error state.
19510 /// Reading from this pointer when `result_ok` is set is undefined.
19511 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19514 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
19515 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
19516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19517 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19518 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
19519 /// `err` or `result` depending on the state of `result_ok`.
19520 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
19521 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
19522 pub result_ok: bool,
19525 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
19526 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19527 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19528 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19529 result: Box::into_raw(Box::new(o)),
19535 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
19536 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19537 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19538 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19539 err: Box::into_raw(Box::new(e)),
19544 /// Checks if the given object is currently in the success state
19546 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
19550 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
19551 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
19552 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19553 fn drop(&mut self) {
19554 if self.result_ok {
19555 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19556 let _ = unsafe { Box::from_raw(self.contents.result) };
19559 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19560 let _ = unsafe { Box::from_raw(self.contents.err) };
19565 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19566 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
19567 let contents = if o.result_ok {
19568 let result = unsafe { o.contents.result };
19569 unsafe { o.contents.result = core::ptr::null_mut() };
19570 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
19572 let err = unsafe { o.contents.err };
19573 unsafe { o.contents.err = core::ptr::null_mut(); }
19574 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
19578 result_ok: o.result_ok,
19582 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
19583 fn clone(&self) -> Self {
19584 if self.result_ok {
19585 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19586 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
19589 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
19590 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19596 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
19597 /// but with all dynamically-allocated buffers duplicated in new buffers.
19598 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
19600 /// The contents of CResult_TxCreationKeysDecodeErrorZ
19601 pub union CResult_TxCreationKeysDecodeErrorZPtr {
19602 /// A pointer to the contents in the success state.
19603 /// Reading from this pointer when `result_ok` is not set is undefined.
19604 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
19605 /// A pointer to the contents in the error state.
19606 /// Reading from this pointer when `result_ok` is set is undefined.
19607 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19610 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
19611 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
19612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19613 pub struct CResult_TxCreationKeysDecodeErrorZ {
19614 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
19615 /// `err` or `result` depending on the state of `result_ok`.
19616 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
19617 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
19618 pub result_ok: bool,
19621 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
19622 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
19623 CResult_TxCreationKeysDecodeErrorZ {
19624 contents: CResult_TxCreationKeysDecodeErrorZPtr {
19625 result: Box::into_raw(Box::new(o)),
19631 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
19632 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
19633 CResult_TxCreationKeysDecodeErrorZ {
19634 contents: CResult_TxCreationKeysDecodeErrorZPtr {
19635 err: Box::into_raw(Box::new(e)),
19640 /// Checks if the given object is currently in the success state
19642 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
19646 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
19647 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
19648 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
19649 fn drop(&mut self) {
19650 if self.result_ok {
19651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19652 let _ = unsafe { Box::from_raw(self.contents.result) };
19655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19656 let _ = unsafe { Box::from_raw(self.contents.err) };
19661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
19662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
19663 let contents = if o.result_ok {
19664 let result = unsafe { o.contents.result };
19665 unsafe { o.contents.result = core::ptr::null_mut() };
19666 CResult_TxCreationKeysDecodeErrorZPtr { result }
19668 let err = unsafe { o.contents.err };
19669 unsafe { o.contents.err = core::ptr::null_mut(); }
19670 CResult_TxCreationKeysDecodeErrorZPtr { err }
19674 result_ok: o.result_ok,
19678 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
19679 fn clone(&self) -> Self {
19680 if self.result_ok {
19681 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
19682 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
19685 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
19686 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19692 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
19693 /// but with all dynamically-allocated buffers duplicated in new buffers.
19694 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
19696 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
19697 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
19698 /// A pointer to the contents in the success state.
19699 /// Reading from this pointer when `result_ok` is not set is undefined.
19700 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
19701 /// A pointer to the contents in the error state.
19702 /// Reading from this pointer when `result_ok` is set is undefined.
19703 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19706 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
19707 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
19708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19709 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
19710 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
19711 /// `err` or `result` depending on the state of `result_ok`.
19712 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
19713 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
19714 pub result_ok: bool,
19717 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
19718 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
19719 CResult_ChannelPublicKeysDecodeErrorZ {
19720 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19721 result: Box::into_raw(Box::new(o)),
19727 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
19728 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
19729 CResult_ChannelPublicKeysDecodeErrorZ {
19730 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19731 err: Box::into_raw(Box::new(e)),
19736 /// Checks if the given object is currently in the success state
19738 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
19742 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
19743 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
19744 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
19745 fn drop(&mut self) {
19746 if self.result_ok {
19747 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19748 let _ = unsafe { Box::from_raw(self.contents.result) };
19751 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19752 let _ = unsafe { Box::from_raw(self.contents.err) };
19757 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
19758 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
19759 let contents = if o.result_ok {
19760 let result = unsafe { o.contents.result };
19761 unsafe { o.contents.result = core::ptr::null_mut() };
19762 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
19764 let err = unsafe { o.contents.err };
19765 unsafe { o.contents.err = core::ptr::null_mut(); }
19766 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
19770 result_ok: o.result_ok,
19774 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
19775 fn clone(&self) -> Self {
19776 if self.result_ok {
19777 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19778 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
19781 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
19782 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19788 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
19789 /// but with all dynamically-allocated buffers duplicated in new buffers.
19790 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
19792 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
19793 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19794 /// A pointer to the contents in the success state.
19795 /// Reading from this pointer when `result_ok` is not set is undefined.
19796 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
19797 /// A pointer to the contents in the error state.
19798 /// Reading from this pointer when `result_ok` is set is undefined.
19799 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19802 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
19803 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
19804 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19805 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
19806 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
19807 /// `err` or `result` depending on the state of `result_ok`.
19808 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
19809 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
19810 pub result_ok: bool,
19813 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
19814 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
19815 CResult_HTLCOutputInCommitmentDecodeErrorZ {
19816 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19817 result: Box::into_raw(Box::new(o)),
19823 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
19824 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
19825 CResult_HTLCOutputInCommitmentDecodeErrorZ {
19826 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19827 err: Box::into_raw(Box::new(e)),
19832 /// Checks if the given object is currently in the success state
19834 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
19838 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
19839 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
19840 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
19841 fn drop(&mut self) {
19842 if self.result_ok {
19843 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19844 let _ = unsafe { Box::from_raw(self.contents.result) };
19847 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19848 let _ = unsafe { Box::from_raw(self.contents.err) };
19853 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
19854 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
19855 let contents = if o.result_ok {
19856 let result = unsafe { o.contents.result };
19857 unsafe { o.contents.result = core::ptr::null_mut() };
19858 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
19860 let err = unsafe { o.contents.err };
19861 unsafe { o.contents.err = core::ptr::null_mut(); }
19862 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
19866 result_ok: o.result_ok,
19870 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
19871 fn clone(&self) -> Self {
19872 if self.result_ok {
19873 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19874 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
19877 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
19878 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19884 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
19885 /// but with all dynamically-allocated buffers duplicated in new buffers.
19886 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
19888 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
19889 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19890 /// A pointer to the contents in the success state.
19891 /// Reading from this pointer when `result_ok` is not set is undefined.
19892 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
19893 /// A pointer to the contents in the error state.
19894 /// Reading from this pointer when `result_ok` is set is undefined.
19895 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19898 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
19899 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
19900 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19901 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19902 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
19903 /// `err` or `result` depending on the state of `result_ok`.
19904 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
19905 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
19906 pub result_ok: bool,
19909 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
19910 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19911 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19912 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19913 result: Box::into_raw(Box::new(o)),
19919 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
19920 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19921 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19922 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19923 err: Box::into_raw(Box::new(e)),
19928 /// Checks if the given object is currently in the success state
19930 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
19934 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
19935 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
19936 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19937 fn drop(&mut self) {
19938 if self.result_ok {
19939 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19940 let _ = unsafe { Box::from_raw(self.contents.result) };
19943 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19944 let _ = unsafe { Box::from_raw(self.contents.err) };
19949 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19950 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
19951 let contents = if o.result_ok {
19952 let result = unsafe { o.contents.result };
19953 unsafe { o.contents.result = core::ptr::null_mut() };
19954 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
19956 let err = unsafe { o.contents.err };
19957 unsafe { o.contents.err = core::ptr::null_mut(); }
19958 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
19962 result_ok: o.result_ok,
19966 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
19967 fn clone(&self) -> Self {
19968 if self.result_ok {
19969 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19970 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
19973 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
19974 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19980 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
19981 /// but with all dynamically-allocated buffers duplicated in new buffers.
19982 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
19984 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
19985 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
19986 /// A pointer to the contents in the success state.
19987 /// Reading from this pointer when `result_ok` is not set is undefined.
19988 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
19989 /// A pointer to the contents in the error state.
19990 /// Reading from this pointer when `result_ok` is set is undefined.
19991 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19994 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
19995 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
19996 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19997 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
19998 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
19999 /// `err` or `result` depending on the state of `result_ok`.
20000 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
20001 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
20002 pub result_ok: bool,
20005 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
20006 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
20007 CResult_ChannelTransactionParametersDecodeErrorZ {
20008 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20009 result: Box::into_raw(Box::new(o)),
20015 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
20016 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
20017 CResult_ChannelTransactionParametersDecodeErrorZ {
20018 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20019 err: Box::into_raw(Box::new(e)),
20024 /// Checks if the given object is currently in the success state
20026 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
20030 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
20031 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
20032 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
20033 fn drop(&mut self) {
20034 if self.result_ok {
20035 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20036 let _ = unsafe { Box::from_raw(self.contents.result) };
20039 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20040 let _ = unsafe { Box::from_raw(self.contents.err) };
20045 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
20046 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
20047 let contents = if o.result_ok {
20048 let result = unsafe { o.contents.result };
20049 unsafe { o.contents.result = core::ptr::null_mut() };
20050 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
20052 let err = unsafe { o.contents.err };
20053 unsafe { o.contents.err = core::ptr::null_mut(); }
20054 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
20058 result_ok: o.result_ok,
20062 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
20063 fn clone(&self) -> Self {
20064 if self.result_ok {
20065 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20066 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
20069 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
20070 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20076 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
20077 /// but with all dynamically-allocated buffers duplicated in new buffers.
20078 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
20080 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
20081 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20082 /// A pointer to the contents in the success state.
20083 /// Reading from this pointer when `result_ok` is not set is undefined.
20084 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
20085 /// A pointer to the contents in the error state.
20086 /// Reading from this pointer when `result_ok` is set is undefined.
20087 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20090 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
20091 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
20092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20093 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
20094 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
20095 /// `err` or `result` depending on the state of `result_ok`.
20096 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
20097 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
20098 pub result_ok: bool,
20101 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
20102 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
20103 CResult_HolderCommitmentTransactionDecodeErrorZ {
20104 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20105 result: Box::into_raw(Box::new(o)),
20111 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
20112 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
20113 CResult_HolderCommitmentTransactionDecodeErrorZ {
20114 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20115 err: Box::into_raw(Box::new(e)),
20120 /// Checks if the given object is currently in the success state
20122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
20126 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
20127 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
20128 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
20129 fn drop(&mut self) {
20130 if self.result_ok {
20131 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20132 let _ = unsafe { Box::from_raw(self.contents.result) };
20135 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20136 let _ = unsafe { Box::from_raw(self.contents.err) };
20141 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
20142 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
20143 let contents = if o.result_ok {
20144 let result = unsafe { o.contents.result };
20145 unsafe { o.contents.result = core::ptr::null_mut() };
20146 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
20148 let err = unsafe { o.contents.err };
20149 unsafe { o.contents.err = core::ptr::null_mut(); }
20150 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
20154 result_ok: o.result_ok,
20158 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
20159 fn clone(&self) -> Self {
20160 if self.result_ok {
20161 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20162 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
20165 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
20166 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20172 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
20173 /// but with all dynamically-allocated buffers duplicated in new buffers.
20174 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
20176 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
20177 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20178 /// A pointer to the contents in the success state.
20179 /// Reading from this pointer when `result_ok` is not set is undefined.
20180 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
20181 /// A pointer to the contents in the error state.
20182 /// Reading from this pointer when `result_ok` is set is undefined.
20183 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20186 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
20187 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
20188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20189 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
20190 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
20191 /// `err` or `result` depending on the state of `result_ok`.
20192 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
20193 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
20194 pub result_ok: bool,
20197 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
20198 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
20199 CResult_BuiltCommitmentTransactionDecodeErrorZ {
20200 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20201 result: Box::into_raw(Box::new(o)),
20207 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
20208 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
20209 CResult_BuiltCommitmentTransactionDecodeErrorZ {
20210 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20211 err: Box::into_raw(Box::new(e)),
20216 /// Checks if the given object is currently in the success state
20218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
20222 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
20223 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
20224 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
20225 fn drop(&mut self) {
20226 if self.result_ok {
20227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20228 let _ = unsafe { Box::from_raw(self.contents.result) };
20231 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20232 let _ = unsafe { Box::from_raw(self.contents.err) };
20237 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
20238 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
20239 let contents = if o.result_ok {
20240 let result = unsafe { o.contents.result };
20241 unsafe { o.contents.result = core::ptr::null_mut() };
20242 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
20244 let err = unsafe { o.contents.err };
20245 unsafe { o.contents.err = core::ptr::null_mut(); }
20246 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
20250 result_ok: o.result_ok,
20254 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
20255 fn clone(&self) -> Self {
20256 if self.result_ok {
20257 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20258 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
20261 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
20262 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20268 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
20269 /// but with all dynamically-allocated buffers duplicated in new buffers.
20270 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
20272 /// The contents of CResult_TrustedClosingTransactionNoneZ
20273 pub union CResult_TrustedClosingTransactionNoneZPtr {
20274 /// A pointer to the contents in the success state.
20275 /// Reading from this pointer when `result_ok` is not set is undefined.
20276 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
20277 /// Note that this value is always NULL, as there are no contents in the Err variant
20278 pub err: *mut core::ffi::c_void,
20281 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
20282 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
20283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20284 pub struct CResult_TrustedClosingTransactionNoneZ {
20285 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
20286 /// `err` or `result` depending on the state of `result_ok`.
20287 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
20288 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
20289 pub result_ok: bool,
20292 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
20293 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
20294 CResult_TrustedClosingTransactionNoneZ {
20295 contents: CResult_TrustedClosingTransactionNoneZPtr {
20296 result: Box::into_raw(Box::new(o)),
20302 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
20303 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
20304 CResult_TrustedClosingTransactionNoneZ {
20305 contents: CResult_TrustedClosingTransactionNoneZPtr {
20306 err: core::ptr::null_mut(),
20311 /// Checks if the given object is currently in the success state
20313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
20317 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
20318 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
20319 impl Drop for CResult_TrustedClosingTransactionNoneZ {
20320 fn drop(&mut self) {
20321 if self.result_ok {
20322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20323 let _ = unsafe { Box::from_raw(self.contents.result) };
20329 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
20330 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
20331 let contents = if o.result_ok {
20332 let result = unsafe { o.contents.result };
20333 unsafe { o.contents.result = core::ptr::null_mut() };
20334 CResult_TrustedClosingTransactionNoneZPtr { result }
20336 let _ = unsafe { Box::from_raw(o.contents.err) };
20337 o.contents.err = core::ptr::null_mut();
20338 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
20342 result_ok: o.result_ok,
20347 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
20348 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
20349 /// A pointer to the contents in the success state.
20350 /// Reading from this pointer when `result_ok` is not set is undefined.
20351 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
20352 /// A pointer to the contents in the error state.
20353 /// Reading from this pointer when `result_ok` is set is undefined.
20354 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20357 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
20358 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
20359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20360 pub struct CResult_CommitmentTransactionDecodeErrorZ {
20361 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
20362 /// `err` or `result` depending on the state of `result_ok`.
20363 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
20364 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
20365 pub result_ok: bool,
20368 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
20369 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
20370 CResult_CommitmentTransactionDecodeErrorZ {
20371 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20372 result: Box::into_raw(Box::new(o)),
20378 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
20379 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
20380 CResult_CommitmentTransactionDecodeErrorZ {
20381 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20382 err: Box::into_raw(Box::new(e)),
20387 /// Checks if the given object is currently in the success state
20389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
20393 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
20394 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
20395 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
20396 fn drop(&mut self) {
20397 if self.result_ok {
20398 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20399 let _ = unsafe { Box::from_raw(self.contents.result) };
20402 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20403 let _ = unsafe { Box::from_raw(self.contents.err) };
20408 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
20409 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
20410 let contents = if o.result_ok {
20411 let result = unsafe { o.contents.result };
20412 unsafe { o.contents.result = core::ptr::null_mut() };
20413 CResult_CommitmentTransactionDecodeErrorZPtr { result }
20415 let err = unsafe { o.contents.err };
20416 unsafe { o.contents.err = core::ptr::null_mut(); }
20417 CResult_CommitmentTransactionDecodeErrorZPtr { err }
20421 result_ok: o.result_ok,
20425 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
20426 fn clone(&self) -> Self {
20427 if self.result_ok {
20428 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20429 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
20432 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
20433 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20439 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
20440 /// but with all dynamically-allocated buffers duplicated in new buffers.
20441 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
20443 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
20444 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
20445 /// A pointer to the contents in the success state.
20446 /// Reading from this pointer when `result_ok` is not set is undefined.
20447 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
20448 /// Note that this value is always NULL, as there are no contents in the Err variant
20449 pub err: *mut core::ffi::c_void,
20452 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
20453 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
20454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20455 pub struct CResult_TrustedCommitmentTransactionNoneZ {
20456 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
20457 /// `err` or `result` depending on the state of `result_ok`.
20458 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
20459 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
20460 pub result_ok: bool,
20463 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
20464 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
20465 CResult_TrustedCommitmentTransactionNoneZ {
20466 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
20467 result: Box::into_raw(Box::new(o)),
20473 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
20474 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
20475 CResult_TrustedCommitmentTransactionNoneZ {
20476 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
20477 err: core::ptr::null_mut(),
20482 /// Checks if the given object is currently in the success state
20484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
20488 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
20489 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
20490 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
20491 fn drop(&mut self) {
20492 if self.result_ok {
20493 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20494 let _ = unsafe { Box::from_raw(self.contents.result) };
20500 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
20501 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
20502 let contents = if o.result_ok {
20503 let result = unsafe { o.contents.result };
20504 unsafe { o.contents.result = core::ptr::null_mut() };
20505 CResult_TrustedCommitmentTransactionNoneZPtr { result }
20507 let _ = unsafe { Box::from_raw(o.contents.err) };
20508 o.contents.err = core::ptr::null_mut();
20509 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
20513 result_ok: o.result_ok,
20518 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
20519 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
20520 /// A pointer to the contents in the success state.
20521 /// Reading from this pointer when `result_ok` is not set is undefined.
20522 pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
20523 /// Note that this value is always NULL, as there are no contents in the Err variant
20524 pub err: *mut core::ffi::c_void,
20527 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
20528 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
20529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20530 pub struct CResult_CVec_ECDSASignatureZNoneZ {
20531 /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
20532 /// `err` or `result` depending on the state of `result_ok`.
20533 pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
20534 /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
20535 pub result_ok: bool,
20538 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
20539 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
20540 CResult_CVec_ECDSASignatureZNoneZ {
20541 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20542 result: Box::into_raw(Box::new(o)),
20548 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
20549 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
20550 CResult_CVec_ECDSASignatureZNoneZ {
20551 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20552 err: core::ptr::null_mut(),
20557 /// Checks if the given object is currently in the success state
20559 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
20563 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
20564 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
20565 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
20566 fn drop(&mut self) {
20567 if self.result_ok {
20568 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20569 let _ = unsafe { Box::from_raw(self.contents.result) };
20575 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
20576 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
20577 let contents = if o.result_ok {
20578 let result = unsafe { o.contents.result };
20579 unsafe { o.contents.result = core::ptr::null_mut() };
20580 CResult_CVec_ECDSASignatureZNoneZPtr { result }
20582 let _ = unsafe { Box::from_raw(o.contents.err) };
20583 o.contents.err = core::ptr::null_mut();
20584 CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
20588 result_ok: o.result_ok,
20592 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
20593 fn clone(&self) -> Self {
20594 if self.result_ok {
20595 Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20596 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
20599 Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
20600 err: core::ptr::null_mut()
20606 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
20607 /// but with all dynamically-allocated buffers duplicated in new buffers.
20608 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
20611 /// An enum which can either contain a usize or not
20612 pub enum COption_usizeZ {
20613 /// When we're in this state, this COption_usizeZ contains a usize
20615 /// When we're in this state, this COption_usizeZ contains nothing
20618 impl COption_usizeZ {
20619 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20620 if let Self::None = self { false } else { true }
20622 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20625 #[allow(unused)] pub(crate) fn take(mut self) -> usize {
20626 if let Self::Some(v) = self { v } else { unreachable!() }
20630 /// Constructs a new COption_usizeZ containing a usize
20631 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
20632 COption_usizeZ::Some(o)
20635 /// Constructs a new COption_usizeZ containing nothing
20636 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
20637 COption_usizeZ::None
20640 /// Frees any resources associated with the usize, if we are in the Some state
20641 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
20643 /// Creates a new COption_usizeZ which has the same data as `orig`
20644 /// but with all dynamically-allocated buffers duplicated in new buffers.
20645 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
20647 /// The contents of CResult_ShutdownScriptDecodeErrorZ
20648 pub union CResult_ShutdownScriptDecodeErrorZPtr {
20649 /// A pointer to the contents in the success state.
20650 /// Reading from this pointer when `result_ok` is not set is undefined.
20651 pub result: *mut crate::lightning::ln::script::ShutdownScript,
20652 /// A pointer to the contents in the error state.
20653 /// Reading from this pointer when `result_ok` is set is undefined.
20654 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20657 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
20658 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
20659 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20660 pub struct CResult_ShutdownScriptDecodeErrorZ {
20661 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
20662 /// `err` or `result` depending on the state of `result_ok`.
20663 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
20664 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
20665 pub result_ok: bool,
20668 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
20669 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
20670 CResult_ShutdownScriptDecodeErrorZ {
20671 contents: CResult_ShutdownScriptDecodeErrorZPtr {
20672 result: Box::into_raw(Box::new(o)),
20678 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
20679 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
20680 CResult_ShutdownScriptDecodeErrorZ {
20681 contents: CResult_ShutdownScriptDecodeErrorZPtr {
20682 err: Box::into_raw(Box::new(e)),
20687 /// Checks if the given object is currently in the success state
20689 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
20693 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
20694 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
20695 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
20696 fn drop(&mut self) {
20697 if self.result_ok {
20698 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20699 let _ = unsafe { Box::from_raw(self.contents.result) };
20702 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20703 let _ = unsafe { Box::from_raw(self.contents.err) };
20708 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
20709 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
20710 let contents = if o.result_ok {
20711 let result = unsafe { o.contents.result };
20712 unsafe { o.contents.result = core::ptr::null_mut() };
20713 CResult_ShutdownScriptDecodeErrorZPtr { result }
20715 let err = unsafe { o.contents.err };
20716 unsafe { o.contents.err = core::ptr::null_mut(); }
20717 CResult_ShutdownScriptDecodeErrorZPtr { err }
20721 result_ok: o.result_ok,
20725 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
20726 fn clone(&self) -> Self {
20727 if self.result_ok {
20728 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
20729 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
20732 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
20733 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20739 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
20740 /// but with all dynamically-allocated buffers duplicated in new buffers.
20741 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
20743 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
20744 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20745 /// A pointer to the contents in the success state.
20746 /// Reading from this pointer when `result_ok` is not set is undefined.
20747 pub result: *mut crate::lightning::ln::script::ShutdownScript,
20748 /// A pointer to the contents in the error state.
20749 /// Reading from this pointer when `result_ok` is set is undefined.
20750 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
20753 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
20754 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
20755 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20756 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
20757 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
20758 /// `err` or `result` depending on the state of `result_ok`.
20759 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
20760 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
20761 pub result_ok: bool,
20764 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
20765 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
20766 CResult_ShutdownScriptInvalidShutdownScriptZ {
20767 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20768 result: Box::into_raw(Box::new(o)),
20774 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
20775 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
20776 CResult_ShutdownScriptInvalidShutdownScriptZ {
20777 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20778 err: Box::into_raw(Box::new(e)),
20783 /// Checks if the given object is currently in the success state
20785 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
20789 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
20790 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
20791 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
20792 fn drop(&mut self) {
20793 if self.result_ok {
20794 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20795 let _ = unsafe { Box::from_raw(self.contents.result) };
20798 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20799 let _ = unsafe { Box::from_raw(self.contents.err) };
20804 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
20805 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
20806 let contents = if o.result_ok {
20807 let result = unsafe { o.contents.result };
20808 unsafe { o.contents.result = core::ptr::null_mut() };
20809 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
20811 let err = unsafe { o.contents.err };
20812 unsafe { o.contents.err = core::ptr::null_mut(); }
20813 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
20817 result_ok: o.result_ok,
20821 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
20822 fn clone(&self) -> Self {
20823 if self.result_ok {
20824 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20825 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
20828 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
20829 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
20835 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
20836 /// but with all dynamically-allocated buffers duplicated in new buffers.
20837 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
20839 /// The contents of CResult_PaymentPurposeDecodeErrorZ
20840 pub union CResult_PaymentPurposeDecodeErrorZPtr {
20841 /// A pointer to the contents in the success state.
20842 /// Reading from this pointer when `result_ok` is not set is undefined.
20843 pub result: *mut crate::lightning::events::PaymentPurpose,
20844 /// A pointer to the contents in the error state.
20845 /// Reading from this pointer when `result_ok` is set is undefined.
20846 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20849 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
20850 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
20851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20852 pub struct CResult_PaymentPurposeDecodeErrorZ {
20853 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
20854 /// `err` or `result` depending on the state of `result_ok`.
20855 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
20856 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
20857 pub result_ok: bool,
20860 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
20861 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
20862 CResult_PaymentPurposeDecodeErrorZ {
20863 contents: CResult_PaymentPurposeDecodeErrorZPtr {
20864 result: Box::into_raw(Box::new(o)),
20870 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
20871 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
20872 CResult_PaymentPurposeDecodeErrorZ {
20873 contents: CResult_PaymentPurposeDecodeErrorZPtr {
20874 err: Box::into_raw(Box::new(e)),
20879 /// Checks if the given object is currently in the success state
20881 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
20885 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
20886 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
20887 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
20888 fn drop(&mut self) {
20889 if self.result_ok {
20890 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20891 let _ = unsafe { Box::from_raw(self.contents.result) };
20894 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20895 let _ = unsafe { Box::from_raw(self.contents.err) };
20900 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
20901 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
20902 let contents = if o.result_ok {
20903 let result = unsafe { o.contents.result };
20904 unsafe { o.contents.result = core::ptr::null_mut() };
20905 CResult_PaymentPurposeDecodeErrorZPtr { result }
20907 let err = unsafe { o.contents.err };
20908 unsafe { o.contents.err = core::ptr::null_mut(); }
20909 CResult_PaymentPurposeDecodeErrorZPtr { err }
20913 result_ok: o.result_ok,
20917 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
20918 fn clone(&self) -> Self {
20919 if self.result_ok {
20920 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
20921 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
20924 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
20925 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20931 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
20932 /// but with all dynamically-allocated buffers duplicated in new buffers.
20933 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
20935 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
20936 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
20937 /// A pointer to the contents in the success state.
20938 /// Reading from this pointer when `result_ok` is not set is undefined.
20939 pub result: *mut crate::lightning::events::ClaimedHTLC,
20940 /// A pointer to the contents in the error state.
20941 /// Reading from this pointer when `result_ok` is set is undefined.
20942 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20945 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
20946 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
20947 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20948 pub struct CResult_ClaimedHTLCDecodeErrorZ {
20949 /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
20950 /// `err` or `result` depending on the state of `result_ok`.
20951 pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
20952 /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
20953 pub result_ok: bool,
20956 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
20957 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
20958 CResult_ClaimedHTLCDecodeErrorZ {
20959 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
20960 result: Box::into_raw(Box::new(o)),
20966 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
20967 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
20968 CResult_ClaimedHTLCDecodeErrorZ {
20969 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
20970 err: Box::into_raw(Box::new(e)),
20975 /// Checks if the given object is currently in the success state
20977 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
20981 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
20982 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
20983 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
20984 fn drop(&mut self) {
20985 if self.result_ok {
20986 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20987 let _ = unsafe { Box::from_raw(self.contents.result) };
20990 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20991 let _ = unsafe { Box::from_raw(self.contents.err) };
20996 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
20997 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
20998 let contents = if o.result_ok {
20999 let result = unsafe { o.contents.result };
21000 unsafe { o.contents.result = core::ptr::null_mut() };
21001 CResult_ClaimedHTLCDecodeErrorZPtr { result }
21003 let err = unsafe { o.contents.err };
21004 unsafe { o.contents.err = core::ptr::null_mut(); }
21005 CResult_ClaimedHTLCDecodeErrorZPtr { err }
21009 result_ok: o.result_ok,
21013 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
21014 fn clone(&self) -> Self {
21015 if self.result_ok {
21016 Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
21017 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
21020 Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
21021 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21027 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
21028 /// but with all dynamically-allocated buffers duplicated in new buffers.
21029 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
21032 /// An enum which can either contain a crate::lightning::events::PathFailure or not
21033 pub enum COption_PathFailureZ {
21034 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
21035 Some(crate::lightning::events::PathFailure),
21036 /// When we're in this state, this COption_PathFailureZ contains nothing
21039 impl COption_PathFailureZ {
21040 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21041 if let Self::None = self { false } else { true }
21043 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21046 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
21047 if let Self::Some(v) = self { v } else { unreachable!() }
21051 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
21052 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
21053 COption_PathFailureZ::Some(o)
21056 /// Constructs a new COption_PathFailureZ containing nothing
21057 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
21058 COption_PathFailureZ::None
21061 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
21062 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
21064 /// Creates a new COption_PathFailureZ which has the same data as `orig`
21065 /// but with all dynamically-allocated buffers duplicated in new buffers.
21066 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
21068 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
21069 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
21070 /// A pointer to the contents in the success state.
21071 /// Reading from this pointer when `result_ok` is not set is undefined.
21072 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
21073 /// A pointer to the contents in the error state.
21074 /// Reading from this pointer when `result_ok` is set is undefined.
21075 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21078 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
21079 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21081 pub struct CResult_COption_PathFailureZDecodeErrorZ {
21082 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
21083 /// `err` or `result` depending on the state of `result_ok`.
21084 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
21085 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
21086 pub result_ok: bool,
21089 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
21090 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
21091 CResult_COption_PathFailureZDecodeErrorZ {
21092 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21093 result: Box::into_raw(Box::new(o)),
21099 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
21100 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
21101 CResult_COption_PathFailureZDecodeErrorZ {
21102 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21103 err: Box::into_raw(Box::new(e)),
21108 /// Checks if the given object is currently in the success state
21110 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
21114 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
21115 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
21116 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
21117 fn drop(&mut self) {
21118 if self.result_ok {
21119 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21120 let _ = unsafe { Box::from_raw(self.contents.result) };
21123 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21124 let _ = unsafe { Box::from_raw(self.contents.err) };
21129 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
21130 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21131 let contents = if o.result_ok {
21132 let result = unsafe { o.contents.result };
21133 unsafe { o.contents.result = core::ptr::null_mut() };
21134 CResult_COption_PathFailureZDecodeErrorZPtr { result }
21136 let err = unsafe { o.contents.err };
21137 unsafe { o.contents.err = core::ptr::null_mut(); }
21138 CResult_COption_PathFailureZDecodeErrorZPtr { err }
21142 result_ok: o.result_ok,
21146 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
21147 fn clone(&self) -> Self {
21148 if self.result_ok {
21149 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21150 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
21153 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
21154 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21160 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
21161 /// but with all dynamically-allocated buffers duplicated in new buffers.
21162 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
21165 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
21166 pub enum COption_ClosureReasonZ {
21167 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
21168 Some(crate::lightning::events::ClosureReason),
21169 /// When we're in this state, this COption_ClosureReasonZ contains nothing
21172 impl COption_ClosureReasonZ {
21173 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21174 if let Self::None = self { false } else { true }
21176 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21179 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
21180 if let Self::Some(v) = self { v } else { unreachable!() }
21184 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
21185 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
21186 COption_ClosureReasonZ::Some(o)
21189 /// Constructs a new COption_ClosureReasonZ containing nothing
21190 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
21191 COption_ClosureReasonZ::None
21194 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
21195 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
21197 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
21198 /// but with all dynamically-allocated buffers duplicated in new buffers.
21199 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
21201 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
21202 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
21203 /// A pointer to the contents in the success state.
21204 /// Reading from this pointer when `result_ok` is not set is undefined.
21205 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
21206 /// A pointer to the contents in the error state.
21207 /// Reading from this pointer when `result_ok` is set is undefined.
21208 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21211 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
21212 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21214 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
21215 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
21216 /// `err` or `result` depending on the state of `result_ok`.
21217 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
21218 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
21219 pub result_ok: bool,
21222 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
21223 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
21224 CResult_COption_ClosureReasonZDecodeErrorZ {
21225 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21226 result: Box::into_raw(Box::new(o)),
21232 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
21233 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
21234 CResult_COption_ClosureReasonZDecodeErrorZ {
21235 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21236 err: Box::into_raw(Box::new(e)),
21241 /// Checks if the given object is currently in the success state
21243 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
21247 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
21248 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
21249 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
21250 fn drop(&mut self) {
21251 if self.result_ok {
21252 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21253 let _ = unsafe { Box::from_raw(self.contents.result) };
21256 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21257 let _ = unsafe { Box::from_raw(self.contents.err) };
21262 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
21263 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21264 let contents = if o.result_ok {
21265 let result = unsafe { o.contents.result };
21266 unsafe { o.contents.result = core::ptr::null_mut() };
21267 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
21269 let err = unsafe { o.contents.err };
21270 unsafe { o.contents.err = core::ptr::null_mut(); }
21271 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
21275 result_ok: o.result_ok,
21279 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
21280 fn clone(&self) -> Self {
21281 if self.result_ok {
21282 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21283 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
21286 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
21287 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21293 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
21294 /// but with all dynamically-allocated buffers duplicated in new buffers.
21295 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
21298 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
21299 pub enum COption_HTLCDestinationZ {
21300 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
21301 Some(crate::lightning::events::HTLCDestination),
21302 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
21305 impl COption_HTLCDestinationZ {
21306 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21307 if let Self::None = self { false } else { true }
21309 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21312 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
21313 if let Self::Some(v) = self { v } else { unreachable!() }
21317 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
21318 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
21319 COption_HTLCDestinationZ::Some(o)
21322 /// Constructs a new COption_HTLCDestinationZ containing nothing
21323 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
21324 COption_HTLCDestinationZ::None
21327 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
21328 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
21330 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
21331 /// but with all dynamically-allocated buffers duplicated in new buffers.
21332 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
21334 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
21335 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21336 /// A pointer to the contents in the success state.
21337 /// Reading from this pointer when `result_ok` is not set is undefined.
21338 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
21339 /// A pointer to the contents in the error state.
21340 /// Reading from this pointer when `result_ok` is set is undefined.
21341 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21344 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
21345 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21347 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
21348 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
21349 /// `err` or `result` depending on the state of `result_ok`.
21350 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
21351 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
21352 pub result_ok: bool,
21355 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
21356 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
21357 CResult_COption_HTLCDestinationZDecodeErrorZ {
21358 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21359 result: Box::into_raw(Box::new(o)),
21365 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
21366 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
21367 CResult_COption_HTLCDestinationZDecodeErrorZ {
21368 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21369 err: Box::into_raw(Box::new(e)),
21374 /// Checks if the given object is currently in the success state
21376 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
21380 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
21381 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
21382 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
21383 fn drop(&mut self) {
21384 if self.result_ok {
21385 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21386 let _ = unsafe { Box::from_raw(self.contents.result) };
21389 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21390 let _ = unsafe { Box::from_raw(self.contents.err) };
21395 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
21396 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21397 let contents = if o.result_ok {
21398 let result = unsafe { o.contents.result };
21399 unsafe { o.contents.result = core::ptr::null_mut() };
21400 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
21402 let err = unsafe { o.contents.err };
21403 unsafe { o.contents.err = core::ptr::null_mut(); }
21404 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
21408 result_ok: o.result_ok,
21412 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
21413 fn clone(&self) -> Self {
21414 if self.result_ok {
21415 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21416 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
21419 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
21420 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21426 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
21427 /// but with all dynamically-allocated buffers duplicated in new buffers.
21428 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
21430 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
21431 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
21432 /// A pointer to the contents in the success state.
21433 /// Reading from this pointer when `result_ok` is not set is undefined.
21434 pub result: *mut crate::lightning::events::PaymentFailureReason,
21435 /// A pointer to the contents in the error state.
21436 /// Reading from this pointer when `result_ok` is set is undefined.
21437 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21440 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
21441 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
21442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21443 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
21444 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
21445 /// `err` or `result` depending on the state of `result_ok`.
21446 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
21447 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
21448 pub result_ok: bool,
21451 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
21452 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
21453 CResult_PaymentFailureReasonDecodeErrorZ {
21454 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21455 result: Box::into_raw(Box::new(o)),
21461 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
21462 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
21463 CResult_PaymentFailureReasonDecodeErrorZ {
21464 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21465 err: Box::into_raw(Box::new(e)),
21470 /// Checks if the given object is currently in the success state
21472 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
21476 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
21477 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
21478 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
21479 fn drop(&mut self) {
21480 if self.result_ok {
21481 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21482 let _ = unsafe { Box::from_raw(self.contents.result) };
21485 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21486 let _ = unsafe { Box::from_raw(self.contents.err) };
21491 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
21492 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
21493 let contents = if o.result_ok {
21494 let result = unsafe { o.contents.result };
21495 unsafe { o.contents.result = core::ptr::null_mut() };
21496 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
21498 let err = unsafe { o.contents.err };
21499 unsafe { o.contents.err = core::ptr::null_mut(); }
21500 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
21504 result_ok: o.result_ok,
21508 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
21509 fn clone(&self) -> Self {
21510 if self.result_ok {
21511 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21512 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
21515 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
21516 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21522 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
21523 /// but with all dynamically-allocated buffers duplicated in new buffers.
21524 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
21527 /// An enum which can either contain a crate::c_types::U128 or not
21528 pub enum COption_U128Z {
21529 /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
21530 Some(crate::c_types::U128),
21531 /// When we're in this state, this COption_U128Z contains nothing
21534 impl COption_U128Z {
21535 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21536 if let Self::None = self { false } else { true }
21538 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21541 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
21542 if let Self::Some(v) = self { v } else { unreachable!() }
21546 /// Constructs a new COption_U128Z containing a crate::c_types::U128
21547 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
21548 COption_U128Z::Some(o)
21551 /// Constructs a new COption_U128Z containing nothing
21552 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
21553 COption_U128Z::None
21556 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
21557 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
21559 /// Creates a new COption_U128Z which has the same data as `orig`
21560 /// but with all dynamically-allocated buffers duplicated in new buffers.
21561 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
21563 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
21564 /// This corresponds to std::vector in C++
21565 pub struct CVec_ClaimedHTLCZ {
21566 /// The elements in the array.
21567 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21568 pub data: *mut crate::lightning::events::ClaimedHTLC,
21569 /// The number of elements pointed to by `data`.
21572 impl CVec_ClaimedHTLCZ {
21573 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
21574 if self.datalen == 0 { return Vec::new(); }
21575 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21576 self.data = core::ptr::null_mut();
21580 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
21581 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21584 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
21585 fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
21586 let datalen = v.len();
21587 let data = Box::into_raw(v.into_boxed_slice());
21588 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21592 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21593 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
21594 impl Drop for CVec_ClaimedHTLCZ {
21595 fn drop(&mut self) {
21596 if self.datalen == 0 { return; }
21597 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21600 impl Clone for CVec_ClaimedHTLCZ {
21601 fn clone(&self) -> Self {
21602 let mut res = Vec::new();
21603 if self.datalen == 0 { return Self::from(res); }
21604 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21610 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
21611 pub enum COption_PaymentFailureReasonZ {
21612 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
21613 Some(crate::lightning::events::PaymentFailureReason),
21614 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
21617 impl COption_PaymentFailureReasonZ {
21618 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21619 if let Self::None = self { false } else { true }
21621 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21624 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
21625 if let Self::Some(v) = self { v } else { unreachable!() }
21629 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
21630 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
21631 COption_PaymentFailureReasonZ::Some(o)
21634 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
21635 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
21636 COption_PaymentFailureReasonZ::None
21639 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
21640 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
21642 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
21643 /// but with all dynamically-allocated buffers duplicated in new buffers.
21644 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
21647 /// An enum which can either contain a crate::lightning::events::Event or not
21648 pub enum COption_EventZ {
21649 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
21650 Some(crate::lightning::events::Event),
21651 /// When we're in this state, this COption_EventZ contains nothing
21654 impl COption_EventZ {
21655 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21656 if let Self::None = self { false } else { true }
21658 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21661 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
21662 if let Self::Some(v) = self { v } else { unreachable!() }
21666 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
21667 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
21668 COption_EventZ::Some(o)
21671 /// Constructs a new COption_EventZ containing nothing
21672 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
21673 COption_EventZ::None
21676 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
21677 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
21679 /// Creates a new COption_EventZ which has the same data as `orig`
21680 /// but with all dynamically-allocated buffers duplicated in new buffers.
21681 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
21683 /// The contents of CResult_COption_EventZDecodeErrorZ
21684 pub union CResult_COption_EventZDecodeErrorZPtr {
21685 /// A pointer to the contents in the success state.
21686 /// Reading from this pointer when `result_ok` is not set is undefined.
21687 pub result: *mut crate::c_types::derived::COption_EventZ,
21688 /// A pointer to the contents in the error state.
21689 /// Reading from this pointer when `result_ok` is set is undefined.
21690 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21693 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
21694 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21696 pub struct CResult_COption_EventZDecodeErrorZ {
21697 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
21698 /// `err` or `result` depending on the state of `result_ok`.
21699 pub contents: CResult_COption_EventZDecodeErrorZPtr,
21700 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
21701 pub result_ok: bool,
21704 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
21705 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
21706 CResult_COption_EventZDecodeErrorZ {
21707 contents: CResult_COption_EventZDecodeErrorZPtr {
21708 result: Box::into_raw(Box::new(o)),
21714 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
21715 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
21716 CResult_COption_EventZDecodeErrorZ {
21717 contents: CResult_COption_EventZDecodeErrorZPtr {
21718 err: Box::into_raw(Box::new(e)),
21723 /// Checks if the given object is currently in the success state
21725 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
21729 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
21730 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
21731 impl Drop for CResult_COption_EventZDecodeErrorZ {
21732 fn drop(&mut self) {
21733 if self.result_ok {
21734 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21735 let _ = unsafe { Box::from_raw(self.contents.result) };
21738 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21739 let _ = unsafe { Box::from_raw(self.contents.err) };
21744 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
21745 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
21746 let contents = if o.result_ok {
21747 let result = unsafe { o.contents.result };
21748 unsafe { o.contents.result = core::ptr::null_mut() };
21749 CResult_COption_EventZDecodeErrorZPtr { result }
21751 let err = unsafe { o.contents.err };
21752 unsafe { o.contents.err = core::ptr::null_mut(); }
21753 CResult_COption_EventZDecodeErrorZPtr { err }
21757 result_ok: o.result_ok,
21761 impl Clone for CResult_COption_EventZDecodeErrorZ {
21762 fn clone(&self) -> Self {
21763 if self.result_ok {
21764 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
21765 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
21768 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
21769 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21775 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
21776 /// but with all dynamically-allocated buffers duplicated in new buffers.
21777 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
21779 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
21780 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
21781 /// A pointer to the contents in the success state.
21782 /// Reading from this pointer when `result_ok` is not set is undefined.
21783 pub result: *mut crate::lightning_invoice::SiPrefix,
21784 /// A pointer to the contents in the error state.
21785 /// Reading from this pointer when `result_ok` is set is undefined.
21786 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
21789 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
21790 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
21791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21792 pub struct CResult_SiPrefixBolt11ParseErrorZ {
21793 /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
21794 /// `err` or `result` depending on the state of `result_ok`.
21795 pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
21796 /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
21797 pub result_ok: bool,
21800 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
21801 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
21802 CResult_SiPrefixBolt11ParseErrorZ {
21803 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21804 result: Box::into_raw(Box::new(o)),
21810 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
21811 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
21812 CResult_SiPrefixBolt11ParseErrorZ {
21813 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21814 err: Box::into_raw(Box::new(e)),
21819 /// Checks if the given object is currently in the success state
21821 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
21825 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
21826 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
21827 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
21828 fn drop(&mut self) {
21829 if self.result_ok {
21830 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21831 let _ = unsafe { Box::from_raw(self.contents.result) };
21834 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21835 let _ = unsafe { Box::from_raw(self.contents.err) };
21840 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
21841 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
21842 let contents = if o.result_ok {
21843 let result = unsafe { o.contents.result };
21844 unsafe { o.contents.result = core::ptr::null_mut() };
21845 CResult_SiPrefixBolt11ParseErrorZPtr { result }
21847 let err = unsafe { o.contents.err };
21848 unsafe { o.contents.err = core::ptr::null_mut(); }
21849 CResult_SiPrefixBolt11ParseErrorZPtr { err }
21853 result_ok: o.result_ok,
21857 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
21858 fn clone(&self) -> Self {
21859 if self.result_ok {
21860 Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21861 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
21864 Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
21865 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
21871 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
21872 /// but with all dynamically-allocated buffers duplicated in new buffers.
21873 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
21875 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
21876 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21877 /// A pointer to the contents in the success state.
21878 /// Reading from this pointer when `result_ok` is not set is undefined.
21879 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
21880 /// A pointer to the contents in the error state.
21881 /// Reading from this pointer when `result_ok` is set is undefined.
21882 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
21885 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
21886 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
21887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21888 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21889 /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
21890 /// `err` or `result` depending on the state of `result_ok`.
21891 pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
21892 /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
21893 pub result_ok: bool,
21896 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
21897 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21898 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21899 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21900 result: Box::into_raw(Box::new(o)),
21906 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
21907 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21908 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21909 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21910 err: Box::into_raw(Box::new(e)),
21915 /// Checks if the given object is currently in the success state
21917 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
21921 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
21922 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
21923 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21924 fn drop(&mut self) {
21925 if self.result_ok {
21926 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21927 let _ = unsafe { Box::from_raw(self.contents.result) };
21930 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21931 let _ = unsafe { Box::from_raw(self.contents.err) };
21936 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21937 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
21938 let contents = if o.result_ok {
21939 let result = unsafe { o.contents.result };
21940 unsafe { o.contents.result = core::ptr::null_mut() };
21941 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
21943 let err = unsafe { o.contents.err };
21944 unsafe { o.contents.err = core::ptr::null_mut(); }
21945 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
21949 result_ok: o.result_ok,
21953 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
21954 fn clone(&self) -> Self {
21955 if self.result_ok {
21956 Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21957 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
21960 Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
21961 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
21967 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
21968 /// but with all dynamically-allocated buffers duplicated in new buffers.
21969 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
21971 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
21972 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
21973 /// A pointer to the contents in the success state.
21974 /// Reading from this pointer when `result_ok` is not set is undefined.
21975 pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
21976 /// A pointer to the contents in the error state.
21977 /// Reading from this pointer when `result_ok` is set is undefined.
21978 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
21981 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
21982 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
21983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21984 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
21985 /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
21986 /// `err` or `result` depending on the state of `result_ok`.
21987 pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
21988 /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
21989 pub result_ok: bool,
21992 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
21993 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
21994 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
21995 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
21996 result: Box::into_raw(Box::new(o)),
22002 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
22003 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22004 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22005 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
22006 err: Box::into_raw(Box::new(e)),
22011 /// Checks if the given object is currently in the success state
22013 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
22017 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
22018 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
22019 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22020 fn drop(&mut self) {
22021 if self.result_ok {
22022 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22023 let _ = unsafe { Box::from_raw(self.contents.result) };
22026 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22027 let _ = unsafe { Box::from_raw(self.contents.err) };
22032 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22033 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
22034 let contents = if o.result_ok {
22035 let result = unsafe { o.contents.result };
22036 unsafe { o.contents.result = core::ptr::null_mut() };
22037 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
22039 let err = unsafe { o.contents.err };
22040 unsafe { o.contents.err = core::ptr::null_mut(); }
22041 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
22045 result_ok: o.result_ok,
22049 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
22050 fn clone(&self) -> Self {
22051 if self.result_ok {
22052 Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
22053 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
22056 Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
22057 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
22063 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
22064 /// but with all dynamically-allocated buffers duplicated in new buffers.
22065 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
22067 /// A tuple of 3 elements. See the individual fields for the types contained.
22068 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22069 /// The element at position 0
22070 pub a: crate::lightning_invoice::RawBolt11Invoice,
22071 /// The element at position 1
22072 pub b: crate::c_types::ThirtyTwoBytes,
22073 /// The element at position 2
22074 pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
22076 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22077 fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
22085 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22086 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
22087 (self.a, self.b, self.c)
22090 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22091 fn clone(&self) -> Self {
22093 a: Clone::clone(&self.a),
22094 b: Clone::clone(&self.b),
22095 c: Clone::clone(&self.c),
22100 /// Creates a new tuple which has the same data as `orig`
22101 /// but with all dynamically-allocated buffers duplicated in new buffers.
22102 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
22103 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
22105 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: crate::lightning_invoice::RawBolt11Invoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::Bolt11InvoiceSignature) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
22106 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
22110 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
22111 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
22113 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
22114 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
22115 /// A pointer to the contents in the success state.
22116 /// Reading from this pointer when `result_ok` is not set is undefined.
22117 pub result: *mut crate::lightning_invoice::PayeePubKey,
22118 /// A pointer to the contents in the error state.
22119 /// Reading from this pointer when `result_ok` is set is undefined.
22120 pub err: *mut crate::c_types::Secp256k1Error,
22123 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
22124 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
22125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22126 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
22127 /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
22128 /// `err` or `result` depending on the state of `result_ok`.
22129 pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
22130 /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
22131 pub result_ok: bool,
22134 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
22135 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
22136 CResult_PayeePubKeySecp256k1ErrorZ {
22137 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22138 result: Box::into_raw(Box::new(o)),
22144 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
22145 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
22146 CResult_PayeePubKeySecp256k1ErrorZ {
22147 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22148 err: Box::into_raw(Box::new(e)),
22153 /// Checks if the given object is currently in the success state
22155 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
22159 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
22160 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
22161 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
22162 fn drop(&mut self) {
22163 if self.result_ok {
22164 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22165 let _ = unsafe { Box::from_raw(self.contents.result) };
22168 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22169 let _ = unsafe { Box::from_raw(self.contents.err) };
22174 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
22175 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
22176 let contents = if o.result_ok {
22177 let result = unsafe { o.contents.result };
22178 unsafe { o.contents.result = core::ptr::null_mut() };
22179 CResult_PayeePubKeySecp256k1ErrorZPtr { result }
22181 let err = unsafe { o.contents.err };
22182 unsafe { o.contents.err = core::ptr::null_mut(); }
22183 CResult_PayeePubKeySecp256k1ErrorZPtr { err }
22187 result_ok: o.result_ok,
22191 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
22192 fn clone(&self) -> Self {
22193 if self.result_ok {
22194 Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22195 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
22198 Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
22199 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
22205 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
22206 /// but with all dynamically-allocated buffers duplicated in new buffers.
22207 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
22209 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
22210 /// This corresponds to std::vector in C++
22211 pub struct CVec_PrivateRouteZ {
22212 /// The elements in the array.
22213 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
22214 pub data: *mut crate::lightning_invoice::PrivateRoute,
22215 /// The number of elements pointed to by `data`.
22218 impl CVec_PrivateRouteZ {
22219 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
22220 if self.datalen == 0 { return Vec::new(); }
22221 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
22222 self.data = core::ptr::null_mut();
22226 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
22227 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
22230 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
22231 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
22232 let datalen = v.len();
22233 let data = Box::into_raw(v.into_boxed_slice());
22234 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
22238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
22239 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
22240 impl Drop for CVec_PrivateRouteZ {
22241 fn drop(&mut self) {
22242 if self.datalen == 0 { return; }
22243 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
22246 impl Clone for CVec_PrivateRouteZ {
22247 fn clone(&self) -> Self {
22248 let mut res = Vec::new();
22249 if self.datalen == 0 { return Self::from(res); }
22250 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
22255 /// The contents of CResult_PositiveTimestampCreationErrorZ
22256 pub union CResult_PositiveTimestampCreationErrorZPtr {
22257 /// A pointer to the contents in the success state.
22258 /// Reading from this pointer when `result_ok` is not set is undefined.
22259 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
22260 /// A pointer to the contents in the error state.
22261 /// Reading from this pointer when `result_ok` is set is undefined.
22262 pub err: *mut crate::lightning_invoice::CreationError,
22265 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
22266 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
22267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22268 pub struct CResult_PositiveTimestampCreationErrorZ {
22269 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
22270 /// `err` or `result` depending on the state of `result_ok`.
22271 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
22272 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
22273 pub result_ok: bool,
22276 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
22277 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
22278 CResult_PositiveTimestampCreationErrorZ {
22279 contents: CResult_PositiveTimestampCreationErrorZPtr {
22280 result: Box::into_raw(Box::new(o)),
22286 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
22287 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
22288 CResult_PositiveTimestampCreationErrorZ {
22289 contents: CResult_PositiveTimestampCreationErrorZPtr {
22290 err: Box::into_raw(Box::new(e)),
22295 /// Checks if the given object is currently in the success state
22297 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
22301 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
22302 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
22303 impl Drop for CResult_PositiveTimestampCreationErrorZ {
22304 fn drop(&mut self) {
22305 if self.result_ok {
22306 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22307 let _ = unsafe { Box::from_raw(self.contents.result) };
22310 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22311 let _ = unsafe { Box::from_raw(self.contents.err) };
22316 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
22317 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
22318 let contents = if o.result_ok {
22319 let result = unsafe { o.contents.result };
22320 unsafe { o.contents.result = core::ptr::null_mut() };
22321 CResult_PositiveTimestampCreationErrorZPtr { result }
22323 let err = unsafe { o.contents.err };
22324 unsafe { o.contents.err = core::ptr::null_mut(); }
22325 CResult_PositiveTimestampCreationErrorZPtr { err }
22329 result_ok: o.result_ok,
22333 impl Clone for CResult_PositiveTimestampCreationErrorZ {
22334 fn clone(&self) -> Self {
22335 if self.result_ok {
22336 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
22337 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
22340 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
22341 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
22347 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
22348 /// but with all dynamically-allocated buffers duplicated in new buffers.
22349 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
22351 /// The contents of CResult_NoneBolt11SemanticErrorZ
22352 pub union CResult_NoneBolt11SemanticErrorZPtr {
22353 /// Note that this value is always NULL, as there are no contents in the OK variant
22354 pub result: *mut core::ffi::c_void,
22355 /// A pointer to the contents in the error state.
22356 /// Reading from this pointer when `result_ok` is set is undefined.
22357 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
22360 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
22361 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
22362 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22363 pub struct CResult_NoneBolt11SemanticErrorZ {
22364 /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
22365 /// `err` or `result` depending on the state of `result_ok`.
22366 pub contents: CResult_NoneBolt11SemanticErrorZPtr,
22367 /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
22368 pub result_ok: bool,
22371 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
22372 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
22373 CResult_NoneBolt11SemanticErrorZ {
22374 contents: CResult_NoneBolt11SemanticErrorZPtr {
22375 result: core::ptr::null_mut(),
22381 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
22382 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
22383 CResult_NoneBolt11SemanticErrorZ {
22384 contents: CResult_NoneBolt11SemanticErrorZPtr {
22385 err: Box::into_raw(Box::new(e)),
22390 /// Checks if the given object is currently in the success state
22392 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
22396 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
22397 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
22398 impl Drop for CResult_NoneBolt11SemanticErrorZ {
22399 fn drop(&mut self) {
22400 if self.result_ok {
22402 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22403 let _ = unsafe { Box::from_raw(self.contents.err) };
22408 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
22409 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
22410 let contents = if o.result_ok {
22411 let _ = unsafe { Box::from_raw(o.contents.result) };
22412 o.contents.result = core::ptr::null_mut();
22413 CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
22415 let err = unsafe { o.contents.err };
22416 unsafe { o.contents.err = core::ptr::null_mut(); }
22417 CResult_NoneBolt11SemanticErrorZPtr { err }
22421 result_ok: o.result_ok,
22425 impl Clone for CResult_NoneBolt11SemanticErrorZ {
22426 fn clone(&self) -> Self {
22427 if self.result_ok {
22428 Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
22429 result: core::ptr::null_mut()
22432 Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
22433 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
22439 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
22440 /// but with all dynamically-allocated buffers duplicated in new buffers.
22441 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
22443 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
22444 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22445 /// A pointer to the contents in the success state.
22446 /// Reading from this pointer when `result_ok` is not set is undefined.
22447 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
22448 /// A pointer to the contents in the error state.
22449 /// Reading from this pointer when `result_ok` is set is undefined.
22450 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
22453 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
22454 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
22455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22456 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22457 /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
22458 /// `err` or `result` depending on the state of `result_ok`.
22459 pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
22460 /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
22461 pub result_ok: bool,
22464 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
22465 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22466 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22467 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22468 result: Box::into_raw(Box::new(o)),
22474 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
22475 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22476 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22477 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22478 err: Box::into_raw(Box::new(e)),
22483 /// Checks if the given object is currently in the success state
22485 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
22489 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
22490 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
22491 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22492 fn drop(&mut self) {
22493 if self.result_ok {
22494 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22495 let _ = unsafe { Box::from_raw(self.contents.result) };
22498 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22499 let _ = unsafe { Box::from_raw(self.contents.err) };
22504 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22505 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
22506 let contents = if o.result_ok {
22507 let result = unsafe { o.contents.result };
22508 unsafe { o.contents.result = core::ptr::null_mut() };
22509 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
22511 let err = unsafe { o.contents.err };
22512 unsafe { o.contents.err = core::ptr::null_mut(); }
22513 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
22517 result_ok: o.result_ok,
22521 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
22522 fn clone(&self) -> Self {
22523 if self.result_ok {
22524 Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22525 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
22528 Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
22529 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
22535 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
22536 /// but with all dynamically-allocated buffers duplicated in new buffers.
22537 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
22539 /// The contents of CResult_DescriptionCreationErrorZ
22540 pub union CResult_DescriptionCreationErrorZPtr {
22541 /// A pointer to the contents in the success state.
22542 /// Reading from this pointer when `result_ok` is not set is undefined.
22543 pub result: *mut crate::lightning_invoice::Description,
22544 /// A pointer to the contents in the error state.
22545 /// Reading from this pointer when `result_ok` is set is undefined.
22546 pub err: *mut crate::lightning_invoice::CreationError,
22549 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
22550 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
22551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22552 pub struct CResult_DescriptionCreationErrorZ {
22553 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
22554 /// `err` or `result` depending on the state of `result_ok`.
22555 pub contents: CResult_DescriptionCreationErrorZPtr,
22556 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
22557 pub result_ok: bool,
22560 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
22561 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
22562 CResult_DescriptionCreationErrorZ {
22563 contents: CResult_DescriptionCreationErrorZPtr {
22564 result: Box::into_raw(Box::new(o)),
22570 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
22571 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
22572 CResult_DescriptionCreationErrorZ {
22573 contents: CResult_DescriptionCreationErrorZPtr {
22574 err: Box::into_raw(Box::new(e)),
22579 /// Checks if the given object is currently in the success state
22581 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
22585 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
22586 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
22587 impl Drop for CResult_DescriptionCreationErrorZ {
22588 fn drop(&mut self) {
22589 if self.result_ok {
22590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22591 let _ = unsafe { Box::from_raw(self.contents.result) };
22594 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22595 let _ = unsafe { Box::from_raw(self.contents.err) };
22600 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
22601 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
22602 let contents = if o.result_ok {
22603 let result = unsafe { o.contents.result };
22604 unsafe { o.contents.result = core::ptr::null_mut() };
22605 CResult_DescriptionCreationErrorZPtr { result }
22607 let err = unsafe { o.contents.err };
22608 unsafe { o.contents.err = core::ptr::null_mut(); }
22609 CResult_DescriptionCreationErrorZPtr { err }
22613 result_ok: o.result_ok,
22617 impl Clone for CResult_DescriptionCreationErrorZ {
22618 fn clone(&self) -> Self {
22619 if self.result_ok {
22620 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
22621 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
22624 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
22625 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
22631 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
22632 /// but with all dynamically-allocated buffers duplicated in new buffers.
22633 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
22635 /// The contents of CResult_PrivateRouteCreationErrorZ
22636 pub union CResult_PrivateRouteCreationErrorZPtr {
22637 /// A pointer to the contents in the success state.
22638 /// Reading from this pointer when `result_ok` is not set is undefined.
22639 pub result: *mut crate::lightning_invoice::PrivateRoute,
22640 /// A pointer to the contents in the error state.
22641 /// Reading from this pointer when `result_ok` is set is undefined.
22642 pub err: *mut crate::lightning_invoice::CreationError,
22645 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
22646 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
22647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22648 pub struct CResult_PrivateRouteCreationErrorZ {
22649 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
22650 /// `err` or `result` depending on the state of `result_ok`.
22651 pub contents: CResult_PrivateRouteCreationErrorZPtr,
22652 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
22653 pub result_ok: bool,
22656 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
22657 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
22658 CResult_PrivateRouteCreationErrorZ {
22659 contents: CResult_PrivateRouteCreationErrorZPtr {
22660 result: Box::into_raw(Box::new(o)),
22666 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
22667 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
22668 CResult_PrivateRouteCreationErrorZ {
22669 contents: CResult_PrivateRouteCreationErrorZPtr {
22670 err: Box::into_raw(Box::new(e)),
22675 /// Checks if the given object is currently in the success state
22677 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
22681 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
22682 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
22683 impl Drop for CResult_PrivateRouteCreationErrorZ {
22684 fn drop(&mut self) {
22685 if self.result_ok {
22686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22687 let _ = unsafe { Box::from_raw(self.contents.result) };
22690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22691 let _ = unsafe { Box::from_raw(self.contents.err) };
22696 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
22697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
22698 let contents = if o.result_ok {
22699 let result = unsafe { o.contents.result };
22700 unsafe { o.contents.result = core::ptr::null_mut() };
22701 CResult_PrivateRouteCreationErrorZPtr { result }
22703 let err = unsafe { o.contents.err };
22704 unsafe { o.contents.err = core::ptr::null_mut(); }
22705 CResult_PrivateRouteCreationErrorZPtr { err }
22709 result_ok: o.result_ok,
22713 impl Clone for CResult_PrivateRouteCreationErrorZ {
22714 fn clone(&self) -> Self {
22715 if self.result_ok {
22716 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
22717 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
22720 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
22721 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
22727 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
22728 /// but with all dynamically-allocated buffers duplicated in new buffers.
22729 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
22731 /// The contents of CResult_OutPointDecodeErrorZ
22732 pub union CResult_OutPointDecodeErrorZPtr {
22733 /// A pointer to the contents in the success state.
22734 /// Reading from this pointer when `result_ok` is not set is undefined.
22735 pub result: *mut crate::lightning::chain::transaction::OutPoint,
22736 /// A pointer to the contents in the error state.
22737 /// Reading from this pointer when `result_ok` is set is undefined.
22738 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22741 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
22742 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
22743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22744 pub struct CResult_OutPointDecodeErrorZ {
22745 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
22746 /// `err` or `result` depending on the state of `result_ok`.
22747 pub contents: CResult_OutPointDecodeErrorZPtr,
22748 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
22749 pub result_ok: bool,
22752 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
22753 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
22754 CResult_OutPointDecodeErrorZ {
22755 contents: CResult_OutPointDecodeErrorZPtr {
22756 result: Box::into_raw(Box::new(o)),
22762 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
22763 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
22764 CResult_OutPointDecodeErrorZ {
22765 contents: CResult_OutPointDecodeErrorZPtr {
22766 err: Box::into_raw(Box::new(e)),
22771 /// Checks if the given object is currently in the success state
22773 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
22777 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
22778 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
22779 impl Drop for CResult_OutPointDecodeErrorZ {
22780 fn drop(&mut self) {
22781 if self.result_ok {
22782 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22783 let _ = unsafe { Box::from_raw(self.contents.result) };
22786 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22787 let _ = unsafe { Box::from_raw(self.contents.err) };
22792 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
22793 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
22794 let contents = if o.result_ok {
22795 let result = unsafe { o.contents.result };
22796 unsafe { o.contents.result = core::ptr::null_mut() };
22797 CResult_OutPointDecodeErrorZPtr { result }
22799 let err = unsafe { o.contents.err };
22800 unsafe { o.contents.err = core::ptr::null_mut(); }
22801 CResult_OutPointDecodeErrorZPtr { err }
22805 result_ok: o.result_ok,
22809 impl Clone for CResult_OutPointDecodeErrorZ {
22810 fn clone(&self) -> Self {
22811 if self.result_ok {
22812 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
22813 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
22816 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
22817 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22823 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
22824 /// but with all dynamically-allocated buffers duplicated in new buffers.
22825 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
22827 /// The contents of CResult_BigSizeDecodeErrorZ
22828 pub union CResult_BigSizeDecodeErrorZPtr {
22829 /// A pointer to the contents in the success state.
22830 /// Reading from this pointer when `result_ok` is not set is undefined.
22831 pub result: *mut crate::lightning::util::ser::BigSize,
22832 /// A pointer to the contents in the error state.
22833 /// Reading from this pointer when `result_ok` is set is undefined.
22834 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22837 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
22838 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
22839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22840 pub struct CResult_BigSizeDecodeErrorZ {
22841 /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
22842 /// `err` or `result` depending on the state of `result_ok`.
22843 pub contents: CResult_BigSizeDecodeErrorZPtr,
22844 /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
22845 pub result_ok: bool,
22848 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
22849 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
22850 CResult_BigSizeDecodeErrorZ {
22851 contents: CResult_BigSizeDecodeErrorZPtr {
22852 result: Box::into_raw(Box::new(o)),
22858 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
22859 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
22860 CResult_BigSizeDecodeErrorZ {
22861 contents: CResult_BigSizeDecodeErrorZPtr {
22862 err: Box::into_raw(Box::new(e)),
22867 /// Checks if the given object is currently in the success state
22869 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
22873 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
22874 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
22875 impl Drop for CResult_BigSizeDecodeErrorZ {
22876 fn drop(&mut self) {
22877 if self.result_ok {
22878 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22879 let _ = unsafe { Box::from_raw(self.contents.result) };
22882 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22883 let _ = unsafe { Box::from_raw(self.contents.err) };
22888 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
22889 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
22890 let contents = if o.result_ok {
22891 let result = unsafe { o.contents.result };
22892 unsafe { o.contents.result = core::ptr::null_mut() };
22893 CResult_BigSizeDecodeErrorZPtr { result }
22895 let err = unsafe { o.contents.err };
22896 unsafe { o.contents.err = core::ptr::null_mut(); }
22897 CResult_BigSizeDecodeErrorZPtr { err }
22901 result_ok: o.result_ok,
22905 impl Clone for CResult_BigSizeDecodeErrorZ {
22906 fn clone(&self) -> Self {
22907 if self.result_ok {
22908 Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
22909 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
22912 Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
22913 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22919 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
22920 /// but with all dynamically-allocated buffers duplicated in new buffers.
22921 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
22923 /// The contents of CResult_HostnameDecodeErrorZ
22924 pub union CResult_HostnameDecodeErrorZPtr {
22925 /// A pointer to the contents in the success state.
22926 /// Reading from this pointer when `result_ok` is not set is undefined.
22927 pub result: *mut crate::lightning::util::ser::Hostname,
22928 /// A pointer to the contents in the error state.
22929 /// Reading from this pointer when `result_ok` is set is undefined.
22930 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22933 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
22934 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
22935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22936 pub struct CResult_HostnameDecodeErrorZ {
22937 /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
22938 /// `err` or `result` depending on the state of `result_ok`.
22939 pub contents: CResult_HostnameDecodeErrorZPtr,
22940 /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
22941 pub result_ok: bool,
22944 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
22945 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
22946 CResult_HostnameDecodeErrorZ {
22947 contents: CResult_HostnameDecodeErrorZPtr {
22948 result: Box::into_raw(Box::new(o)),
22954 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
22955 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
22956 CResult_HostnameDecodeErrorZ {
22957 contents: CResult_HostnameDecodeErrorZPtr {
22958 err: Box::into_raw(Box::new(e)),
22963 /// Checks if the given object is currently in the success state
22965 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
22969 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
22970 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
22971 impl Drop for CResult_HostnameDecodeErrorZ {
22972 fn drop(&mut self) {
22973 if self.result_ok {
22974 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22975 let _ = unsafe { Box::from_raw(self.contents.result) };
22978 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22979 let _ = unsafe { Box::from_raw(self.contents.err) };
22984 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
22985 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
22986 let contents = if o.result_ok {
22987 let result = unsafe { o.contents.result };
22988 unsafe { o.contents.result = core::ptr::null_mut() };
22989 CResult_HostnameDecodeErrorZPtr { result }
22991 let err = unsafe { o.contents.err };
22992 unsafe { o.contents.err = core::ptr::null_mut(); }
22993 CResult_HostnameDecodeErrorZPtr { err }
22997 result_ok: o.result_ok,
23001 impl Clone for CResult_HostnameDecodeErrorZ {
23002 fn clone(&self) -> Self {
23003 if self.result_ok {
23004 Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
23005 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
23008 Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
23009 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23015 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
23016 /// but with all dynamically-allocated buffers duplicated in new buffers.
23017 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
23019 /// The contents of CResult_TransactionU16LenLimitedNoneZ
23020 pub union CResult_TransactionU16LenLimitedNoneZPtr {
23021 /// A pointer to the contents in the success state.
23022 /// Reading from this pointer when `result_ok` is not set is undefined.
23023 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
23024 /// Note that this value is always NULL, as there are no contents in the Err variant
23025 pub err: *mut core::ffi::c_void,
23028 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
23029 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
23030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23031 pub struct CResult_TransactionU16LenLimitedNoneZ {
23032 /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
23033 /// `err` or `result` depending on the state of `result_ok`.
23034 pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
23035 /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
23036 pub result_ok: bool,
23039 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
23040 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
23041 CResult_TransactionU16LenLimitedNoneZ {
23042 contents: CResult_TransactionU16LenLimitedNoneZPtr {
23043 result: Box::into_raw(Box::new(o)),
23049 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
23050 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
23051 CResult_TransactionU16LenLimitedNoneZ {
23052 contents: CResult_TransactionU16LenLimitedNoneZPtr {
23053 err: core::ptr::null_mut(),
23058 /// Checks if the given object is currently in the success state
23060 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
23064 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
23065 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
23066 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
23067 fn drop(&mut self) {
23068 if self.result_ok {
23069 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23070 let _ = unsafe { Box::from_raw(self.contents.result) };
23076 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
23077 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
23078 let contents = if o.result_ok {
23079 let result = unsafe { o.contents.result };
23080 unsafe { o.contents.result = core::ptr::null_mut() };
23081 CResult_TransactionU16LenLimitedNoneZPtr { result }
23083 let _ = unsafe { Box::from_raw(o.contents.err) };
23084 o.contents.err = core::ptr::null_mut();
23085 CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
23089 result_ok: o.result_ok,
23093 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
23094 fn clone(&self) -> Self {
23095 if self.result_ok {
23096 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
23097 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
23100 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
23101 err: core::ptr::null_mut()
23107 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
23108 /// but with all dynamically-allocated buffers duplicated in new buffers.
23109 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
23111 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
23112 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23113 /// A pointer to the contents in the success state.
23114 /// Reading from this pointer when `result_ok` is not set is undefined.
23115 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
23116 /// A pointer to the contents in the error state.
23117 /// Reading from this pointer when `result_ok` is set is undefined.
23118 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23121 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
23122 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
23123 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23124 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
23125 /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
23126 /// `err` or `result` depending on the state of `result_ok`.
23127 pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
23128 /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
23129 pub result_ok: bool,
23132 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
23133 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
23134 CResult_TransactionU16LenLimitedDecodeErrorZ {
23135 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23136 result: Box::into_raw(Box::new(o)),
23142 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
23143 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
23144 CResult_TransactionU16LenLimitedDecodeErrorZ {
23145 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23146 err: Box::into_raw(Box::new(e)),
23151 /// Checks if the given object is currently in the success state
23153 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
23157 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
23158 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
23159 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
23160 fn drop(&mut self) {
23161 if self.result_ok {
23162 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23163 let _ = unsafe { Box::from_raw(self.contents.result) };
23166 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23167 let _ = unsafe { Box::from_raw(self.contents.err) };
23172 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
23173 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
23174 let contents = if o.result_ok {
23175 let result = unsafe { o.contents.result };
23176 unsafe { o.contents.result = core::ptr::null_mut() };
23177 CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
23179 let err = unsafe { o.contents.err };
23180 unsafe { o.contents.err = core::ptr::null_mut(); }
23181 CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
23185 result_ok: o.result_ok,
23189 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
23190 fn clone(&self) -> Self {
23191 if self.result_ok {
23192 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23193 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
23196 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
23197 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23203 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
23204 /// but with all dynamically-allocated buffers duplicated in new buffers.
23205 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
23207 /// The contents of CResult_UntrustedStringDecodeErrorZ
23208 pub union CResult_UntrustedStringDecodeErrorZPtr {
23209 /// A pointer to the contents in the success state.
23210 /// Reading from this pointer when `result_ok` is not set is undefined.
23211 pub result: *mut crate::lightning::util::string::UntrustedString,
23212 /// A pointer to the contents in the error state.
23213 /// Reading from this pointer when `result_ok` is set is undefined.
23214 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23217 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
23218 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
23219 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23220 pub struct CResult_UntrustedStringDecodeErrorZ {
23221 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
23222 /// `err` or `result` depending on the state of `result_ok`.
23223 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
23224 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
23225 pub result_ok: bool,
23228 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
23229 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
23230 CResult_UntrustedStringDecodeErrorZ {
23231 contents: CResult_UntrustedStringDecodeErrorZPtr {
23232 result: Box::into_raw(Box::new(o)),
23238 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
23239 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
23240 CResult_UntrustedStringDecodeErrorZ {
23241 contents: CResult_UntrustedStringDecodeErrorZPtr {
23242 err: Box::into_raw(Box::new(e)),
23247 /// Checks if the given object is currently in the success state
23249 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
23253 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
23254 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
23255 impl Drop for CResult_UntrustedStringDecodeErrorZ {
23256 fn drop(&mut self) {
23257 if self.result_ok {
23258 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23259 let _ = unsafe { Box::from_raw(self.contents.result) };
23262 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23263 let _ = unsafe { Box::from_raw(self.contents.err) };
23268 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
23269 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
23270 let contents = if o.result_ok {
23271 let result = unsafe { o.contents.result };
23272 unsafe { o.contents.result = core::ptr::null_mut() };
23273 CResult_UntrustedStringDecodeErrorZPtr { result }
23275 let err = unsafe { o.contents.err };
23276 unsafe { o.contents.err = core::ptr::null_mut(); }
23277 CResult_UntrustedStringDecodeErrorZPtr { err }
23281 result_ok: o.result_ok,
23285 impl Clone for CResult_UntrustedStringDecodeErrorZ {
23286 fn clone(&self) -> Self {
23287 if self.result_ok {
23288 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
23289 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
23292 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
23293 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23299 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
23300 /// but with all dynamically-allocated buffers duplicated in new buffers.
23301 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
23303 /// A tuple of 2 elements. See the individual fields for the types contained.
23304 pub struct C2Tuple__u832u16Z {
23305 /// The element at position 0
23306 pub a: crate::c_types::ThirtyTwoBytes,
23307 /// The element at position 1
23310 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
23311 fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
23318 impl C2Tuple__u832u16Z {
23319 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
23323 impl Clone for C2Tuple__u832u16Z {
23324 fn clone(&self) -> Self {
23326 a: Clone::clone(&self.a),
23327 b: Clone::clone(&self.b),
23332 /// Creates a new tuple which has the same data as `orig`
23333 /// but with all dynamically-allocated buffers duplicated in new buffers.
23334 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
23335 /// Creates a new C2Tuple__u832u16Z from the contained elements.
23337 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
23338 C2Tuple__u832u16Z { a, b, }
23342 /// Frees any resources used by the C2Tuple__u832u16Z.
23343 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
23345 /// The contents of CResult_PaymentRelayDecodeErrorZ
23346 pub union CResult_PaymentRelayDecodeErrorZPtr {
23347 /// A pointer to the contents in the success state.
23348 /// Reading from this pointer when `result_ok` is not set is undefined.
23349 pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
23350 /// A pointer to the contents in the error state.
23351 /// Reading from this pointer when `result_ok` is set is undefined.
23352 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23355 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
23356 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
23357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23358 pub struct CResult_PaymentRelayDecodeErrorZ {
23359 /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
23360 /// `err` or `result` depending on the state of `result_ok`.
23361 pub contents: CResult_PaymentRelayDecodeErrorZPtr,
23362 /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
23363 pub result_ok: bool,
23366 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
23367 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
23368 CResult_PaymentRelayDecodeErrorZ {
23369 contents: CResult_PaymentRelayDecodeErrorZPtr {
23370 result: Box::into_raw(Box::new(o)),
23376 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
23377 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
23378 CResult_PaymentRelayDecodeErrorZ {
23379 contents: CResult_PaymentRelayDecodeErrorZPtr {
23380 err: Box::into_raw(Box::new(e)),
23385 /// Checks if the given object is currently in the success state
23387 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
23391 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
23392 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
23393 impl Drop for CResult_PaymentRelayDecodeErrorZ {
23394 fn drop(&mut self) {
23395 if self.result_ok {
23396 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23397 let _ = unsafe { Box::from_raw(self.contents.result) };
23400 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23401 let _ = unsafe { Box::from_raw(self.contents.err) };
23406 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
23407 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
23408 let contents = if o.result_ok {
23409 let result = unsafe { o.contents.result };
23410 unsafe { o.contents.result = core::ptr::null_mut() };
23411 CResult_PaymentRelayDecodeErrorZPtr { result }
23413 let err = unsafe { o.contents.err };
23414 unsafe { o.contents.err = core::ptr::null_mut(); }
23415 CResult_PaymentRelayDecodeErrorZPtr { err }
23419 result_ok: o.result_ok,
23423 impl Clone for CResult_PaymentRelayDecodeErrorZ {
23424 fn clone(&self) -> Self {
23425 if self.result_ok {
23426 Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
23427 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
23430 Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
23431 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23437 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
23438 /// but with all dynamically-allocated buffers duplicated in new buffers.
23439 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
23441 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
23442 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
23443 /// A pointer to the contents in the success state.
23444 /// Reading from this pointer when `result_ok` is not set is undefined.
23445 pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
23446 /// A pointer to the contents in the error state.
23447 /// Reading from this pointer when `result_ok` is set is undefined.
23448 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23451 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
23452 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
23453 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23454 pub struct CResult_PaymentConstraintsDecodeErrorZ {
23455 /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
23456 /// `err` or `result` depending on the state of `result_ok`.
23457 pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
23458 /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
23459 pub result_ok: bool,
23462 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
23463 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
23464 CResult_PaymentConstraintsDecodeErrorZ {
23465 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23466 result: Box::into_raw(Box::new(o)),
23472 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
23473 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
23474 CResult_PaymentConstraintsDecodeErrorZ {
23475 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23476 err: Box::into_raw(Box::new(e)),
23481 /// Checks if the given object is currently in the success state
23483 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
23487 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
23488 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
23489 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
23490 fn drop(&mut self) {
23491 if self.result_ok {
23492 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23493 let _ = unsafe { Box::from_raw(self.contents.result) };
23496 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23497 let _ = unsafe { Box::from_raw(self.contents.err) };
23502 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
23503 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
23504 let contents = if o.result_ok {
23505 let result = unsafe { o.contents.result };
23506 unsafe { o.contents.result = core::ptr::null_mut() };
23507 CResult_PaymentConstraintsDecodeErrorZPtr { result }
23509 let err = unsafe { o.contents.err };
23510 unsafe { o.contents.err = core::ptr::null_mut(); }
23511 CResult_PaymentConstraintsDecodeErrorZPtr { err }
23515 result_ok: o.result_ok,
23519 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
23520 fn clone(&self) -> Self {
23521 if self.result_ok {
23522 Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23523 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
23526 Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
23527 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23533 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
23534 /// but with all dynamically-allocated buffers duplicated in new buffers.
23535 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
23537 /// A tuple of 3 elements. See the individual fields for the types contained.
23538 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23539 /// The element at position 0
23540 pub a: crate::c_types::ThirtyTwoBytes,
23541 /// The element at position 1
23542 pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
23543 /// The element at position 2
23544 pub c: crate::lightning::routing::router::RouteParameters,
23546 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23547 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
23555 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23556 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
23557 (self.a, self.b, self.c)
23560 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23561 fn clone(&self) -> Self {
23563 a: Clone::clone(&self.a),
23564 b: Clone::clone(&self.b),
23565 c: Clone::clone(&self.c),
23570 /// Creates a new tuple which has the same data as `orig`
23571 /// but with all dynamically-allocated buffers duplicated in new buffers.
23572 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
23573 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
23575 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::outbound_payment::RecipientOnionFields, c: crate::lightning::routing::router::RouteParameters) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
23576 C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
23580 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
23581 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
23583 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
23584 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23585 /// A pointer to the contents in the success state.
23586 /// Reading from this pointer when `result_ok` is not set is undefined.
23587 pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
23588 /// Note that this value is always NULL, as there are no contents in the Err variant
23589 pub err: *mut core::ffi::c_void,
23592 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
23593 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
23594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23595 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23596 /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
23597 /// `err` or `result` depending on the state of `result_ok`.
23598 pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
23599 /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
23600 pub result_ok: bool,
23603 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
23604 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23605 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23606 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23607 result: Box::into_raw(Box::new(o)),
23613 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
23614 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23615 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23616 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23617 err: core::ptr::null_mut(),
23622 /// Checks if the given object is currently in the success state
23624 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
23628 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
23629 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
23630 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23631 fn drop(&mut self) {
23632 if self.result_ok {
23633 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23634 let _ = unsafe { Box::from_raw(self.contents.result) };
23640 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23641 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
23642 let contents = if o.result_ok {
23643 let result = unsafe { o.contents.result };
23644 unsafe { o.contents.result = core::ptr::null_mut() };
23645 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
23647 let _ = unsafe { Box::from_raw(o.contents.err) };
23648 o.contents.err = core::ptr::null_mut();
23649 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
23653 result_ok: o.result_ok,
23657 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
23658 fn clone(&self) -> Self {
23659 if self.result_ok {
23660 Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23661 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
23664 Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
23665 err: core::ptr::null_mut()
23671 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
23672 /// but with all dynamically-allocated buffers duplicated in new buffers.
23673 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
23675 /// The contents of CResult_StrSecp256k1ErrorZ
23676 pub union CResult_StrSecp256k1ErrorZPtr {
23677 /// A pointer to the contents in the success state.
23678 /// Reading from this pointer when `result_ok` is not set is undefined.
23679 pub result: *mut crate::c_types::Str,
23680 /// A pointer to the contents in the error state.
23681 /// Reading from this pointer when `result_ok` is set is undefined.
23682 pub err: *mut crate::c_types::Secp256k1Error,
23685 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
23686 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
23687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23688 pub struct CResult_StrSecp256k1ErrorZ {
23689 /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
23690 /// `err` or `result` depending on the state of `result_ok`.
23691 pub contents: CResult_StrSecp256k1ErrorZPtr,
23692 /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
23693 pub result_ok: bool,
23696 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
23697 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
23698 CResult_StrSecp256k1ErrorZ {
23699 contents: CResult_StrSecp256k1ErrorZPtr {
23700 result: Box::into_raw(Box::new(o)),
23706 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
23707 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
23708 CResult_StrSecp256k1ErrorZ {
23709 contents: CResult_StrSecp256k1ErrorZPtr {
23710 err: Box::into_raw(Box::new(e)),
23715 /// Checks if the given object is currently in the success state
23717 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
23721 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
23722 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
23723 impl Drop for CResult_StrSecp256k1ErrorZ {
23724 fn drop(&mut self) {
23725 if self.result_ok {
23726 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23727 let _ = unsafe { Box::from_raw(self.contents.result) };
23730 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23731 let _ = unsafe { Box::from_raw(self.contents.err) };
23736 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
23737 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
23738 let contents = if o.result_ok {
23739 let result = unsafe { o.contents.result };
23740 unsafe { o.contents.result = core::ptr::null_mut() };
23741 CResult_StrSecp256k1ErrorZPtr { result }
23743 let err = unsafe { o.contents.err };
23744 unsafe { o.contents.err = core::ptr::null_mut(); }
23745 CResult_StrSecp256k1ErrorZPtr { err }
23749 result_ok: o.result_ok,
23753 impl Clone for CResult_StrSecp256k1ErrorZ {
23754 fn clone(&self) -> Self {
23755 if self.result_ok {
23756 Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
23757 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
23760 Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
23761 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
23767 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
23768 /// but with all dynamically-allocated buffers duplicated in new buffers.
23769 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
23771 /// The contents of CResult_TxOutUtxoLookupErrorZ
23772 pub union CResult_TxOutUtxoLookupErrorZPtr {
23773 /// A pointer to the contents in the success state.
23774 /// Reading from this pointer when `result_ok` is not set is undefined.
23775 pub result: *mut crate::c_types::TxOut,
23776 /// A pointer to the contents in the error state.
23777 /// Reading from this pointer when `result_ok` is set is undefined.
23778 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
23781 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
23782 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
23783 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23784 pub struct CResult_TxOutUtxoLookupErrorZ {
23785 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
23786 /// `err` or `result` depending on the state of `result_ok`.
23787 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
23788 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
23789 pub result_ok: bool,
23792 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
23793 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
23794 CResult_TxOutUtxoLookupErrorZ {
23795 contents: CResult_TxOutUtxoLookupErrorZPtr {
23796 result: Box::into_raw(Box::new(o)),
23802 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
23803 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
23804 CResult_TxOutUtxoLookupErrorZ {
23805 contents: CResult_TxOutUtxoLookupErrorZPtr {
23806 err: Box::into_raw(Box::new(e)),
23811 /// Checks if the given object is currently in the success state
23813 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
23817 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
23818 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
23819 impl Drop for CResult_TxOutUtxoLookupErrorZ {
23820 fn drop(&mut self) {
23821 if self.result_ok {
23822 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23823 let _ = unsafe { Box::from_raw(self.contents.result) };
23826 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23827 let _ = unsafe { Box::from_raw(self.contents.err) };
23832 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
23833 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
23834 let contents = if o.result_ok {
23835 let result = unsafe { o.contents.result };
23836 unsafe { o.contents.result = core::ptr::null_mut() };
23837 CResult_TxOutUtxoLookupErrorZPtr { result }
23839 let err = unsafe { o.contents.err };
23840 unsafe { o.contents.err = core::ptr::null_mut(); }
23841 CResult_TxOutUtxoLookupErrorZPtr { err }
23845 result_ok: o.result_ok,
23849 impl Clone for CResult_TxOutUtxoLookupErrorZ {
23850 fn clone(&self) -> Self {
23851 if self.result_ok {
23852 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
23853 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
23856 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
23857 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
23863 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
23864 /// but with all dynamically-allocated buffers duplicated in new buffers.
23865 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
23867 /// A tuple of 3 elements. See the individual fields for the types contained.
23868 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23869 /// The element at position 0
23870 pub a: crate::c_types::PublicKey,
23871 /// The element at position 1
23872 pub b: crate::lightning::ln::msgs::OnionMessage,
23873 /// The element at position 2
23874 pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
23876 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23877 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
23885 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23886 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ) {
23887 (self.a, self.b, self.c)
23890 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23891 fn clone(&self) -> Self {
23893 a: Clone::clone(&self.a),
23894 b: Clone::clone(&self.b),
23895 c: Clone::clone(&self.c),
23900 /// Creates a new tuple which has the same data as `orig`
23901 /// but with all dynamically-allocated buffers duplicated in new buffers.
23902 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
23903 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
23905 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage, c: crate::c_types::derived::COption_CVec_SocketAddressZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
23906 C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
23910 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
23911 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
23913 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
23914 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
23915 /// A pointer to the contents in the success state.
23916 /// Reading from this pointer when `result_ok` is not set is undefined.
23917 pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
23918 /// A pointer to the contents in the error state.
23919 /// Reading from this pointer when `result_ok` is set is undefined.
23920 pub err: *mut crate::lightning::onion_message::messenger::SendError,
23923 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
23924 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
23925 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23926 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23927 /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
23928 /// `err` or `result` depending on the state of `result_ok`.
23929 pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
23930 /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
23931 pub result_ok: bool,
23934 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
23935 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23936 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23937 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
23938 result: Box::into_raw(Box::new(o)),
23944 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
23945 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23946 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23947 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
23948 err: Box::into_raw(Box::new(e)),
23953 /// Checks if the given object is currently in the success state
23955 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
23959 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
23960 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
23961 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23962 fn drop(&mut self) {
23963 if self.result_ok {
23964 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23965 let _ = unsafe { Box::from_raw(self.contents.result) };
23968 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23969 let _ = unsafe { Box::from_raw(self.contents.err) };
23974 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
23975 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
23976 let contents = if o.result_ok {
23977 let result = unsafe { o.contents.result };
23978 unsafe { o.contents.result = core::ptr::null_mut() };
23979 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
23981 let err = unsafe { o.contents.err };
23982 unsafe { o.contents.err = core::ptr::null_mut(); }
23983 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
23987 result_ok: o.result_ok,
23992 /// The contents of CResult_PeeledOnionNoneZ
23993 pub union CResult_PeeledOnionNoneZPtr {
23994 /// A pointer to the contents in the success state.
23995 /// Reading from this pointer when `result_ok` is not set is undefined.
23996 pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
23997 /// Note that this value is always NULL, as there are no contents in the Err variant
23998 pub err: *mut core::ffi::c_void,
24001 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
24002 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
24003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24004 pub struct CResult_PeeledOnionNoneZ {
24005 /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
24006 /// `err` or `result` depending on the state of `result_ok`.
24007 pub contents: CResult_PeeledOnionNoneZPtr,
24008 /// Whether this CResult_PeeledOnionNoneZ represents a success state.
24009 pub result_ok: bool,
24012 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
24013 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
24014 CResult_PeeledOnionNoneZ {
24015 contents: CResult_PeeledOnionNoneZPtr {
24016 result: Box::into_raw(Box::new(o)),
24022 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
24023 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
24024 CResult_PeeledOnionNoneZ {
24025 contents: CResult_PeeledOnionNoneZPtr {
24026 err: core::ptr::null_mut(),
24031 /// Checks if the given object is currently in the success state
24033 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
24037 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
24038 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
24039 impl Drop for CResult_PeeledOnionNoneZ {
24040 fn drop(&mut self) {
24041 if self.result_ok {
24042 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24043 let _ = unsafe { Box::from_raw(self.contents.result) };
24049 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
24050 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
24051 let contents = if o.result_ok {
24052 let result = unsafe { o.contents.result };
24053 unsafe { o.contents.result = core::ptr::null_mut() };
24054 CResult_PeeledOnionNoneZPtr { result }
24056 let _ = unsafe { Box::from_raw(o.contents.err) };
24057 o.contents.err = core::ptr::null_mut();
24058 CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
24062 result_ok: o.result_ok,
24067 /// The contents of CResult_SendSuccessSendErrorZ
24068 pub union CResult_SendSuccessSendErrorZPtr {
24069 /// A pointer to the contents in the success state.
24070 /// Reading from this pointer when `result_ok` is not set is undefined.
24071 pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
24072 /// A pointer to the contents in the error state.
24073 /// Reading from this pointer when `result_ok` is set is undefined.
24074 pub err: *mut crate::lightning::onion_message::messenger::SendError,
24077 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
24078 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
24079 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24080 pub struct CResult_SendSuccessSendErrorZ {
24081 /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
24082 /// `err` or `result` depending on the state of `result_ok`.
24083 pub contents: CResult_SendSuccessSendErrorZPtr,
24084 /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
24085 pub result_ok: bool,
24088 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
24089 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
24090 CResult_SendSuccessSendErrorZ {
24091 contents: CResult_SendSuccessSendErrorZPtr {
24092 result: Box::into_raw(Box::new(o)),
24098 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
24099 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
24100 CResult_SendSuccessSendErrorZ {
24101 contents: CResult_SendSuccessSendErrorZPtr {
24102 err: Box::into_raw(Box::new(e)),
24107 /// Checks if the given object is currently in the success state
24109 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
24113 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
24114 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
24115 impl Drop for CResult_SendSuccessSendErrorZ {
24116 fn drop(&mut self) {
24117 if self.result_ok {
24118 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24119 let _ = unsafe { Box::from_raw(self.contents.result) };
24122 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24123 let _ = unsafe { Box::from_raw(self.contents.err) };
24128 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
24129 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
24130 let contents = if o.result_ok {
24131 let result = unsafe { o.contents.result };
24132 unsafe { o.contents.result = core::ptr::null_mut() };
24133 CResult_SendSuccessSendErrorZPtr { result }
24135 let err = unsafe { o.contents.err };
24136 unsafe { o.contents.err = core::ptr::null_mut(); }
24137 CResult_SendSuccessSendErrorZPtr { err }
24141 result_ok: o.result_ok,
24146 /// The contents of CResult_BlindedPathNoneZ
24147 pub union CResult_BlindedPathNoneZPtr {
24148 /// A pointer to the contents in the success state.
24149 /// Reading from this pointer when `result_ok` is not set is undefined.
24150 pub result: *mut crate::lightning::blinded_path::BlindedPath,
24151 /// Note that this value is always NULL, as there are no contents in the Err variant
24152 pub err: *mut core::ffi::c_void,
24155 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
24156 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
24157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24158 pub struct CResult_BlindedPathNoneZ {
24159 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
24160 /// `err` or `result` depending on the state of `result_ok`.
24161 pub contents: CResult_BlindedPathNoneZPtr,
24162 /// Whether this CResult_BlindedPathNoneZ represents a success state.
24163 pub result_ok: bool,
24166 /// Creates a new CResult_BlindedPathNoneZ in the success state.
24167 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
24168 CResult_BlindedPathNoneZ {
24169 contents: CResult_BlindedPathNoneZPtr {
24170 result: Box::into_raw(Box::new(o)),
24176 /// Creates a new CResult_BlindedPathNoneZ in the error state.
24177 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
24178 CResult_BlindedPathNoneZ {
24179 contents: CResult_BlindedPathNoneZPtr {
24180 err: core::ptr::null_mut(),
24185 /// Checks if the given object is currently in the success state
24187 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
24191 /// Frees any resources used by the CResult_BlindedPathNoneZ.
24192 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
24193 impl Drop for CResult_BlindedPathNoneZ {
24194 fn drop(&mut self) {
24195 if self.result_ok {
24196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24197 let _ = unsafe { Box::from_raw(self.contents.result) };
24203 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
24204 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
24205 let contents = if o.result_ok {
24206 let result = unsafe { o.contents.result };
24207 unsafe { o.contents.result = core::ptr::null_mut() };
24208 CResult_BlindedPathNoneZPtr { result }
24210 let _ = unsafe { Box::from_raw(o.contents.err) };
24211 o.contents.err = core::ptr::null_mut();
24212 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
24216 result_ok: o.result_ok,
24220 impl Clone for CResult_BlindedPathNoneZ {
24221 fn clone(&self) -> Self {
24222 if self.result_ok {
24223 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
24224 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
24227 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
24228 err: core::ptr::null_mut()
24234 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
24235 /// but with all dynamically-allocated buffers duplicated in new buffers.
24236 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
24238 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
24239 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24240 /// A pointer to the contents in the success state.
24241 /// Reading from this pointer when `result_ok` is not set is undefined.
24242 pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
24243 /// Note that this value is always NULL, as there are no contents in the Err variant
24244 pub err: *mut core::ffi::c_void,
24247 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
24248 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
24249 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24250 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24251 /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
24252 /// `err` or `result` depending on the state of `result_ok`.
24253 pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
24254 /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
24255 pub result_ok: bool,
24258 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
24259 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24260 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24261 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24262 result: Box::into_raw(Box::new(o)),
24268 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
24269 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24270 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24271 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24272 err: core::ptr::null_mut(),
24277 /// Checks if the given object is currently in the success state
24279 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
24283 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
24284 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
24285 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24286 fn drop(&mut self) {
24287 if self.result_ok {
24288 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24289 let _ = unsafe { Box::from_raw(self.contents.result) };
24295 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24296 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
24297 let contents = if o.result_ok {
24298 let result = unsafe { o.contents.result };
24299 unsafe { o.contents.result = core::ptr::null_mut() };
24300 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
24302 let _ = unsafe { Box::from_raw(o.contents.err) };
24303 o.contents.err = core::ptr::null_mut();
24304 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
24308 result_ok: o.result_ok,
24312 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
24313 fn clone(&self) -> Self {
24314 if self.result_ok {
24315 Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24316 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
24319 Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
24320 err: core::ptr::null_mut()
24326 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
24327 /// but with all dynamically-allocated buffers duplicated in new buffers.
24328 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
24330 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
24331 /// This corresponds to std::vector in C++
24332 pub struct CVec_ForwardNodeZ {
24333 /// The elements in the array.
24334 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
24335 pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
24336 /// The number of elements pointed to by `data`.
24339 impl CVec_ForwardNodeZ {
24340 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
24341 if self.datalen == 0 { return Vec::new(); }
24342 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24343 self.data = core::ptr::null_mut();
24347 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
24348 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
24351 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
24352 fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
24353 let datalen = v.len();
24354 let data = Box::into_raw(v.into_boxed_slice());
24355 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
24359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
24360 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
24361 impl Drop for CVec_ForwardNodeZ {
24362 fn drop(&mut self) {
24363 if self.datalen == 0 { return; }
24364 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
24367 impl Clone for CVec_ForwardNodeZ {
24368 fn clone(&self) -> Self {
24369 let mut res = Vec::new();
24370 if self.datalen == 0 { return Self::from(res); }
24371 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
24376 /// The contents of CResult_BlindedPathDecodeErrorZ
24377 pub union CResult_BlindedPathDecodeErrorZPtr {
24378 /// A pointer to the contents in the success state.
24379 /// Reading from this pointer when `result_ok` is not set is undefined.
24380 pub result: *mut crate::lightning::blinded_path::BlindedPath,
24381 /// A pointer to the contents in the error state.
24382 /// Reading from this pointer when `result_ok` is set is undefined.
24383 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24386 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
24387 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
24388 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24389 pub struct CResult_BlindedPathDecodeErrorZ {
24390 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
24391 /// `err` or `result` depending on the state of `result_ok`.
24392 pub contents: CResult_BlindedPathDecodeErrorZPtr,
24393 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
24394 pub result_ok: bool,
24397 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
24398 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
24399 CResult_BlindedPathDecodeErrorZ {
24400 contents: CResult_BlindedPathDecodeErrorZPtr {
24401 result: Box::into_raw(Box::new(o)),
24407 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
24408 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
24409 CResult_BlindedPathDecodeErrorZ {
24410 contents: CResult_BlindedPathDecodeErrorZPtr {
24411 err: Box::into_raw(Box::new(e)),
24416 /// Checks if the given object is currently in the success state
24418 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
24422 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
24423 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
24424 impl Drop for CResult_BlindedPathDecodeErrorZ {
24425 fn drop(&mut self) {
24426 if self.result_ok {
24427 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24428 let _ = unsafe { Box::from_raw(self.contents.result) };
24431 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24432 let _ = unsafe { Box::from_raw(self.contents.err) };
24437 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
24438 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
24439 let contents = if o.result_ok {
24440 let result = unsafe { o.contents.result };
24441 unsafe { o.contents.result = core::ptr::null_mut() };
24442 CResult_BlindedPathDecodeErrorZPtr { result }
24444 let err = unsafe { o.contents.err };
24445 unsafe { o.contents.err = core::ptr::null_mut(); }
24446 CResult_BlindedPathDecodeErrorZPtr { err }
24450 result_ok: o.result_ok,
24454 impl Clone for CResult_BlindedPathDecodeErrorZ {
24455 fn clone(&self) -> Self {
24456 if self.result_ok {
24457 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
24458 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
24461 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
24462 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24468 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
24469 /// but with all dynamically-allocated buffers duplicated in new buffers.
24470 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
24472 /// The contents of CResult_BlindedHopDecodeErrorZ
24473 pub union CResult_BlindedHopDecodeErrorZPtr {
24474 /// A pointer to the contents in the success state.
24475 /// Reading from this pointer when `result_ok` is not set is undefined.
24476 pub result: *mut crate::lightning::blinded_path::BlindedHop,
24477 /// A pointer to the contents in the error state.
24478 /// Reading from this pointer when `result_ok` is set is undefined.
24479 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24482 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
24483 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
24484 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24485 pub struct CResult_BlindedHopDecodeErrorZ {
24486 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
24487 /// `err` or `result` depending on the state of `result_ok`.
24488 pub contents: CResult_BlindedHopDecodeErrorZPtr,
24489 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
24490 pub result_ok: bool,
24493 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
24494 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
24495 CResult_BlindedHopDecodeErrorZ {
24496 contents: CResult_BlindedHopDecodeErrorZPtr {
24497 result: Box::into_raw(Box::new(o)),
24503 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
24504 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
24505 CResult_BlindedHopDecodeErrorZ {
24506 contents: CResult_BlindedHopDecodeErrorZPtr {
24507 err: Box::into_raw(Box::new(e)),
24512 /// Checks if the given object is currently in the success state
24514 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
24518 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
24519 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
24520 impl Drop for CResult_BlindedHopDecodeErrorZ {
24521 fn drop(&mut self) {
24522 if self.result_ok {
24523 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24524 let _ = unsafe { Box::from_raw(self.contents.result) };
24527 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24528 let _ = unsafe { Box::from_raw(self.contents.err) };
24533 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
24534 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
24535 let contents = if o.result_ok {
24536 let result = unsafe { o.contents.result };
24537 unsafe { o.contents.result = core::ptr::null_mut() };
24538 CResult_BlindedHopDecodeErrorZPtr { result }
24540 let err = unsafe { o.contents.err };
24541 unsafe { o.contents.err = core::ptr::null_mut(); }
24542 CResult_BlindedHopDecodeErrorZPtr { err }
24546 result_ok: o.result_ok,
24550 impl Clone for CResult_BlindedHopDecodeErrorZ {
24551 fn clone(&self) -> Self {
24552 if self.result_ok {
24553 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
24554 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
24557 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
24558 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24564 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
24565 /// but with all dynamically-allocated buffers duplicated in new buffers.
24566 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
24568 /// The contents of CResult_InvoiceErrorDecodeErrorZ
24569 pub union CResult_InvoiceErrorDecodeErrorZPtr {
24570 /// A pointer to the contents in the success state.
24571 /// Reading from this pointer when `result_ok` is not set is undefined.
24572 pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
24573 /// A pointer to the contents in the error state.
24574 /// Reading from this pointer when `result_ok` is set is undefined.
24575 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24578 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
24579 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
24580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24581 pub struct CResult_InvoiceErrorDecodeErrorZ {
24582 /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
24583 /// `err` or `result` depending on the state of `result_ok`.
24584 pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
24585 /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
24586 pub result_ok: bool,
24589 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
24590 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
24591 CResult_InvoiceErrorDecodeErrorZ {
24592 contents: CResult_InvoiceErrorDecodeErrorZPtr {
24593 result: Box::into_raw(Box::new(o)),
24599 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
24600 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
24601 CResult_InvoiceErrorDecodeErrorZ {
24602 contents: CResult_InvoiceErrorDecodeErrorZPtr {
24603 err: Box::into_raw(Box::new(e)),
24608 /// Checks if the given object is currently in the success state
24610 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
24614 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
24615 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
24616 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
24617 fn drop(&mut self) {
24618 if self.result_ok {
24619 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24620 let _ = unsafe { Box::from_raw(self.contents.result) };
24623 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24624 let _ = unsafe { Box::from_raw(self.contents.err) };
24629 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
24630 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
24631 let contents = if o.result_ok {
24632 let result = unsafe { o.contents.result };
24633 unsafe { o.contents.result = core::ptr::null_mut() };
24634 CResult_InvoiceErrorDecodeErrorZPtr { result }
24636 let err = unsafe { o.contents.err };
24637 unsafe { o.contents.err = core::ptr::null_mut(); }
24638 CResult_InvoiceErrorDecodeErrorZPtr { err }
24642 result_ok: o.result_ok,
24646 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
24647 fn clone(&self) -> Self {
24648 if self.result_ok {
24649 Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
24650 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
24653 Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
24654 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24660 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
24661 /// but with all dynamically-allocated buffers duplicated in new buffers.
24662 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
24664 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
24665 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24666 /// A pointer to the contents in the success state.
24667 /// Reading from this pointer when `result_ok` is not set is undefined.
24668 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
24669 /// A pointer to the contents in the error state.
24670 /// Reading from this pointer when `result_ok` is set is undefined.
24671 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24674 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
24675 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24677 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
24678 /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
24679 /// `err` or `result` depending on the state of `result_ok`.
24680 pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
24681 /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
24682 pub result_ok: bool,
24685 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
24686 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
24687 CResult_DelayedPaymentBasepointDecodeErrorZ {
24688 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24689 result: Box::into_raw(Box::new(o)),
24695 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
24696 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
24697 CResult_DelayedPaymentBasepointDecodeErrorZ {
24698 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24699 err: Box::into_raw(Box::new(e)),
24704 /// Checks if the given object is currently in the success state
24706 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
24710 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
24711 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
24712 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
24713 fn drop(&mut self) {
24714 if self.result_ok {
24715 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24716 let _ = unsafe { Box::from_raw(self.contents.result) };
24719 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24720 let _ = unsafe { Box::from_raw(self.contents.err) };
24725 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
24726 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24727 let contents = if o.result_ok {
24728 let result = unsafe { o.contents.result };
24729 unsafe { o.contents.result = core::ptr::null_mut() };
24730 CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
24732 let err = unsafe { o.contents.err };
24733 unsafe { o.contents.err = core::ptr::null_mut(); }
24734 CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
24738 result_ok: o.result_ok,
24742 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
24743 fn clone(&self) -> Self {
24744 if self.result_ok {
24745 Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24746 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
24749 Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
24750 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24756 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
24757 /// but with all dynamically-allocated buffers duplicated in new buffers.
24758 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
24760 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
24761 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
24762 /// A pointer to the contents in the success state.
24763 /// Reading from this pointer when `result_ok` is not set is undefined.
24764 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
24765 /// A pointer to the contents in the error state.
24766 /// Reading from this pointer when `result_ok` is set is undefined.
24767 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24770 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
24771 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
24772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24773 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
24774 /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
24775 /// `err` or `result` depending on the state of `result_ok`.
24776 pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
24777 /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
24778 pub result_ok: bool,
24781 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
24782 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
24783 CResult_DelayedPaymentKeyDecodeErrorZ {
24784 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24785 result: Box::into_raw(Box::new(o)),
24791 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
24792 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
24793 CResult_DelayedPaymentKeyDecodeErrorZ {
24794 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24795 err: Box::into_raw(Box::new(e)),
24800 /// Checks if the given object is currently in the success state
24802 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
24806 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
24807 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
24808 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
24809 fn drop(&mut self) {
24810 if self.result_ok {
24811 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24812 let _ = unsafe { Box::from_raw(self.contents.result) };
24815 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24816 let _ = unsafe { Box::from_raw(self.contents.err) };
24821 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
24822 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
24823 let contents = if o.result_ok {
24824 let result = unsafe { o.contents.result };
24825 unsafe { o.contents.result = core::ptr::null_mut() };
24826 CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
24828 let err = unsafe { o.contents.err };
24829 unsafe { o.contents.err = core::ptr::null_mut(); }
24830 CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
24834 result_ok: o.result_ok,
24838 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
24839 fn clone(&self) -> Self {
24840 if self.result_ok {
24841 Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24842 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
24845 Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
24846 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24852 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
24853 /// but with all dynamically-allocated buffers duplicated in new buffers.
24854 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
24856 /// The contents of CResult_HtlcBasepointDecodeErrorZ
24857 pub union CResult_HtlcBasepointDecodeErrorZPtr {
24858 /// A pointer to the contents in the success state.
24859 /// Reading from this pointer when `result_ok` is not set is undefined.
24860 pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
24861 /// A pointer to the contents in the error state.
24862 /// Reading from this pointer when `result_ok` is set is undefined.
24863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24866 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
24867 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24869 pub struct CResult_HtlcBasepointDecodeErrorZ {
24870 /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
24871 /// `err` or `result` depending on the state of `result_ok`.
24872 pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
24873 /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
24874 pub result_ok: bool,
24877 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
24878 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
24879 CResult_HtlcBasepointDecodeErrorZ {
24880 contents: CResult_HtlcBasepointDecodeErrorZPtr {
24881 result: Box::into_raw(Box::new(o)),
24887 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
24888 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
24889 CResult_HtlcBasepointDecodeErrorZ {
24890 contents: CResult_HtlcBasepointDecodeErrorZPtr {
24891 err: Box::into_raw(Box::new(e)),
24896 /// Checks if the given object is currently in the success state
24898 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
24902 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
24903 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
24904 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
24905 fn drop(&mut self) {
24906 if self.result_ok {
24907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24908 let _ = unsafe { Box::from_raw(self.contents.result) };
24911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24912 let _ = unsafe { Box::from_raw(self.contents.err) };
24917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
24918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24919 let contents = if o.result_ok {
24920 let result = unsafe { o.contents.result };
24921 unsafe { o.contents.result = core::ptr::null_mut() };
24922 CResult_HtlcBasepointDecodeErrorZPtr { result }
24924 let err = unsafe { o.contents.err };
24925 unsafe { o.contents.err = core::ptr::null_mut(); }
24926 CResult_HtlcBasepointDecodeErrorZPtr { err }
24930 result_ok: o.result_ok,
24934 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
24935 fn clone(&self) -> Self {
24936 if self.result_ok {
24937 Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
24938 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
24941 Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
24942 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24948 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
24949 /// but with all dynamically-allocated buffers duplicated in new buffers.
24950 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
24952 /// The contents of CResult_HtlcKeyDecodeErrorZ
24953 pub union CResult_HtlcKeyDecodeErrorZPtr {
24954 /// A pointer to the contents in the success state.
24955 /// Reading from this pointer when `result_ok` is not set is undefined.
24956 pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
24957 /// A pointer to the contents in the error state.
24958 /// Reading from this pointer when `result_ok` is set is undefined.
24959 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24962 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
24963 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
24964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24965 pub struct CResult_HtlcKeyDecodeErrorZ {
24966 /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
24967 /// `err` or `result` depending on the state of `result_ok`.
24968 pub contents: CResult_HtlcKeyDecodeErrorZPtr,
24969 /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
24970 pub result_ok: bool,
24973 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
24974 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
24975 CResult_HtlcKeyDecodeErrorZ {
24976 contents: CResult_HtlcKeyDecodeErrorZPtr {
24977 result: Box::into_raw(Box::new(o)),
24983 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
24984 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
24985 CResult_HtlcKeyDecodeErrorZ {
24986 contents: CResult_HtlcKeyDecodeErrorZPtr {
24987 err: Box::into_raw(Box::new(e)),
24992 /// Checks if the given object is currently in the success state
24994 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
24998 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
24999 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
25000 impl Drop for CResult_HtlcKeyDecodeErrorZ {
25001 fn drop(&mut self) {
25002 if self.result_ok {
25003 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25004 let _ = unsafe { Box::from_raw(self.contents.result) };
25007 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25008 let _ = unsafe { Box::from_raw(self.contents.err) };
25013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
25014 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
25015 let contents = if o.result_ok {
25016 let result = unsafe { o.contents.result };
25017 unsafe { o.contents.result = core::ptr::null_mut() };
25018 CResult_HtlcKeyDecodeErrorZPtr { result }
25020 let err = unsafe { o.contents.err };
25021 unsafe { o.contents.err = core::ptr::null_mut(); }
25022 CResult_HtlcKeyDecodeErrorZPtr { err }
25026 result_ok: o.result_ok,
25030 impl Clone for CResult_HtlcKeyDecodeErrorZ {
25031 fn clone(&self) -> Self {
25032 if self.result_ok {
25033 Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
25034 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
25037 Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
25038 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25044 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
25045 /// but with all dynamically-allocated buffers duplicated in new buffers.
25046 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
25048 /// The contents of CResult_RevocationBasepointDecodeErrorZ
25049 pub union CResult_RevocationBasepointDecodeErrorZPtr {
25050 /// A pointer to the contents in the success state.
25051 /// Reading from this pointer when `result_ok` is not set is undefined.
25052 pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
25053 /// A pointer to the contents in the error state.
25054 /// Reading from this pointer when `result_ok` is set is undefined.
25055 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25058 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
25059 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
25060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25061 pub struct CResult_RevocationBasepointDecodeErrorZ {
25062 /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
25063 /// `err` or `result` depending on the state of `result_ok`.
25064 pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
25065 /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
25066 pub result_ok: bool,
25069 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
25070 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
25071 CResult_RevocationBasepointDecodeErrorZ {
25072 contents: CResult_RevocationBasepointDecodeErrorZPtr {
25073 result: Box::into_raw(Box::new(o)),
25079 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
25080 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
25081 CResult_RevocationBasepointDecodeErrorZ {
25082 contents: CResult_RevocationBasepointDecodeErrorZPtr {
25083 err: Box::into_raw(Box::new(e)),
25088 /// Checks if the given object is currently in the success state
25090 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
25094 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
25095 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
25096 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
25097 fn drop(&mut self) {
25098 if self.result_ok {
25099 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25100 let _ = unsafe { Box::from_raw(self.contents.result) };
25103 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25104 let _ = unsafe { Box::from_raw(self.contents.err) };
25109 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
25110 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
25111 let contents = if o.result_ok {
25112 let result = unsafe { o.contents.result };
25113 unsafe { o.contents.result = core::ptr::null_mut() };
25114 CResult_RevocationBasepointDecodeErrorZPtr { result }
25116 let err = unsafe { o.contents.err };
25117 unsafe { o.contents.err = core::ptr::null_mut(); }
25118 CResult_RevocationBasepointDecodeErrorZPtr { err }
25122 result_ok: o.result_ok,
25126 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
25127 fn clone(&self) -> Self {
25128 if self.result_ok {
25129 Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
25130 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
25133 Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
25134 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25140 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
25141 /// but with all dynamically-allocated buffers duplicated in new buffers.
25142 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
25144 /// The contents of CResult_RevocationKeyDecodeErrorZ
25145 pub union CResult_RevocationKeyDecodeErrorZPtr {
25146 /// A pointer to the contents in the success state.
25147 /// Reading from this pointer when `result_ok` is not set is undefined.
25148 pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
25149 /// A pointer to the contents in the error state.
25150 /// Reading from this pointer when `result_ok` is set is undefined.
25151 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25154 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
25155 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
25156 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25157 pub struct CResult_RevocationKeyDecodeErrorZ {
25158 /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
25159 /// `err` or `result` depending on the state of `result_ok`.
25160 pub contents: CResult_RevocationKeyDecodeErrorZPtr,
25161 /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
25162 pub result_ok: bool,
25165 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
25166 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
25167 CResult_RevocationKeyDecodeErrorZ {
25168 contents: CResult_RevocationKeyDecodeErrorZPtr {
25169 result: Box::into_raw(Box::new(o)),
25175 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
25176 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
25177 CResult_RevocationKeyDecodeErrorZ {
25178 contents: CResult_RevocationKeyDecodeErrorZPtr {
25179 err: Box::into_raw(Box::new(e)),
25184 /// Checks if the given object is currently in the success state
25186 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
25190 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
25191 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
25192 impl Drop for CResult_RevocationKeyDecodeErrorZ {
25193 fn drop(&mut self) {
25194 if self.result_ok {
25195 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25196 let _ = unsafe { Box::from_raw(self.contents.result) };
25199 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25200 let _ = unsafe { Box::from_raw(self.contents.err) };
25205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
25206 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
25207 let contents = if o.result_ok {
25208 let result = unsafe { o.contents.result };
25209 unsafe { o.contents.result = core::ptr::null_mut() };
25210 CResult_RevocationKeyDecodeErrorZPtr { result }
25212 let err = unsafe { o.contents.err };
25213 unsafe { o.contents.err = core::ptr::null_mut(); }
25214 CResult_RevocationKeyDecodeErrorZPtr { err }
25218 result_ok: o.result_ok,
25222 impl Clone for CResult_RevocationKeyDecodeErrorZ {
25223 fn clone(&self) -> Self {
25224 if self.result_ok {
25225 Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
25226 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
25229 Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
25230 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25236 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
25237 /// but with all dynamically-allocated buffers duplicated in new buffers.
25238 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
25240 /// An enum which can either contain a crate::lightning::chain::Filter or not
25241 pub enum COption_FilterZ {
25242 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
25243 Some(crate::lightning::chain::Filter),
25244 /// When we're in this state, this COption_FilterZ contains nothing
25247 impl COption_FilterZ {
25248 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
25249 if let Self::None = self { false } else { true }
25251 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
25254 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
25255 if let Self::Some(v) = self { v } else { unreachable!() }
25259 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
25260 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
25261 COption_FilterZ::Some(o)
25264 /// Constructs a new COption_FilterZ containing nothing
25265 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
25266 COption_FilterZ::None
25269 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
25270 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
25272 /// The contents of CResult_LockedChannelMonitorNoneZ
25273 pub union CResult_LockedChannelMonitorNoneZPtr {
25274 /// A pointer to the contents in the success state.
25275 /// Reading from this pointer when `result_ok` is not set is undefined.
25276 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
25277 /// Note that this value is always NULL, as there are no contents in the Err variant
25278 pub err: *mut core::ffi::c_void,
25281 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
25282 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
25283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25284 pub struct CResult_LockedChannelMonitorNoneZ {
25285 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
25286 /// `err` or `result` depending on the state of `result_ok`.
25287 pub contents: CResult_LockedChannelMonitorNoneZPtr,
25288 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
25289 pub result_ok: bool,
25292 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
25293 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
25294 CResult_LockedChannelMonitorNoneZ {
25295 contents: CResult_LockedChannelMonitorNoneZPtr {
25296 result: Box::into_raw(Box::new(o)),
25302 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
25303 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
25304 CResult_LockedChannelMonitorNoneZ {
25305 contents: CResult_LockedChannelMonitorNoneZPtr {
25306 err: core::ptr::null_mut(),
25311 /// Checks if the given object is currently in the success state
25313 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
25317 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
25318 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
25319 impl Drop for CResult_LockedChannelMonitorNoneZ {
25320 fn drop(&mut self) {
25321 if self.result_ok {
25322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25323 let _ = unsafe { Box::from_raw(self.contents.result) };
25329 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
25330 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
25331 let contents = if o.result_ok {
25332 let result = unsafe { o.contents.result };
25333 unsafe { o.contents.result = core::ptr::null_mut() };
25334 CResult_LockedChannelMonitorNoneZPtr { result }
25336 let _ = unsafe { Box::from_raw(o.contents.err) };
25337 o.contents.err = core::ptr::null_mut();
25338 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
25342 result_ok: o.result_ok,
25347 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
25348 /// This corresponds to std::vector in C++
25349 pub struct CVec_OutPointZ {
25350 /// The elements in the array.
25351 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
25352 pub data: *mut crate::lightning::chain::transaction::OutPoint,
25353 /// The number of elements pointed to by `data`.
25356 impl CVec_OutPointZ {
25357 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
25358 if self.datalen == 0 { return Vec::new(); }
25359 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25360 self.data = core::ptr::null_mut();
25364 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
25365 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
25368 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
25369 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
25370 let datalen = v.len();
25371 let data = Box::into_raw(v.into_boxed_slice());
25372 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
25376 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
25377 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
25378 impl Drop for CVec_OutPointZ {
25379 fn drop(&mut self) {
25380 if self.datalen == 0 { return; }
25381 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
25384 impl Clone for CVec_OutPointZ {
25385 fn clone(&self) -> Self {
25386 let mut res = Vec::new();
25387 if self.datalen == 0 { return Self::from(res); }
25388 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
25393 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
25394 /// This corresponds to std::vector in C++
25395 pub struct CVec_MonitorUpdateIdZ {
25396 /// The elements in the array.
25397 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
25398 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
25399 /// The number of elements pointed to by `data`.
25402 impl CVec_MonitorUpdateIdZ {
25403 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
25404 if self.datalen == 0 { return Vec::new(); }
25405 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25406 self.data = core::ptr::null_mut();
25410 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
25411 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
25414 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
25415 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
25416 let datalen = v.len();
25417 let data = Box::into_raw(v.into_boxed_slice());
25418 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
25422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
25423 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
25424 impl Drop for CVec_MonitorUpdateIdZ {
25425 fn drop(&mut self) {
25426 if self.datalen == 0 { return; }
25427 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
25430 impl Clone for CVec_MonitorUpdateIdZ {
25431 fn clone(&self) -> Self {
25432 let mut res = Vec::new();
25433 if self.datalen == 0 { return Self::from(res); }
25434 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
25439 /// A tuple of 2 elements. See the individual fields for the types contained.
25440 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25441 /// The element at position 0
25442 pub a: crate::lightning::chain::transaction::OutPoint,
25443 /// The element at position 1
25444 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
25446 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25447 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
25454 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25455 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
25459 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25460 fn clone(&self) -> Self {
25462 a: Clone::clone(&self.a),
25463 b: Clone::clone(&self.b),
25468 /// Creates a new tuple which has the same data as `orig`
25469 /// but with all dynamically-allocated buffers duplicated in new buffers.
25470 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
25471 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
25473 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
25474 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
25478 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
25479 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
25481 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
25482 /// This corresponds to std::vector in C++
25483 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25484 /// The elements in the array.
25485 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
25486 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
25487 /// The number of elements pointed to by `data`.
25490 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25491 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
25492 if self.datalen == 0 { return Vec::new(); }
25493 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25494 self.data = core::ptr::null_mut();
25498 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
25499 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
25502 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25503 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
25504 let datalen = v.len();
25505 let data = Box::into_raw(v.into_boxed_slice());
25506 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
25510 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
25511 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
25512 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25513 fn drop(&mut self) {
25514 if self.datalen == 0 { return; }
25515 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
25518 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
25519 fn clone(&self) -> Self {
25520 let mut res = Vec::new();
25521 if self.datalen == 0 { return Self::from(res); }
25522 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });